Fix build with opaque structs in LibreSSL 3.5 Index: src/lib/crypt_ops/crypto_rsa_openssl.c --- src/lib/crypt_ops/crypto_rsa_openssl.c.orig +++ src/lib/crypt_ops/crypto_rsa_openssl.c @@ -47,7 +47,7 @@ struct crypto_pk_t int crypto_pk_key_is_private(const crypto_pk_t *k) { -#ifdef OPENSSL_1_1_API +#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER) if (!k || !k->key) return 0; @@ -212,7 +212,7 @@ crypto_pk_public_exponent_ok(const crypto_pk_t *env) const BIGNUM *e; -#ifdef OPENSSL_1_1_API +#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER) const BIGNUM *n, *d; RSA_get0_key(env->key, &n, &e, &d); #else @@ -242,7 +242,7 @@ crypto_pk_cmp_keys(const crypto_pk_t *a, const crypto_ const BIGNUM *a_n, *a_e; const BIGNUM *b_n, *b_e; -#ifdef OPENSSL_1_1_API +#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER) const BIGNUM *a_d, *b_d; RSA_get0_key(a->key, &a_n, &a_e, &a_d); RSA_get0_key(b->key, &b_n, &b_e, &b_d); @@ -279,7 +279,7 @@ crypto_pk_num_bits(crypto_pk_t *env) tor_assert(env); tor_assert(env->key); -#ifdef OPENSSL_1_1_API +#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER) /* It's so stupid that there's no other way to check that n is valid * before calling RSA_bits(). */ @@ -572,7 +572,7 @@ static bool rsa_private_key_too_long(RSA *rsa, int max_bits) { const BIGNUM *n, *e, *p, *q, *d, *dmp1, *dmq1, *iqmp; -#ifdef OPENSSL_1_1_API +#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER) #if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,1) n = RSA_get0_n(rsa);