A simple library to support serving https.

Dependents:   oldheating gps motorhome heating

Revision:
7:94ef5824c3c0
Parent:
6:819c17738dc2
Child:
8:5e66a6b4b38c
--- a/tls/tls-request.c	Sun Sep 01 18:15:12 2019 +0000
+++ b/tls/tls-request.c	Thu Sep 05 12:58:41 2019 +0000
@@ -17,10 +17,6 @@
         LogF("TLS - %d byte client hello message is not at least 100 bytes long\r\n", length);
         return -1;
     }
-            
-    //Start and add the handshake hash
-    Sha256Start(&pConnection->handshakeHash);
-    Sha256Add  (&pConnection->handshakeHash, pBuffer, length);
     
     //Read in the parameters
     uint8_t versionH         = *p++;
@@ -63,8 +59,6 @@
         return -1;
     }
     
-    Sha256Add  (&pConnection->handshakeHash, pBuffer, length);
-    
     if (length != 130)
     {
         LogF("TLS - %d byte client key exchange message is not 130 bytes long\r\n", length);
@@ -119,6 +113,8 @@
 
 static void handleHandshake(int length, uint8_t* pBuffer, struct TlsConnection* pConnection)
 {
+    Sha256Add(&pConnection->handshakeHash, pBuffer, length);
+    
     uint8_t* p = pBuffer;
     while (p < pBuffer + length)
     {
@@ -226,6 +222,7 @@
     {
         //If this is the start of the request then open a new connection
         pConnection = TlsConnectionNew(connectionId);
+        Sha256Start(&pConnection->handshakeHash);
     }
     else
     {