A simple library to support serving https.

Dependents:   oldheating gps motorhome heating

Revision:
8:5e66a6b4b38c
Parent:
7:94ef5824c3c0
Child:
10:e269fd7b9500
--- a/tls/tls-connection.h	Thu Sep 05 12:58:41 2019 +0000
+++ b/tls/tls-connection.h	Sat Sep 07 18:56:01 2019 +0000
@@ -17,6 +17,7 @@
 
 #define TLS_KEY_SIZE_MAC    20
 #define TLS_KEY_SIZE_WRITE  16
+#define TLS_DEFERRED_CONTENT_SIZE 100
 
 struct TlsConnection
 {
@@ -24,20 +25,24 @@
     uint32_t           lastUsed;
     int                toDo;
     int                session;
-    struct Sha256State handshakeHash;
-    struct Sha256State handshakeHashClient;
+    struct Sha256State handshakeSha;
     bool               clientEncrypted;
     bool               serverEncrypted;
     uint8_t            clientRandom[TLS_RANDOM_SIZE];
     uint8_t            serverRandom[TLS_RANDOM_SIZE];
-    uint8_t            clientVerify[TLS_VERIFY_SIZE];
+    uint8_t            clientHandshakeHash[SHA256_HASH_SIZE];
+    uint8_t            deferredContent[TLS_DEFERRED_CONTENT_SIZE];
+    uint64_t           clientSequence;
+    uint64_t           serverSequence;
     
-    uint8_t             clientMacKey  [TLS_KEY_SIZE_MAC   ];
-    uint8_t             serverMacKey  [TLS_KEY_SIZE_MAC   ];
-    uint8_t             clientWriteKey[TLS_KEY_SIZE_WRITE ];
-    uint8_t             serverWriteKey[TLS_KEY_SIZE_WRITE ];    
+    uint8_t            clientMacKey  [TLS_KEY_SIZE_MAC  ];
+    uint8_t            serverMacKey  [TLS_KEY_SIZE_MAC  ];
+    uint8_t            clientWriteKey[TLS_KEY_SIZE_WRITE];
+    uint8_t            serverWriteKey[TLS_KEY_SIZE_WRITE];    
 };
 
+extern struct TlsConnection* TlsConnectionGetNext(void);
+
 extern struct TlsConnection* TlsConnectionNew   (int connectionId); //Never fails so never returns NULL
 extern struct TlsConnection* TlsConnectionOrNull(int connectionId);
 extern void                  TlsConnectionReset (int connectionId);