Reciprocal close_notify 78/29578/2
authorOleksii Beketov <ol.beketov@samsung.com>
Tue, 9 Jul 2019 13:17:28 +0000 (16:17 +0300)
committerOleksii Beketov <ol.beketov@samsung.com>
Tue, 9 Jul 2019 15:20:12 +0000 (15:20 +0000)
Added mutual close_notify alert respond on receiving
close_notify alert according to RFC5246 p. 7.2.1.

Change-Id: I984db86939fc575e02e964a849cf5f7b9e7265c9
Signed-off-by: Oleksii Beketov <ol.beketov@samsung.com>
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c

index a900fda..4254b45 100644 (file)
@@ -2524,6 +2524,12 @@ CAResult_t CAdecryptSsl(const CASecureEndpoint_t *sep, uint8_t *data, size_t dat
                 g_closeSslConnectionCallback(peer->sep.identity.id, peer->sep.identity.id_length);
             }
 
+            do
+            {
+                ret = mbedtls_ssl_close_notify(&peer->ssl);
+            }
+            while (MBEDTLS_ERR_SSL_WANT_WRITE == ret);
+
             RemovePeerFromList(&peer->sep.endpoint);
             oc_mutex_unlock(g_sslContextMutex);
             return CA_STATUS_OK;