A simple library to support serving https.

Dependents:   oldheating gps motorhome heating

tls/tls-connection.h

Committer:
andrewboyson
Date:
2019-08-28
Revision:
5:ee5489ee1117
Child:
6:819c17738dc2

File content as of revision 5:ee5489ee1117:

#include "sha256.h"

#define DO_WAIT_CLIENT_HELLO                0
#define DO_SEND_SERVER_HELLO                1
#define DO_WAIT_CLIENT_CHANGE               2
#define DO_WAIT_DECRYPT_MASTER_SECRET       3
#define DO_SEND_SERVER_CHANGE               4
#define DO_APPLICATION                      5
#define DO_SEND_ALERT_ILLEGAL_PARAMETER     6
#define DO_SEND_ALERT_INTERNAL_ERROR        7

struct TlsConnection
{
    int                id; //An id of zero means the record is empty
    uint32_t           lastUsed;
    int                toDo;
    int                session;
    struct Sha256State handshakeHash;
};

extern struct TlsConnection* TlsConnectionNew   (int connectionId); //Never fails so never returns NULL
extern struct TlsConnection* TlsConnectionOrNull(int connectionId);
extern void                  TlsConnectionReset (int connectionId);