![]() |
TrustCore SDK NanoSSL API reference
version 7.0
|
NanoSSL functions that aren't part of any other function group. More...
Functions | |
MOC_EXTERN MSTATUS | SSL_deserializePSK (ubyte *pPsk, ubyte4 pskLen, tls13PSK **ppRetPsk) |
Deserialize TLS 1.3 PSK. More... | |
MOC_EXTERN MSTATUS | SSL_freePSK (tls13PSK **ppPsk) |
Free TLS 1.3 PSK. More... | |
MOC_EXTERN sbyte4 | SSL_getSelectedApplicationProtocol (sbyte4 connectionInstance, const ubyte **selectedApplicationProtocol, ubyte4 *selectedApplicationProtocolLen) |
Retrieve the selected Application Layer Protocol. More... | |
MOC_EXTERN sbyte4 | SSL_getSSLTLSVersion (sbyte4 connectionInstance, ubyte4 *pVersion) |
Get a connection's SSL/TLS version. More... | |
MOC_EXTERN MSTATUS | SSL_serializePSK (tls13PSK *pPsk, ubyte **ppPsk, ubyte4 *pPskLen) |
Serialize TLS 1.3 PSK. More... | |
MOC_EXTERN sbyte4 | SSL_setApplicationLayerProtocol (sbyte4 connectionInstance, sbyte4 numNextProtocols, const char **nextProtocols) |
Set the Application Layer Protocol Negotiation information. More... | |
MOC_EXTERN MSTATUS | SSL_setClientCAList (SizedBuffer *pClientCAList, ubyte4 numClientCANames) |
Set the CA list that will be sent as part of Certificate Request message. More... | |
MOC_EXTERN sbyte4 | SSL_setEarlyData (sbyte4 connectionInstance, ubyte *pEarlyData, ubyte4 earlyDataSize) |
Set the max early data. More... | |
MOC_EXTERN sbyte4 | SSL_setMaxEarlyDataSize (sbyte4 connectionInstance, sbyte4 earlyDataSize) |
Set the max early data size. More... | |
MOC_EXTERN sbyte4 | SSL_setRecvEarlyDataSize (sbyte4 connectionInstance, sbyte4 recvEarlyDataSize) |
Set the recv early data size. More... | |
MOC_EXTERN MSTATUS SSL_deserializePSK | ( | ubyte * | pPsk, |
ubyte4 | pskLen, | ||
tls13PSK ** | ppRetPsk | ||
) |
This function takes in a serialized ASN.1 TLS 1.3 PSK encoding and converts it into a NanoSSL TLS 1.3 PSK object. The allocated PSK object must be freed by the caller.
The PSK ASN.1 encoding is required to be
SEQUENCE INTEGER version INTEGER isExternal INTEGER isPSKavailable INTEGER pskTLS13LifetimeHint INTEGER pskTLS13AgeAdd OCTETSTRING ticketNonce OCTETSTRING pskTLS13 INTEGER obfuscatedTicketAge INTEGER hashAlgo UTCTIME startTime INTEGER maxEarlyDataSize INTEGER pSelectedTlsVersion OCTETSTRING selectedALPN INTEGER selectedCipherSuiteId
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_TLS13__
__ENABLE_MOCANA_TLS13_PSK__
pPsk | Pointer to the PSK to deserialize. |
pskLen | Length of the PSK to deserialize. |
ppRetPsk | Location at which the new PSK object will be stored. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN MSTATUS SSL_freePSK | ( | tls13PSK ** | ppPsk | ) |
This function free a TLS 1.3 PSK structure.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_TLS13__
__ENABLE_MOCANA_TLS13_PSK__
ppPsk | Location at which the serialized PSK pointer is freed. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_getSelectedApplicationProtocol | ( | sbyte4 | connectionInstance, |
const ubyte ** | selectedApplicationProtocol, | ||
ubyte4 * | selectedApplicationProtocolLen | ||
) |
This function retrieves the index of the selected application layer protocol, and returns it in the .
Please review the function and param descriptions to ensure that the Tech Pubs edits are ok.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
__ENABLE_MOCANA_SSL_SERVER__
__ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
connectionInstance | Connection instance returned from SSL_connect(). |
selectedApplicationProtocol | On input, application protocol to search for. On return, pointer to matching socket. |
selectedApplicationProtocolLen | On input, length (number of bytes) in the string representing the selected application protocol (selected ApplicationProtocol). On return, pointer to length of string representing the mathcing socket. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_getSSLTLSVersion | ( | sbyte4 | connectionInstance, |
ubyte4 * | pVersion | ||
) |
This function retrieves the specified connection's SSL/TLS version.
(is this for sync and/or async, client and/or server?)
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
__ENABLE_MOCANA_SSL_SERVER__
__ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
connectionInstance | Connection instance returned from SSL_connect(). |
pVersion | On return, pointer to the connection's SSL version. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN MSTATUS SSL_serializePSK | ( | tls13PSK * | pPsk, |
ubyte ** | ppPsk, | ||
ubyte4 * | pPskLen | ||
) |
This function takes in a NanoSSL TLS 1.3 PSK object and serializes the data into an ASN.1 encoded byte array. The allocated array must be freed by the caller.
The PSK ASN.1 encoding will be output as follows
SEQUENCE INTEGER version INTEGER isExternal INTEGER isPSKavailable INTEGER pskTLS13LifetimeHint INTEGER pskTLS13AgeAdd OCTETSTRING ticketNonce OCTETSTRING pskTLS13 INTEGER obfuscatedTicketAge INTEGER hashAlgo UTCTIME startTime INTEGER maxEarlyDataSize INTEGER pSelectedTlsVersion OCTETSTRING selectedALPN INTEGER selectedCipherSuiteId
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_TLS13__
__ENABLE_MOCANA_TLS13_PSK__
pPsk | PSK object to serialize. |
ppPsk | Location at which the new serialized PSK pointer will be stored. |
pPskLen | Location at which the length of the serialized PSK will be stored. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_setApplicationLayerProtocol | ( | sbyte4 | connectionInstance, |
sbyte4 | numNextProtocols, | ||
const char ** | nextProtocols | ||
) |
This function sets (defines) the application layer protocols to use during connection negotiations.
Please review the function and param descriptions to ensure that the Tech Pubs edits are ok.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
__ENABLE_MOCANA_SSL_SERVER__
__ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
connectionInstance | Connection instance returned from SSL_connect(). |
numNextProtocols | Number of elements in the nextProtocols array of protocols to use. |
nextProtocols | Array of protocols to use, in order of preference. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN MSTATUS SSL_setClientCAList | ( | SizedBuffer * | pClientCAList, |
ubyte4 | numClientCANames | ||
) |
This function sets CA list sent as part of Certificate Request message during connection negotiations. Client should send a certificate who issuer is one in the CA list
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_SERVER__
__ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
pClientCAList | List of CA Names. This is a SizedBuffer list, where data of each element contains the CA X509 Name and length contains the length of X509 Name |
numClientCANames | Number of CA Names in the list. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_setEarlyData | ( | sbyte4 | connectionInstance, |
ubyte * | pEarlyData, | ||
ubyte4 | earlyDataSize | ||
) |
This function sets the early data which should be sent if 0-RTT is being used. The early data is not copied. It is a shallow copy. Application owns the memory.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_CLIENT__
__ENABLE_MOCANA_SSL_ASYNC_CLIENT_API__
__ENABLE_MOCANA_SSL_SERVER__
__ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
__ENABLE_MOCANA_TLS13__
__ENABLE_MOCANA_TLS13_PSK__
__ENABLE_MOCANA_TLS13_0RTT__
connectionInstance | Connection instance returned from SSL_connect(). |
pEarlyData | Early data to set. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_setMaxEarlyDataSize | ( | sbyte4 | connectionInstance, |
sbyte4 | earlyDataSize | ||
) |
This function sets (defines) the max early data size use during connection negotiations.
Please review the function and param descriptions to ensure that the Tech Pubs edits are ok.
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_SERVER__
__ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
Additionally, the following flags must be defined:
__ENABLE_MOCANA_TLS13__
__ENABLE_MOCANA_TLS13_PSK__
__ENABLE_MOCANA_TLS13_0RTT__
connectionInstance | Connection instance returned from SSL_connect(). |
earlyDataSize | max early data size to set. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c
MOC_EXTERN sbyte4 SSL_setRecvEarlyDataSize | ( | sbyte4 | connectionInstance, |
sbyte4 | recvEarlyDataSize | ||
) |
This function sets the recv early data size for the server. Server can recieve early Data of size less than or equal to this value. MaxEarlyDataSize per session should be less than or equal to this value
To enable this function, at least one of the following flags must be defined in moptions.h:
__ENABLE_MOCANA_SSL_SERVER__
__ENABLE_MOCANA_SSL_ASYNC_SERVER_API__
Additionally, the following flags must be defined:
__ENABLE_MOCANA_TLS13__
__ENABLE_MOCANA_TLS13_PSK__
__ENABLE_MOCANA_TLS13_0RTT__
connectionInstance | Connection instance returned from SSL_connect(). |
earlyDataSize | recv early data size to set. |
OK
(0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR
macro.ssl.c