[IOT-3229] Reset mbedtls verify callback 99/27499/1
authorAleksey Volkov <a.volkov@samsung.com>
Tue, 20 Nov 2018 08:22:36 +0000 (10:22 +0200)
committerAleksey Volkov <a.volkov@samsung.com>
Tue, 20 Nov 2018 08:22:36 +0000 (10:22 +0200)
Reset X509 verify callback in the global
mbedtls context in case if the identity
callback isn't set.

Change-Id: Ib1abfa00753b971d4eda85cfc18ebcc3a7b0707d
Signed-off-by: Aleksey Volkov <a.volkov@samsung.com>
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c

index af3bf6e..a57e4d9 100644 (file)
@@ -1421,10 +1421,8 @@ static SslEndPoint_t * NewSslEndPoint(const CAEndpoint_t * endpoint, mbedtls_ssl
     tep->sep.endpoint = *endpoint;
     tep->sep.endpoint.flags = (CATransportFlags_t)(tep->sep.endpoint.flags | CA_SECURE);
 
-    if (g_getIdentityCallback != NULL)
-    {
-        mbedtls_ssl_conf_verify(config, verifyIdentity, NULL);
-    }
+    mbedtls_ssl_conf_verify(config, g_getIdentityCallback ? verifyIdentity : NULL, NULL);
+
     if(0 != mbedtls_ssl_setup(&tep->ssl, config))
     {
         OIC_LOG(ERROR, NET_SSL_TAG, "Setup failed");