A simple library to support serving https.

Dependents:   oldheating gps motorhome heating

Revision:
13:0a80b49a5e78
Parent:
10:e269fd7b9500
Child:
14:03a0b8fd6ddc
--- a/tls/tls-session.c	Thu Sep 26 07:19:09 2019 +0000
+++ b/tls/tls-session.c	Fri Sep 27 11:31:18 2019 +0000
@@ -5,6 +5,7 @@
 #include "tls-session.h"
 #include "mstimer.h"
 #include "hrtimer.h"
+#include "log.h"
 
 #define TLS_MAX_SESSIONS 4
 
@@ -51,6 +52,11 @@
 
 struct TlsSession* TlsSessionOrNull(uint32_t id)
 {
+    if (!id)
+    {
+        Log("TlsSessionOrNull - session id cannot be 0\r\n");
+        return 0; 
+    }
     for (struct TlsSession* p = sessions; p < sessions + TLS_MAX_SESSIONS; p++)
     {
         if (p->id == id) return p;
@@ -59,6 +65,11 @@
 }
 void TlsSessionReset(uint32_t id)
 {
+    if (!id)
+    {
+        Log("TlsSessionReset - session id cannot be 0\r\n");
+        return; 
+    }
     for (struct TlsSession* p = sessions; p < sessions + TLS_MAX_SESSIONS; p++)
     {
         if (p->id == id) zeroSession(p);