071-ssl-call-mbedtls_version_get_string-only-if-availabl.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From cee085e0e62214603b9ae035d63fabca23c491bd Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <hauke@hauke-m.de>
  3. Date: Sun, 8 Jan 2017 01:39:35 +0100
  4. Subject: [PATCH 6/7] ssl: call mbedtls_version_get_string() only if available
  5. The function mbedtls_version_get_string() is only available if
  6. MBEDTLS_VERSION_C is set in the mbedtls configuration. Check this
  7. before calling this function and print the mbedtls version this was
  8. compiled against instead if mbedtls_version_get_string() is not
  9. available.
  10. This fixes a compile problem when MBEDTLS_VERSION_C is not set.
  11. Change-Id: I54c2c2a3fc1f9d35afa475500e3db68420a1b54a
  12. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  13. ---
  14. resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 4 ++++
  15. 1 file changed, 4 insertions(+)
  16. --- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
  17. +++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c
  18. @@ -1376,9 +1376,13 @@ CAResult_t CAinitSslAdapter()
  19. /* Initialize TLS library
  20. */
  21. #if !defined(NDEBUG) || defined(TB_LOG)
  22. +#ifdef MBEDTLS_VERSION_C
  23. char version[MBED_TLS_VERSION_LEN];
  24. mbedtls_version_get_string(version);
  25. OIC_LOG_V(INFO, NET_SSL_TAG, "mbed TLS version: %s", version);
  26. +#else
  27. + OIC_LOG_V(INFO, NET_SSL_TAG, "mbed TLS version: %s", MBEDTLS_VERSION_STRING);
  28. +#endif
  29. #endif
  30. /* Entropy settings