]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix compilation with older mbed TLS versions (mbedtls_tls_prf_types undefined)
authorArne Schwabe <arne@rfc2549.org>
Tue, 25 Aug 2020 04:16:47 +0000 (06:16 +0200)
committerGert Doering <gert@greenie.muc.de>
Fri, 28 Aug 2020 13:12:40 +0000 (15:12 +0200)
The usage of the new keying material methods was not properly guarded.

To avoid a number of ifdefs this commit uses a dummy struct and function.
When we eventually drop support for non-EKM mbed TLS version we can remove
these.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20200825041647.26235-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20812.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/ssl_mbedtls.c
src/openvpn/ssl_mbedtls.h

index 4287b59e2a3541363c7532934ae3e5ae70076a4d..4ec355a9034a2d996266b3fc3d120d90d2d7a5c5 100644 (file)
@@ -253,6 +253,16 @@ key_state_export_keying_material(struct tls_session *session,
         return  NULL;
     }
 }
+#else
+unsigned char*
+key_state_export_keying_material(struct tls_session *session,
+                                 const char* label, size_t label_size,
+                                 size_t ekm_size,
+                                 struct gc_arena *gc)
+{
+    /* Dummy function to avoid ifdefs in the common code */
+    return NULL;
+}
 #endif /* HAVE_EXPORT_KEYING_MATERIAL */
 
 bool
index 17aae5516c1f2db3bac2fa78ace60b706761043c..ff64e17c04951286035b1c1ddd315b7a6d570990 100644 (file)
@@ -82,6 +82,7 @@ struct external_context {
     void *sign_ctx;
 };
 
+#ifdef HAVE_EXPORT_KEYING_MATERIAL
 /** struct to cache TLS secrets for keying material exporter (RFC 5705).
  * The constants (64 and 48) are inherent to TLS version and
  * the whole keying material export will likely change when they change */
@@ -90,6 +91,9 @@ struct tls_key_cache {
     mbedtls_tls_prf_types tls_prf_type;
     unsigned char master_secret[48];
 };
+#else
+struct tls_key_cache { };
+#endif
 
 /**
  * Structure that wraps the TLS context. Contents differ depending on the
@@ -124,7 +128,6 @@ struct key_state_ssl {
     bio_ctx *bio_ctx;
 
     struct tls_key_cache tls_key_cache;
-
 };
 
 /**