From d13059d1ec2bbb8fe7068db0d66d521daa4b71ce Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Sat, 13 Aug 2022 14:27:22 +0200 Subject: [PATCH] Fix build with libressl >= 3.5.0 libressl added back FIPS_mode since version 3.5.0 and https://github.com/libressl-portable/openbsd/commit/a97eabc90d7647e374c1c6da686aeec63c49ff14 libressl provides X509_get_extension_flags since version 3.5.0 and https://github.com/libressl-portable/openbsd/commit/3180723224c1b2c7856a110b8213e4966995d7e0 Signed-off-by: Fabrice Fontaine [Upstream status: https://github.com/OpenSC/OpenSC/pull/2593 & https://github.com/OpenSC/OpenSC/pull/2595 (merged)] --- src/libopensc/sc-ossl-compat.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libopensc/sc-ossl-compat.h b/src/libopensc/sc-ossl-compat.h index f0d55279..2c42794c 100644 --- a/src/libopensc/sc-ossl-compat.h +++ b/src/libopensc/sc-ossl-compat.h @@ -86,9 +86,11 @@ extern "C" { #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) #define RSA_PKCS1_OpenSSL RSA_PKCS1_SSLeay +#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x30500000L #define X509_get_extension_flags(x) (x->ex_flags) #define X509_get_key_usage(x) (x->ex_kusage) #define X509_get_extended_key_usage(x) (x->ex_xkusage) +#endif #if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2050300fL #define X509_up_ref(cert) CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509) #endif @@ -104,7 +106,9 @@ extern "C" { /* workaround unused value warning for a macro that does nothing */ #if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L #define OPENSSL_malloc_init() +#if LIBRESSL_VERSION_NUMBER < 0x30500000L #define FIPS_mode() (0) +#endif #define EVP_sha3_224() (NULL) #define EVP_sha3_256() (NULL) #define EVP_sha3_384() (NULL) -- 2.35.1