int retLen = dtls_write(g_caDtlsContext->dtlsContext, (session_t *)dstSession, data,
dataLen);
OIC_LOG_V(DEBUG, NET_DTLS_TAG, "dtls_write retun len [%d]", retLen);
+ if (retLen < 0)
+ {
+ OIC_LOG(DEBUG, NET_DTLS_TAG, "OUT FAILURE");
+ return DTLS_FAIL;
+ }
if (0 == retLen)
{
// A new DTLS session was initiated by tinyDTLS library and wait for callback.
return DTLS_SESSION_INITIATED;
}
- else if (dataLen == retLen)
+ else if (dataLen != (uint32_t)retLen)
{
- OIC_LOG(DEBUG, NET_DTLS_TAG, "OUT");
- return DTLS_OK;
+ OIC_LOG(DEBUG, NET_DTLS_TAG, "OUT FAILURE");
+ return DTLS_FAIL;
}
- OIC_LOG(DEBUG, NET_DTLS_TAG, "OUT FAILURE");
- return DTLS_FAIL;
+ OIC_LOG(DEBUG, NET_DTLS_TAG, "OUT");
+ return DTLS_OK;
}
static eDtlsRet_t CAAdapterNetDtlsDecryptInternal(const stCADtlsAddrInfo_t *srcSession,
OIC_LOG(DEBUG, NET_DTLS_TAG, "OUT");
}
-static int32_t CAReadDecryptedPayload(dtls_context_t *dtlsContext,
+static int32_t CAReadDecryptedPayload(dtls_context_t *context,
session_t *session,
uint8_t *buf,
size_t bufLen )
{
+ (void)context;
OIC_LOG(DEBUG, NET_DTLS_TAG, "IN");
VERIFY_NON_NULL_RET(session, NET_DTLS_TAG, "Param Session is NULL", 0);
return 0;
}
-static int32_t CASendSecureData(dtls_context_t *dtlsContext,
+static int32_t CASendSecureData(dtls_context_t *context,
session_t *session,
uint8_t *buf,
size_t bufLen)
{
+ (void)context;
OIC_LOG(DEBUG, NET_DTLS_TAG, "IN");
VERIFY_NON_NULL_RET(session, NET_DTLS_TAG, "Param Session is NULL", -1);
return bufLen;
}
-static int32_t CAHandleSecureEvent(dtls_context_t *dtlsContext,
+static int32_t CAHandleSecureEvent(dtls_context_t *context,
session_t *session,
dtls_alert_level_t level,
unsigned short code)
{
+ (void)context;
OIC_LOG(DEBUG, NET_DTLS_TAG, "IN");
VERIFY_NON_NULL_RET(session, NET_DTLS_TAG, "Param Session is NULL", 0);
{
// Check if we have the credentials for the device with which we
// are trying to perform a handshake
- int index = 0;
- for (index = 0; index < credInfo->num; index++)
+ for (uint32_t index = 0; index < credInfo->num; index++)
{
if (memcmp(desc, credInfo->creds[index].id, DTLS_PSK_ID_LEN) == 0)
{
CAResult_t CADtlsInitiateHandshake(const CAEndpoint_t *endpoint)
{
- stCADtlsAddrInfo_t dst = {};
+ stCADtlsAddrInfo_t dst = { 0 };
OIC_LOG(DEBUG, NET_DTLS_TAG, "IN CADtlsInitiateHandshake");
CAResult_t CADtlsClose(const CAEndpoint_t *endpoint)
{
- stCADtlsAddrInfo_t dst = {};
+ stCADtlsAddrInfo_t dst = { 0 };
OIC_LOG(DEBUG, NET_DTLS_TAG, "IN CADtlsDisconnect");
return CA_STATUS_INVALID_PARAM;
}
- stCADtlsAddrInfo_t dst = {};
+ stCADtlsAddrInfo_t dst = { 0 };
CAConvertNameToAddr(endpoint->addr, endpoint->port, &(dst.addr.st));
dst.ifIndex = 0;
OIC_LOG_V(DEBUG, NET_DTLS_TAG, "Data to be encrypted dataLen [%d]", dataLen);
- stCADtlsAddrInfo_t addrInfo = {};
+ stCADtlsAddrInfo_t addrInfo = { 0 };
CAConvertNameToAddr(endpoint->addr, endpoint->port, &(addrInfo.addr.st));
addrInfo.ifIndex = 0;
OIC_LOG(DEBUG, NET_DTLS_TAG, "IN");
VERIFY_NON_NULL_RET(endpoint, NET_DTLS_TAG, "endpoint is NULL" , CA_STATUS_INVALID_PARAM);
- stCADtlsAddrInfo_t addrInfo = {};
+ stCADtlsAddrInfo_t addrInfo = { 0 };
CAConvertNameToAddr(endpoint->addr, endpoint->port, &(addrInfo.addr.st));
addrInfo.ifIndex = 0;