Commit 085d7a8a authored by Dmitriy Zhuravlev's avatar Dmitriy Zhuravlev Committed by Randeep

Fix for patchset 15853

Fixed OTM error caused by patchset 15853.
Added close notify alert sending to DeletePeerList()

Change-Id: Ib5363f8d16358a388df0f003e9111f1d56ccca62
Signed-off-by: default avatarOleksii Beketov <ol.beketov@samsung.com>
Signed-off-by: default avatarDmitriy Zhuravlev <d.zhuravlev@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16001Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarChul Lee <chuls.lee@samsung.com>
Reviewed-by: default avatarJongsung Lee <js126.lee@samsung.com>
Reviewed-by: Randeep's avatarRandeep Singh <randeep.s@samsung.com>
parent aa624678
......@@ -173,7 +173,7 @@ if (g_sslCallback)
* @param[in] msg allert message
*/
#define SSL_CHECK_FAIL(peer, ret, str, mutex, error, msg) \
if (MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY != (int) (ret) && \
if (0 != (ret) && MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY != (int) (ret) && \
MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED != (int) (ret) && \
MBEDTLS_ERR_SSL_WANT_READ != (int) (ret) && \
MBEDTLS_ERR_SSL_WANT_WRITE != (int) (ret) && \
......@@ -970,6 +970,15 @@ static void DeletePeerList()
{
continue;
}
if (MBEDTLS_SSL_HANDSHAKE_OVER == tep->ssl.state)
{
int ret = 0;
do
{
ret = mbedtls_ssl_close_notify(&tep->ssl);
}
while (MBEDTLS_ERR_SSL_WANT_WRITE == ret);
}
DeleteSslEndPoint(tep);
}
u_arraylist_free(&g_caSslContext->peerList);
......@@ -1843,7 +1852,6 @@ CAResult_t CAdecryptSsl(const CASecureEndpoint_t *sep, uint8_t *data, uint32_t d
MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY == peer->ssl.in_msg[1]))
{
OIC_LOG(INFO, NET_SSL_TAG, "Connection was closed gracefully");
SSL_CLOSE_NOTIFY(peer, ret);
RemovePeerFromList(&peer->sep.endpoint);
ca_mutex_unlock(g_sslContextMutex);
return CA_STATUS_OK;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment