]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Fix CONFIG_DPP2=y build with OpenSSL 1.0.2
authorJouni Malinen <jouni@codeaurora.org>
Tue, 12 May 2020 18:02:39 +0000 (21:02 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 12 May 2020 18:02:39 +0000 (21:02 +0300)
This file needs the EVP_PKEY_get0_EC_KEY() compatibility wrapper just
like other DPP source code files using this function.

Fixes: 21c612017b0c ("DPP: Move configurator backup into a separate source code file")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/dpp_backup.c

index 4bd5ba6160f0261f2acdab3f7f9ab3e973d111f8..c675c427b384d35d1cf2b64e40415c77f72ecfa2 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include "utils/includes.h"
+#include <openssl/opensslv.h>
 #include <openssl/err.h>
 
 #include "utils/common.h"
 
 #ifdef CONFIG_DPP2
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
+       (defined(LIBRESSL_VERSION_NUMBER) && \
+        LIBRESSL_VERSION_NUMBER < 0x20700000L)
+/* Compatibility wrappers for older versions. */
+
+static EC_KEY * EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey)
+{
+       if (pkey->type != EVP_PKEY_EC)
+               return NULL;
+       return pkey->pkey.ec;
+}
+
+#endif
+
+
 void dpp_free_asymmetric_key(struct dpp_asymmetric_key *key)
 {
        while (key) {