]> granicus.if.org Git - curl/commitdiff
mbedtls: make it build even if MBEDTLS_VERSION_C isn't set
authorDaniel Stenberg <daniel@haxx.se>
Mon, 11 Feb 2019 13:30:23 +0000 (14:30 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 12 Feb 2019 09:27:47 +0000 (10:27 +0100)
Reported-by: MAntoniak on github
Fixes #3553
Closes #3556

lib/vtls/mbedtls.c

index bb6a757bf2411aca4a1ab6973dce8aefa77b9de2..c36c93e3fa4bcd77013fba3d2cfd1c1e0599711b 100644 (file)
@@ -813,9 +813,14 @@ static void Curl_mbedtls_session_free(void *ptr)
 
 static size_t Curl_mbedtls_version(char *buffer, size_t size)
 {
+#ifdef MBEDTLS_VERSION_C
+  /* if mbedtls_version_get_number() is available it is better */
   unsigned int version = mbedtls_version_get_number();
   return msnprintf(buffer, size, "mbedTLS/%u.%u.%u", version>>24,
                    (version>>16)&0xff, (version>>8)&0xff);
+#else
+  return msnprintf(buffer, size, "mbedTLS/%s", MBEDTLS_VERSION_STRING);
+#endif
 }
 
 static CURLcode Curl_mbedtls_random(struct Curl_easy *data,