Commit 0a8952cd 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>
(cherry picked from commit 085d7a8a)
Reviewed-on: https://gerrit.iotivity.org/gerrit/16413Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
parent b0811f81
...@@ -214,7 +214,7 @@ if (g_sslCallback) ...@@ -214,7 +214,7 @@ if (g_sslCallback)
* @param[in] msg allert message * @param[in] msg allert message
*/ */
#define SSL_CHECK_FAIL(peer, ret, str, mutex, error, msg) \ #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_HELLO_VERIFY_REQUIRED != (int) (ret) && \
MBEDTLS_ERR_SSL_WANT_READ != (int) (ret) && \ MBEDTLS_ERR_SSL_WANT_READ != (int) (ret) && \
MBEDTLS_ERR_SSL_WANT_WRITE != (int) (ret) && \ MBEDTLS_ERR_SSL_WANT_WRITE != (int) (ret) && \
...@@ -974,6 +974,15 @@ static void DeletePeerList() ...@@ -974,6 +974,15 @@ static void DeletePeerList()
{ {
continue; 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); DeleteSslEndPoint(tep);
} }
u_arraylist_free(&g_caSslContext->peerList); u_arraylist_free(&g_caSslContext->peerList);
...@@ -1861,7 +1870,6 @@ CAResult_t CAdecryptSsl(const CASecureEndpoint_t *sep, uint8_t *data, uint32_t d ...@@ -1861,7 +1870,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])) MBEDTLS_SSL_ALERT_MSG_CLOSE_NOTIFY == peer->ssl.in_msg[1]))
{ {
OIC_LOG(INFO, NET_SSL_TAG, "Connection was closed gracefully"); OIC_LOG(INFO, NET_SSL_TAG, "Connection was closed gracefully");
SSL_CLOSE_NOTIFY(peer, ret);
RemovePeerFromList(&peer->sep.endpoint); RemovePeerFromList(&peer->sep.endpoint);
oc_mutex_unlock(g_sslContextMutex); oc_mutex_unlock(g_sslContextMutex);
return CA_STATUS_OK; 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