[IOT-2045] Fix PIN based OTM
authorDmitriy Zhuravlev <d.zhuravlev@samsung.com>
Thu, 13 Apr 2017 15:10:56 +0000 (18:10 +0300)
committerGreg Zaverucha <gregz@microsoft.com>
Mon, 17 Apr 2017 19:56:32 +0000 (19:56 +0000)
OTM should be able to use PSK ciphersuite
even if there is no credentials in SVR DB

Change-Id: Icfde495b61f5f726cab2604fd5fc0f5e9e88fff9
Signed-off-by: Dmitriy Zhuravlev <d.zhuravlev@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18929
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Greg Zaverucha <gregz@microsoft.com>
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c

index f753140..88cb418 100644 (file)
@@ -1330,8 +1330,9 @@ static void SetupCipher(mbedtls_ssl_config * config, CATransportAdapter_t adapte
 
     g_getCredentialTypesCallback(g_caSslContext->cipherFlag, deviceId);
 
-    // Retrieve the PSK credential from SRM
-    if (true == g_caSslContext->cipherFlag[0] && 0 != InitPskIdentity(config))
+    // Retrieve the PSK credential from SRM or use PIN based generation
+    if ((SSL_ECDHE_PSK_WITH_AES_128_CBC_SHA256 == g_caSslContext->cipher ||
+         true == g_caSslContext->cipherFlag[0]) && 0 != InitPskIdentity(config))
     {
         OIC_LOG(ERROR, NET_SSL_TAG, "PSK identity initialization failed!");
     }