Add basic compatibility with OpenSSL 3. https://github.com/frankmorgner/openpace/issues/53 https://github.com/frankmorgner/openpace/commit/2d94a152dd36543d2a713f1abe20717fdaafae0a https://github.com/frankmorgner/openpace/commit/8b2c8a76873da4862dbf4240c901f3e6d4bc040a https://github.com/frankmorgner/openpace/commit/4c22789d264bd249cfff1c3e69466991e58a76cf --- src/eac/cv_cert.h.orig 2021-04-09 07:44:49.000000000 -0500 +++ src/eac/cv_cert.h 2021-12-20 05:31:17.000000000 -0600 @@ -341,7 +341,11 @@ * @return Number of bytes successfully encoded or a negative value if an * error occured. */ -int i2d_CVC_CERT(CVC_CERT *a, unsigned char **out); +int i2d_CVC_CERT( +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + const +#endif + CVC_CERT *a, unsigned char **out); /** * @brief Duplicate a CV certificate --- src/eac.c.orig 2021-04-09 07:42:03.000000000 -0500 +++ src/eac.c 2021-12-20 05:31:29.000000000 -0600 @@ -105,7 +105,9 @@ if (!ctx) return 0; - return BN_zero(ctx->ssc); + BN_zero(ctx->ssc); + + return 1; } int EAC_set_ssc(const EAC_CTX *ctx, unsigned long ssc) --- src/eac_util.c.orig 2021-04-09 07:42:04.000000000 -0500 +++ src/eac_util.c 2021-12-20 05:31:31.000000000 -0600 @@ -321,6 +321,10 @@ return NULL; } +#if OPENSSL_VERSION_NUMBER >= 0x30000000L +#include +#endif + BUF_MEM * retail_mac_des(const BUF_MEM * key, const BUF_MEM * in) { @@ -331,6 +335,11 @@ check(key, "Invalid arguments"); +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + OSSL_PROVIDER *legacy; + legacy = OSSL_PROVIDER_load(NULL, "legacy"); +#endif + len = EVP_CIPHER_block_size(EVP_des_cbc()); check(key->length >= 2*len, "Key too short"); @@ -369,6 +378,9 @@ BUF_MEM_free(c_tmp); BUF_MEM_free(d_tmp); EVP_CIPHER_CTX_free(ctx); +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + OSSL_PROVIDER_unload(legacy); +#endif return mac; @@ -381,6 +393,10 @@ BUF_MEM_free(d_tmp); if (ctx) EVP_CIPHER_CTX_free(ctx); +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + if (legacy) + OSSL_PROVIDER_unload(legacy); +#endif return NULL; }