ssl: call mbedtls_version_get_string() only if available
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 8 Jan 2017 00:39:35 +0000 (01:39 +0100)
committerGreg Zaverucha <gregz@microsoft.com>
Wed, 11 Jan 2017 18:48:53 +0000 (18:48 +0000)
The function mbedtls_version_get_string()  is only available if
MBEDTLS_VERSION_C is set in the mbedtls configuration. Check this
before calling this function and print the mbedtls version this was
compiled against instead if mbedtls_version_get_string()  is not
available.

This fixes a compile problem when MBEDTLS_VERSION_C is not set.

Change-Id: I54c2c2a3fc1f9d35afa475500e3db68420a1b54a
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16231
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Kevin Kane <kkane@microsoft.com>
Reviewed-by: Greg Zaverucha <gregz@microsoft.com>
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c

index 2374f3b..ec506de 100644 (file)
@@ -1368,9 +1368,13 @@ CAResult_t CAinitSslAdapter()
     /* Initialize TLS library
      */
 #if !defined(NDEBUG) || defined(TB_LOG)
+#ifdef MBEDTLS_VERSION_C
     char version[MBED_TLS_VERSION_LEN];
     mbedtls_version_get_string(version);
     OIC_LOG_V(INFO, NET_SSL_TAG, "mbed TLS version: %s", version);
+#else
+    OIC_LOG_V(INFO, NET_SSL_TAG, "mbed TLS version: %s", MBEDTLS_VERSION_STRING);
+#endif
 #endif
 
     /* Entropy settings