A simple library to support serving https.
Dependents: oldheating gps motorhome heating
Diff: tls/tls-connection.h
- Revision:
- 17:93feb2a51d58
- Parent:
- 14:03a0b8fd6ddc
- Child:
- 19:f22327e8be7b
--- a/tls/tls-connection.h Sun Oct 06 08:00:30 2019 +0000 +++ b/tls/tls-connection.h Thu Oct 10 07:38:13 2019 +0000 @@ -1,6 +1,7 @@ #include <stdbool.h> #include <stdint.h> +#include "tls-defs.h" #include "sha256.h" #define DO_WAIT_CLIENT_HELLO 0 @@ -13,11 +14,6 @@ #define DO_SEND_ALERT_ILLEGAL_PARAMETER 7 #define DO_SEND_ALERT_INTERNAL_ERROR 8 -#define TLS_RANDOM_SIZE 32 -#define TLS_VERIFY_SIZE 64 - -#define TLS_KEY_SIZE_MAC 20 -#define TLS_KEY_SIZE_WRITE 16 #define TLS_DEFERRED_CONTENT_SIZE 100 struct TlsConnection @@ -30,8 +26,8 @@ struct Sha256State handshakeSha; bool clientEncrypted; bool serverEncrypted; - uint8_t clientRandom[TLS_RANDOM_SIZE]; - uint8_t serverRandom[TLS_RANDOM_SIZE]; + uint8_t clientRandom[TLS_LENGTH_RANDOM]; + uint8_t serverRandom[TLS_LENGTH_RANDOM]; uint8_t clientHandshakeHash[SHA256_HASH_SIZE]; uint8_t deferredContent[TLS_DEFERRED_CONTENT_SIZE]; uint64_t clientSequence; @@ -40,10 +36,10 @@ uint32_t serverPositionInStreamOffset; int slotPriKeyDecryption; - 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_LENGTH_MAC_KEY]; + uint8_t serverMacKey [TLS_LENGTH_MAC_KEY]; + uint8_t clientWriteKey[TLS_LENGTH_CIPHER_KEY]; + uint8_t serverWriteKey[TLS_LENGTH_CIPHER_KEY]; }; extern struct TlsConnection* TlsConnectionGetNext(void);