else
{
unsigned char * lastCert = (unsigned char *)OICMalloc((len + 1) * sizeof(unsigned char));
+ if (lastCert == NULL)
+ {
+ goto exit;
+ }
memcpy(lastCert, buf + pos, len);
lastCert[len] = 0x00;
ret = mbedtls_x509_crt_parse(crt, lastCert, len + 1);
}
#endif
+CAResult_t SetCASecureEndpointUuid(const CAEndpoint_t *peer, const char *uuid)
+{
+ OIC_LOG_V(DEBUG, NET_SSL_TAG, "In %s", __func__);
+ VERIFY_NON_NULL(peer, NET_SSL_TAG, "peer");
+ VERIFY_NON_NULL(peer, NET_SSL_TAG, "uuid");
+
+ oc_mutex_lock(g_sslContextMutex);
+ SslEndPoint_t *sslPeer = GetSslPeer(peer);
+ if (NULL == sslPeer)
+ {
+ OIC_LOG(ERROR, NET_SSL_TAG, "Peer not found");
+ oc_mutex_unlock(g_sslContextMutex);
+ return CA_STATUS_FAILED;
+ }
+
+ OCRandomUuidResult ret = OCConvertStringToUuid(uuid, sslPeer->sep.identity.id);
+ oc_mutex_unlock(g_sslContextMutex);
+
+ if (RAND_UUID_OK != ret)
+ {
+ OIC_LOG(ERROR, NET_SSL_TAG, "Failed to convert uuid");
+ return CA_STATUS_FAILED;
+ }
+
+ OIC_LOG_V(DEBUG, NET_SSL_TAG, "Out %s", __func__);
+
+ return CA_STATUS_OK;
+}
+
/**
* Deletes cached message.
*
VERIFY_NON_NULL_RET(sep, NET_SSL_TAG, "endpoint is NULL" , CA_STATUS_INVALID_PARAM);
VERIFY_NON_NULL_RET(data, NET_SSL_TAG, "Param data is NULL" , CA_STATUS_INVALID_PARAM);
+ if (0 == dataLen)
+ {
+ OIC_LOG(ERROR, NET_SSL_TAG, "dataLen is zero");
+ return CA_STATUS_FAILED;
+ }
+
oc_mutex_lock(g_sslContextMutex);
if (NULL == g_caSslContext)
{