Amazon Kinesis Webrtc C SDK
Dtls_mbedtls.c File Reference
#include "../Include_i.h"
Include dependency graph for Dtls_mbedtls.c:

Macros

#define LOG_CLASS   "DTLS_mbedtls"
 

Functions

STATUS createDtlsSession (PDtlsSessionCallbacks pDtlsSessionCallbacks, TIMER_QUEUE_HANDLE timerQueueHandle, INT32 certificateBits, BOOL generateRSACertificate, PRtcCertificate pRtcCertificates, PDtlsSession *ppDtlsSession)
 
STATUS freeDtlsSession (PDtlsSession *ppDtlsSession)
 
INT32 dtlsSessionSendCallback (PVOID customData, const unsigned char *pBuf, ULONG len)
 
INT32 dtlsSessionReceiveCallback (PVOID customData, unsigned char *pBuf, ULONG len)
 
VOID dtlsSessionSetTimerCallback (PVOID customData, UINT32 intermediateDelayInMs, UINT32 finalDelayInMs)
 
INT32 dtlsSessionGetTimerCallback (PVOID customData)
 
STATUS dtlsTransmissionTimerCallback (UINT32 timerID, UINT64 currentTime, UINT64 customData)
 
INT32 dtlsSessionKeyDerivationCallback (PVOID customData, const unsigned char *pMasterSecret, const unsigned char *pKeyBlock, ULONG maclen, ULONG keylen, ULONG ivlen, const unsigned char clientRandom[32], const unsigned char serverRandom[32], mbedtls_tls_prf_types tlsProfile)
 
STATUS dtlsSessionHandshakeInThread (PDtlsSession pDtlsSession, BOOL isServer)
 
STATUS dtlsSessionStart (PDtlsSession pDtlsSession, BOOL isServer)
 
STATUS dtlsSessionIsInitFinished (PDtlsSession pDtlsSession, PBOOL pIsFinished)
 
STATUS dtlsSessionProcessPacket (PDtlsSession pDtlsSession, PBYTE pData, PINT32 pDataLen)
 
STATUS dtlsSessionPutApplicationData (PDtlsSession pDtlsSession, PBYTE pData, INT32 dataLen)
 
STATUS dtlsSessionGetLocalCertificateFingerprint (PDtlsSession pDtlsSession, PCHAR pBuff, UINT32 buffLen)
 
STATUS dtlsSessionVerifyRemoteCertificateFingerprint (PDtlsSession pDtlsSession, PCHAR pExpectedFingerprint)
 
STATUS dtlsSessionPopulateKeyingMaterial (PDtlsSession pDtlsSession, PDtlsKeyingMaterial pDtlsKeyingMaterial)
 
STATUS dtlsSessionShutdown (PDtlsSession pDtlsSession)
 
STATUS copyCertificateAndKey (mbedtls_x509_crt *pCert, mbedtls_pk_context *pKey, PDtlsSessionCertificateInfo pDst)
 
STATUS createCertificateAndKey (INT32 certificateBits, BOOL generateRSACertificate, mbedtls_x509_crt *pCert, mbedtls_pk_context *pKey)
 
STATUS freeCertificateAndKey (mbedtls_x509_crt *pCert, mbedtls_pk_context *pKey)
 
STATUS dtlsCertificateFingerprint (mbedtls_x509_crt *pCert, PCHAR pBuff)
 

Variables

mbedtls_ssl_srtp_profile DTLS_SRTP_SUPPORTED_PROFILES []
 

Macro Definition Documentation

◆ LOG_CLASS

#define LOG_CLASS   "DTLS_mbedtls"

Function Documentation

◆ copyCertificateAndKey()

STATUS copyCertificateAndKey ( mbedtls_x509_crt *  pCert,
mbedtls_pk_context *  pKey,
PDtlsSessionCertificateInfo  pDst 
)
Here is the caller graph for this function:

◆ createCertificateAndKey()

STATUS createCertificateAndKey ( INT32  certificateBits,
BOOL  generateRSACertificate,
mbedtls_x509_crt *  pCert,
mbedtls_pk_context *  pKey 
)

createCertificateAndKey generates a new certificate and a key If generateRSACertificate is true, RSA is going to be used for the key generation. Otherwise, ECDSA is going to be used. certificateBits is only being used when generateRSACertificate is true.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createDtlsSession()

STATUS createDtlsSession ( PDtlsSessionCallbacks  pDtlsSessionCallbacks,
TIMER_QUEUE_HANDLE  timerQueueHandle,
INT32  certificateBits,
BOOL  generateRSACertificate,
PRtcCertificate  pRtcCertificates,
PDtlsSession ppDtlsSession 
)

Create DTLS session. Not thread safe.

Parameters
PDtlsSessionCallbacks- callbacks
TIMER_QUEUE_HANDLE- timer handle to schedule timer task with
INT32- size of generated certificate
BOOL- whether to generate certificate or not
PRtcCertificate- user provided certificate
PDtlsSession*- pointer to created DtlsSession object
Returns
STATUS - status of operation

◆ dtlsCertificateFingerprint()

STATUS dtlsCertificateFingerprint ( mbedtls_x509_crt *  pCert,
PCHAR  pBuff 
)
Here is the caller graph for this function:

◆ dtlsSessionGetLocalCertificateFingerprint()

STATUS dtlsSessionGetLocalCertificateFingerprint ( PDtlsSession  pDtlsSession,
PCHAR  pBuff,
UINT32  buffLen 
)

◆ dtlsSessionGetTimerCallback()

INT32 dtlsSessionGetTimerCallback ( PVOID  customData)
Here is the caller graph for this function:

◆ dtlsSessionHandshakeInThread()

STATUS dtlsSessionHandshakeInThread ( PDtlsSession  pDtlsSession,
BOOL  isServer 
)

◆ dtlsSessionIsInitFinished()

STATUS dtlsSessionIsInitFinished ( PDtlsSession  pDtlsSession,
PBOOL  pIsFinished 
)

◆ dtlsSessionKeyDerivationCallback()

INT32 dtlsSessionKeyDerivationCallback ( PVOID  customData,
const unsigned char *  pMasterSecret,
const unsigned char *  pKeyBlock,
ULONG  maclen,
ULONG  keylen,
ULONG  ivlen,
const unsigned char  clientRandom[32],
const unsigned char  serverRandom[32],
mbedtls_tls_prf_types  tlsProfile 
)
Here is the caller graph for this function:

◆ dtlsSessionPopulateKeyingMaterial()

STATUS dtlsSessionPopulateKeyingMaterial ( PDtlsSession  pDtlsSession,
PDtlsKeyingMaterial  pDtlsKeyingMaterial 
)

◆ dtlsSessionProcessPacket()

STATUS dtlsSessionProcessPacket ( PDtlsSession  pDtlsSession,
PBYTE  pData,
PINT32  pDataLen 
)

◆ dtlsSessionPutApplicationData()

STATUS dtlsSessionPutApplicationData ( PDtlsSession  pDtlsSession,
PBYTE  pData,
INT32  dataLen 
)

◆ dtlsSessionReceiveCallback()

INT32 dtlsSessionReceiveCallback ( PVOID  customData,
unsigned char *  pBuf,
ULONG  len 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsSessionSendCallback()

INT32 dtlsSessionSendCallback ( PVOID  customData,
const unsigned char *  pBuf,
ULONG  len 
)
Here is the caller graph for this function:

◆ dtlsSessionSetTimerCallback()

VOID dtlsSessionSetTimerCallback ( PVOID  customData,
UINT32  intermediateDelayInMs,
UINT32  finalDelayInMs 
)
Here is the caller graph for this function:

◆ dtlsSessionShutdown()

STATUS dtlsSessionShutdown ( PDtlsSession  pDtlsSession)
Here is the caller graph for this function:

◆ dtlsSessionStart()

STATUS dtlsSessionStart ( PDtlsSession  pDtlsSession,
BOOL  isServer 
)

Start DTLS handshake. Not thread safe.

Parameters
PDtlsSession- DtlsSession object
BOOL- is server
Returns
STATUS - status of operation

◆ dtlsSessionVerifyRemoteCertificateFingerprint()

STATUS dtlsSessionVerifyRemoteCertificateFingerprint ( PDtlsSession  pDtlsSession,
PCHAR  pExpectedFingerprint 
)

◆ dtlsTransmissionTimerCallback()

STATUS dtlsTransmissionTimerCallback ( UINT32  timerID,
UINT64  currentTime,
UINT64  customData 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeCertificateAndKey()

STATUS freeCertificateAndKey ( mbedtls_x509_crt *  pCert,
mbedtls_pk_context *  pKey 
)
Here is the caller graph for this function:

◆ freeDtlsSession()

STATUS freeDtlsSession ( PDtlsSession ppDtlsSession)

Free DTLS session. Not thread safe.

Parameters
PDtlsSession- DtlsSession object to free
Returns
STATUS - status of operation
Here is the caller graph for this function:

Variable Documentation

◆ DTLS_SRTP_SUPPORTED_PROFILES

mbedtls_ssl_srtp_profile DTLS_SRTP_SUPPORTED_PROFILES[]
Initial value:
= {
MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80,
MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32,
MBEDTLS_TLS_SRTP_UNSET,
}

https://tools.ietf.org/html/rfc5764#section-4.1.2