From 0f58c88fc395cfad67a0ff9c29dc99b6f9931622 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 12 May 2020 21:02:39 +0300 Subject: [PATCH] DPP2: Fix CONFIG_DPP2=y build with OpenSSL 1.0.2 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 --- src/common/dpp_backup.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/common/dpp_backup.c b/src/common/dpp_backup.c index 4bd5ba616..c675c427b 100644 --- a/src/common/dpp_backup.c +++ b/src/common/dpp_backup.c @@ -7,6 +7,7 @@ */ #include "utils/includes.h" +#include #include #include "utils/common.h" @@ -18,6 +19,21 @@ #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) {