Skip to content

Commit

Permalink
cut handling for openssl v1.0.2
Browse files Browse the repository at this point in the history
Summary: The required minimum version of openssl is v1.1.0.

Reviewed By: dmm-fb

Differential Revision: D54766358

fbshipit-source-id: 6e4f1917d5d0406116cf0f467919decf1b03c064
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Mar 15, 2024
1 parent 8c7e9fb commit b529745
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 90 deletions.
69 changes: 0 additions & 69 deletions folly/portability/OpenSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,75 +36,6 @@ int TLS1_get_client_version(SSL* s) {
}
#endif

#if FOLLY_OPENSSL_IS_102
int SSL_CTX_up_ref(SSL_CTX* ctx) {
return CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX);
}

int SSL_SESSION_up_ref(SSL_SESSION* session) {
return CRYPTO_add(&session->references, 1, CRYPTO_LOCK_SSL_SESSION);
}

int X509_up_ref(X509* x) {
return CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
}

void X509_STORE_CTX_set0_verified_chain(
X509_STORE_CTX* ctx, STACK_OF(X509) * sk) {
sk_X509_pop_free(ctx->chain, X509_free);
ctx->chain = sk;
}

int X509_STORE_up_ref(X509_STORE* v) {
return CRYPTO_add(&v->references, 1, CRYPTO_LOCK_X509_STORE);
}

int EVP_PKEY_up_ref(EVP_PKEY* evp) {
return CRYPTO_add(&evp->references, 1, CRYPTO_LOCK_EVP_PKEY);
}

void RSA_get0_key(
const RSA* r, const BIGNUM** n, const BIGNUM** e, const BIGNUM** d) {
if (n != nullptr) {
*n = r->n;
}
if (e != nullptr) {
*e = r->e;
}
if (d != nullptr) {
*d = r->d;
}
}

RSA* EVP_PKEY_get0_RSA(EVP_PKEY* pkey) {
if (pkey->type != EVP_PKEY_RSA) {
return nullptr;
}
return pkey->pkey.rsa;
}

DSA* EVP_PKEY_get0_DSA(EVP_PKEY* pkey) {
if (pkey->type != EVP_PKEY_DSA) {
return nullptr;
}
return pkey->pkey.dsa;
}

DH* EVP_PKEY_get0_DH(EVP_PKEY* pkey) {
if (pkey->type != EVP_PKEY_DH) {
return nullptr;
}
return pkey->pkey.dh;
}

EC_KEY* EVP_PKEY_get0_EC_KEY(EVP_PKEY* pkey) {
if (pkey->type != EVP_PKEY_EC) {
return nullptr;
}
return pkey->pkey.ec;
}
#endif

#if !FOLLY_OPENSSL_IS_110
BIO_METHOD* BIO_meth_new(int type, const char* name) {
BIO_METHOD* method = (BIO_METHOD*)OPENSSL_malloc(sizeof(BIO_METHOD));
Expand Down
22 changes: 1 addition & 21 deletions folly/portability/OpenSSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@
// OPENSSL_VERSION_NUMBER to maintain compatibility. The following variables are
// intended to be specific to OpenSSL.
#if !defined(OPENSSL_IS_BORINGSSL)
#define FOLLY_OPENSSL_IS_102 \
(OPENSSL_VERSION_NUMBER >= 0x1000200fL && \
OPENSSL_VERSION_NUMBER < 0x10100000L)
#define FOLLY_OPENSSL_IS_110 (OPENSSL_VERSION_NUMBER >= 0x10100000L)
// OPENSSL_VERSION_{MAJOR,MINOR} only introduced in 3.0, so need to
// test if they are defined first
Expand All @@ -87,8 +84,7 @@
(OPENSSL_VERSION_NUMBER >= FOLLY_OPENSSL_CALCULATE_VERSION(major, minor, fix))
#endif

#if !defined(OPENSSL_IS_BORINGSSL) && !FOLLY_OPENSSL_IS_102 && \
!FOLLY_OPENSSL_IS_110
#if !defined(OPENSSL_IS_BORINGSSL) && !FOLLY_OPENSSL_IS_110
#warning Compiling with unsupported OpenSSL version
#endif

Expand Down Expand Up @@ -162,22 +158,6 @@ int SSL_CTX_set1_sigalgs_list(SSL_CTX* ctx, const char* sigalgs_list);
int TLS1_get_client_version(SSL* s);
#endif

#if FOLLY_OPENSSL_IS_102
int SSL_CTX_up_ref(SSL_CTX* session);
int SSL_SESSION_up_ref(SSL_SESSION* session);
int X509_up_ref(X509* x);
int X509_STORE_up_ref(X509_STORE* v);
void X509_STORE_CTX_set0_verified_chain(
X509_STORE_CTX* ctx, STACK_OF(X509) * sk);
int EVP_PKEY_up_ref(EVP_PKEY* evp);
void RSA_get0_key(
const RSA* r, const BIGNUM** n, const BIGNUM** e, const BIGNUM** d);
RSA* EVP_PKEY_get0_RSA(EVP_PKEY* pkey);
DSA* EVP_PKEY_get0_DSA(EVP_PKEY* pkey);
DH* EVP_PKEY_get0_DH(EVP_PKEY* pkey);
EC_KEY* EVP_PKEY_get0_EC_KEY(EVP_PKEY* pkey);
#endif

#if !FOLLY_OPENSSL_IS_110
BIO_METHOD* BIO_meth_new(int type, const char* name);
void BIO_meth_free(BIO_METHOD* biom);
Expand Down

0 comments on commit b529745

Please sign in to comment.