A simple library to support serving https.
Dependents: oldheating gps motorhome heating
Diff: tls/tls-connection.h
- Revision:
- 6:819c17738dc2
- Parent:
- 5:ee5489ee1117
- Child:
- 7:94ef5824c3c0
--- a/tls/tls-connection.h Wed Aug 28 07:10:59 2019 +0000 +++ b/tls/tls-connection.h Sun Sep 01 18:15:12 2019 +0000 @@ -1,3 +1,6 @@ +#include <stdbool.h> +#include <stdint.h> + #include "sha256.h" #define DO_WAIT_CLIENT_HELLO 0 @@ -9,6 +12,12 @@ #define DO_SEND_ALERT_ILLEGAL_PARAMETER 6 #define DO_SEND_ALERT_INTERNAL_ERROR 7 +#define TLS_RANDOM_SIZE 32 +#define TLS_VERIFY_SIZE 64 + +#define TLS_KEY_SIZE_MAC 20 +#define TLS_KEY_SIZE_WRITE 16 + struct TlsConnection { int id; //An id of zero means the record is empty @@ -16,6 +25,16 @@ int toDo; int session; struct Sha256State handshakeHash; + bool clientEncrypted; + bool serverEncrypted; + uint8_t clientRandom[TLS_RANDOM_SIZE]; + uint8_t serverRandom[TLS_RANDOM_SIZE]; + uint8_t clientVerify[TLS_VERIFY_SIZE]; + + 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* TlsConnectionNew (int connectionId); //Never fails so never returns NULL