A simple library to support serving https.

Dependents:   oldheating gps motorhome heating

Revision:
13:0a80b49a5e78
Parent:
10:e269fd7b9500
Child:
14:03a0b8fd6ddc
--- a/tls/tls-response.c	Thu Sep 26 07:19:09 2019 +0000
+++ b/tls/tls-response.c	Fri Sep 27 11:31:18 2019 +0000
@@ -30,14 +30,14 @@
     //Set up a multiple handshakes content - hello, certificate and done
     LogTime("     sending server hello\r\n");
     uint8_t* p = pWindow;
-    *p++ = TLS_CONTENT_TYPE_Handshake;                 //Content is handshakes
+    *p++ = TLS_CONTENT_TYPE_HANDSHAKE;                 //Content is handshakes
     *p++ = 0x03; *p++ = 0x03;                          //Legacy TLS version
     uint8_t* pHandshakesLength = p;
     p += 2;                                            //Handshakes Length (2 bytes)
     uint8_t* handshakesPayloadStart = p;               //Record the start of the handshake payload     
     
     //Server hello handshake
-    *p++ = TLS_HANDSHAKE_ServerHello;                  //Handshake type server hello
+    *p++ = TLS_HANDSHAKE_SERVER_HELLO;                 //Handshake type server hello
     *p++ = 0x00;
     uint8_t* pHandshakeHelloLength = p;
     p += 2;                                            //Size of this handshake
@@ -62,15 +62,15 @@
     backfillSize(p, pHandshakeHelloLength);
     
     //Certificate handshake
-    *p++ = TLS_HANDSHAKE_Certificate; *p++ = 0x00;     //Handshake type certificate
-    addSize(&p, SerCerSize + 6);      *p++ = 0x00;     //Size of this handshake
-    addSize(&p, SerCerSize + 3);      *p++ = 0x00;     //Size of all certificates
-    addSize(&p, SerCerSize    );                       //Size of first certificate
+    *p++ = TLS_HANDSHAKE_CERTIFICATE; *p++ = 0x00;             //Handshake type certificate
+    addSize(&p, SerCerSize + 6);      *p++ = 0x00;             //Size of this handshake
+    addSize(&p, SerCerSize + 3);      *p++ = 0x00;             //Size of all certificates
+    addSize(&p, SerCerSize    );                               //Size of first certificate
     for (int i = 0; i < SerCerSize; i++) *p++ = SerCerData[i]; //Certificate
     
     //Hello done handshake
-    *p++ = TLS_HANDSHAKE_ServerHelloDone; *p++ = 0x00; //Handshake type server hello done
-    *p++ = 0; *p++ = 0;                                //Size of this handshake
+    *p++ = TLS_HANDSHAKE_SERVER_HELLO_DONE; *p++ = 0x00;       //Handshake type server hello done
+    *p++ = 0; *p++ = 0;                                        //Size of this handshake
     backfillSize(p, pHandshakesLength);
     
     //Finalise the handshake content
@@ -92,7 +92,7 @@
     pConnection->serverSequence = 0;
     
     LogTime("     sending server handshake finished\r\n");
-    *p++ = TLS_CONTENT_TYPE_Handshake;                             //Content is handshakes
+    *p++ = TLS_CONTENT_TYPE_HANDSHAKE;                             //Content is handshakes
     *p++ = 0x03; *p++ = 0x03;                                      //Legacy TLS version
     uint8_t* pHandshakesLength = p;
     p += 2;                                                        //Handshakes Length (2 bytes)
@@ -107,7 +107,7 @@
     
     //Make the 'finished' handshake
     uint8_t payload[16];
-    payload[0] = TLS_HANDSHAKE_Finished;
+    payload[0] = TLS_HANDSHAKE_FINISHED;
     payload[1] = 0x00;
     payload[2] = 0x00;
     payload[3] = 0x0c; //Length 12
@@ -118,7 +118,7 @@
     TlsMacSha1(TLS_KEY_SIZE_MAC,
                pConnection->serverMacKey,
                pConnection->serverSequence,
-               TLS_CONTENT_TYPE_Handshake,
+               TLS_CONTENT_TYPE_HANDSHAKE,
                0x03,
                0x03,
                payloadLength,
@@ -186,7 +186,7 @@
     LogF("- available window size %d\r\n", *pWindowSize);
     LogF("- position of window in stream %d\r\n", positionOfWindowInStream);
     uint8_t* p = pWindow;
-    *p++ = TLS_CONTENT_TYPE_Application;
+    *p++ = TLS_CONTENT_TYPE_APPLICATION;
     *p++ = 0x03; *p++ = 0x03;
     
     //Prepare a place to backfill the size
@@ -211,7 +211,7 @@
     TlsMacSha1(TLS_KEY_SIZE_MAC,
                pConnection->serverMacKey,
                pConnection->serverSequence,
-               TLS_CONTENT_TYPE_Application,
+               TLS_CONTENT_TYPE_APPLICATION,
                0x03,
                0x03,
                payloadSize,