summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2023-07-18 14:38:50 +0200
committerJoel Klinghed <the_jk@spawned.biz>2023-07-18 14:38:50 +0200
commit8e3d4426dc78549c329833fc9a3885e271ced14b (patch)
tree7bf69e74877c77c7e2d575d797c32a2e3b748863
parent4b15429a4c219f16dda9df75978adb7e8b373c2d (diff)
Support both mbedtls 2.x and 3.x
-rw-r--r--src/ssl_mbedtls.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ssl_mbedtls.cc b/src/ssl_mbedtls.cc
index 3242b3c..a99943b 100644
--- a/src/ssl_mbedtls.cc
+++ b/src/ssl_mbedtls.cc
@@ -111,9 +111,12 @@ public:
auto ret = mbedtls_pk_parse_key(
&key_,
reinterpret_cast<const unsigned char*>(data.c_str()), data.size() + 1,
- nullptr, 0,
- mbedtls_ctr_drbg_random,
- static_cast<SSLEntropyImpl*>(entropy)->random());
+ nullptr, 0
+#if MBEDTLS_VERSION_NUMBER >= 0x03000000
+ , mbedtls_ctr_drbg_random,
+ static_cast<SSLEntropyImpl*>(entropy)->random()
+#endif
+ );
if (ret) {
logerr(logger, ret, "Error parsing key");
return false;