#include <trsocket.h>
/*
* Data structure for TLS/SSL Pre-Shared Key (PSK) handshake.
* The pskSocket member is the socket descriptor you are using for your
* TLS connection.
* Information set by the caller and returned to the caller depends on
* the context:
* 1. For tfSslPskGetData(), the caller provides the storage with
* pskSocket set. The rest of the structure is filled by
* tfSslPskGetData().
* 2. During PSK client handshake, Treck calls the user's PSK callback
* function (tfSslPskRegisterCallback) with pskSocket set. The
* user's callback function sets the PSK key (shared secret) and
* PSK identity (tells the server which PSK key to use). Treck
* will set the PSK hint if the server sent one (NULL otherwise).
* 3. During PSK server handshake, Treck calls the user's PSK callback
* function (tfSslPskRegisterCallback) with pskSocket and the
* PSK identity set. The user's callback function sets the PSK key
* (shared secret).
* For 2 and 3, the user copies the required data to the storage pointers
* provided in the structure, up to the length specified. The user then
* sets the length of data copied.
* Note that 2 and 3 are mutually exclusive and depend on whether your
* end is a TLS client (tfSslClientUserStart) or server (accept or
* tfSslServerUserCreate).
*/
typedef struct tsUserSslPskCBData
{
int pskSocket; /* socket descriptor */
char TM_FAR * pskSecretPtr; /* private, shared key */
unsigned int pskSecretLength;
char TM_FAR * pskIdentityPtr; /* public, key identity, from client */
unsigned int pskIdentityLength;
char TM_FAR * pskHintPtr; /* public, optional, from server */
unsigned int pskHintLength;
} ttUserSslPskCBData;
typedef ttUserSslPskCBData TM_FAR * ttUserSslPskCBDataPtr;