Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
Diff: tls/tls-connection.c
- Revision:
- 8:5e66a6b4b38c
- Parent:
- 6:819c17738dc2
- Child:
- 10:e269fd7b9500
--- a/tls/tls-connection.c Thu Sep 05 12:58:41 2019 +0000
+++ b/tls/tls-connection.c Sat Sep 07 18:56:01 2019 +0000
@@ -7,18 +7,26 @@
static struct TlsConnection connections[MAX_CONNECTIONS];
+struct TlsConnection* TlsConnectionGetNext()
+{
+ static struct TlsConnection* p = connections + MAX_CONNECTIONS - 1; //Initialise to last element
+ p++;
+ if (p >= connections + MAX_CONNECTIONS) p = connections;
+ return p;
+}
+
static void zeroConnection(struct TlsConnection* p)
{
p->id = 0;
p->lastUsed = 0;
p->toDo = 0;
p->session = 0;
- Sha256Start(&p->handshakeHash); //This just clears any information previously calculated
+ Sha256Start(&p->handshakeSha); //This just clears any information previously calculated
p->clientEncrypted = false;
p->serverEncrypted = false;
for (int i = 0; i < TLS_RANDOM_SIZE; i++) p->clientRandom[i] = 0;
for (int i = 0; i < TLS_RANDOM_SIZE; i++) p->serverRandom[i] = 0;
- for (int i = 0; i < TLS_VERIFY_SIZE; i++) p->clientVerify[i] = 0;
+ for (int i = 0; i < TLS_DEFERRED_CONTENT_SIZE; i++) p->deferredContent[i] = 0;
}
struct TlsConnection* TlsConnectionNew(int connectionId) //Never fails so never returns NULL
@@ -77,3 +85,4 @@
if (p->id == connectionId) zeroConnection(p);
}
}
+