From 392fdb04388de6977da7df6168f2ec7c419dccb9 Mon Sep 17 00:00:00 2001 From: Harry Sarson Date: Fri, 21 Jan 2022 13:32:16 +0000 Subject: [PATCH] misc: allow curl to build with wolfssl --enable-opensslextra put all #include of openssl files behind wolfssl ifdefs so that we can use the wolfssl/ prefixed include paths. Without these curl only builds when wolfssl is built with enable-all. Fixes #8292 Closes #8315 --- lib/curl_sha256.h | 4 ++-- lib/md5.c | 7 ++++++- lib/sha256.c | 10 ++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/curl_sha256.h b/lib/curl_sha256.h index 55dc30ad74..2b7890a039 100644 --- a/lib/curl_sha256.h +++ b/lib/curl_sha256.h @@ -8,7 +8,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2017, Florin Petriuc, - * Copyright (C) 2018 - 2021, Daniel Stenberg, , et al. + * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -32,7 +32,7 @@ extern const struct HMAC_params Curl_HMAC_SHA256[1]; /* SHA256_DIGEST_LENGTH is an enum value in wolfSSL. Need to import it from * sha.h*/ #include -#include +#include #else #define SHA256_DIGEST_LENGTH 32 #endif diff --git a/lib/md5.c b/lib/md5.c index c6923e036b..6e278360ef 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -83,7 +83,12 @@ static void MD5_Final(unsigned char *digest, MD5_CTX *ctx) #elif defined(USE_OPENSSL_MD5) || defined(USE_WOLFSSL_MD5) /* When OpenSSL or wolfSSL is available, we use their MD5 functions. */ +#if defined(USE_OPENSSL_MD5) #include +#elif defined(USE_WOLFSSL_MD5) +#include +#endif + #include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" diff --git a/lib/sha256.c b/lib/sha256.c index cf7ea4f543..30c7e1d075 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -6,7 +6,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2017, Florin Petriuc, - * Copyright (C) 2018 - 2021, Daniel Stenberg, , et al. + * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -69,8 +69,14 @@ #if defined(USE_OPENSSL_SHA256) -/* When OpenSSL is available we use the SHA256-function from OpenSSL */ +/* When OpenSSL or wolfSSL is available is available we use their + * SHA256-functions. + */ +#if defined(USE_OPENSSL) #include +#elif defined(USE_WOLFSSL) +#include +#endif #include "curl_memory.h" -- 2.47.3