OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
VERIFY_NON_NULL_RET(tep, NET_SSL_TAG, "secure endpoint is NULL", -1);
VERIFY_NON_NULL_RET(data, NET_SSL_TAG, "data is NULL", -1);
+ VERIFY_NON_NULL_RET(g_caSslContext, NET_SSL_TAG, "SSL Context is NULL", -1);
OIC_LOG_V(DEBUG, NET_SSL_TAG, "Data len: %zu", dataLen);
OIC_LOG_V(DEBUG, NET_SSL_TAG, "Adapter: %u", ((SslEndPoint_t * )tep)->sep.endpoint.adapter);
ssize_t sentLen = 0;
{
OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
VERIFY_NON_NULL_RET(g_getPkixInfoCallback, NET_SSL_TAG, "PKIX info callback is NULL", -1);
- g_getPkixInfoCallback(&g_pkiInfo);
+ // load pk key, cert, trust chain and crl
+ if (g_getPkixInfoCallback)
+ {
+ g_getPkixInfoCallback(&g_pkiInfo);
+ }
+
+ VERIFY_NON_NULL_RET(g_caSslContext, NET_SSL_TAG, "SSL Context is NULL", -1);
mbedtls_x509_crt_free(&g_caSslContext->ca);
mbedtls_x509_crt_free(&g_caSslContext->crt);
uint32_t listLength = 0;
OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
VERIFY_NON_NULL_RET(peer, NET_SSL_TAG, "TLS peer is NULL", NULL);
+ VERIFY_NON_NULL_RET(g_caSslContext, NET_SSL_TAG, "SSL Context is NULL", NULL);
SslEndPoint_t *tep = NULL;
listLength = u_arraylist_length(g_caSslContext->peerList);
*/
static void RemovePeerFromList(CAEndpoint_t * endpoint)
{
- uint32_t listLength = u_arraylist_length(g_caSslContext->peerList);
+ VERIFY_NON_NULL_VOID(g_caSslContext, NET_SSL_TAG, "SSL Context is NULL");
VERIFY_NON_NULL_VOID(endpoint, NET_SSL_TAG, "endpoint");
+ uint32_t listLength = u_arraylist_length(g_caSslContext->peerList);
for (uint32_t listIndex = 0; listIndex < listLength; listIndex++)
{
SslEndPoint_t * tep = (SslEndPoint_t *)u_arraylist_get(g_caSslContext->peerList,listIndex);
*/
static void DeletePeerList()
{
+ VERIFY_NON_NULL_VOID(g_caSslContext, NET_SSL_TAG, "SSL Context is NULL");
+
uint32_t listLength = u_arraylist_length(g_caSslContext->peerList);
for (uint32_t listIndex = 0; listIndex < listLength; listIndex++)
{
OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
VERIFY_NON_NULL_RET(endpoint, NET_SSL_TAG, "endpoint", NULL);
VERIFY_NON_NULL_RET(config, NET_SSL_TAG, "config", NULL);
+ VERIFY_NON_NULL_RET(g_caSslContext, NET_SSL_TAG, "SSL Context is NULL", NULL);
tep = (SslEndPoint_t *) OICCalloc(1, sizeof (SslEndPoint_t));
if (NULL == tep)
{
int index = 0;
OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
- if (NULL == g_getCredentialTypesCallback)
- {
- OIC_LOG(ERROR, NET_SSL_TAG, "Param callback is null");
- return;
- }
+ VERIFY_NON_NULL_VOID(config, NET_SSL_TAG, "Invaild param");
+ VERIFY_NON_NULL_VOID(g_caSslContext, NET_SSL_TAG, "SSL Context is NULL");
+ VERIFY_NON_NULL_VOID(g_getCredentialTypesCallback, NET_SSL_TAG, "Param callback is null");
g_getCredentialTypesCallback(g_caSslContext->cipherFlag);
// Retrieve the PSK credential from SRM
OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
VERIFY_NON_NULL_RET(endpoint, NET_SSL_TAG, "Param endpoint is NULL" , NULL);
-
+ VERIFY_NON_NULL_RET(g_caSslContext, NET_SSL_TAG, "SSL Context is NULL", NULL);
mbedtls_ssl_config * config = (endpoint->adapter == CA_ADAPTER_IP ||
endpoint->adapter == CA_ADAPTER_GATT_BTLE ?
{
OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
VERIFY_NON_NULL_RET(conf, NET_SSL_TAG, "Param conf is NULL" , -1);
+ VERIFY_NON_NULL_RET(g_caSslContext, NET_SSL_TAG, "SSL Context is NULL", -1);
mbedtls_ssl_config_init(conf);
if (mbedtls_ssl_config_defaults(conf, mode, transport, MBEDTLS_SSL_PRESET_DEFAULT) != 0)
{
CAResult_t CAsetTlsCipherSuite(const uint32_t cipher)
{
OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
+ VERIFY_NON_NULL_RET(g_caSslContext, NET_SSL_TAG, "SSL context is not initialized." , CA_STATUS_NOT_INITIALIZED);
+
CAResult_t res = CA_STATUS_FAILED;
SslCipher_t index = GetCipherIndex(cipher);
if (SSL_CIPHER_MAX == index)