26 #include <openssl/opensslv.h> 28 #include <openssl/asn1.h> 29 #include <openssl/bio.h> 30 #include <openssl/crypto.h> 31 #include <openssl/dh.h> 32 #include <openssl/err.h> 33 #include <openssl/evp.h> 34 #include <openssl/hmac.h> 35 #include <openssl/rand.h> 36 #include <openssl/rsa.h> 37 #include <openssl/sha.h> 38 #include <openssl/ssl.h> 39 #include <openssl/tls1.h> 40 #include <openssl/x509.h> 41 #include <openssl/x509v3.h> 44 #include <openssl/ec.h> 45 #include <openssl/ecdsa.h> 51 #if !defined(OPENSSL_IS_BORINGSSL) 52 #define FOLLY_OPENSSL_IS_100 \ 53 (OPENSSL_VERSION_NUMBER >= 0x10000003L && \ 54 OPENSSL_VERSION_NUMBER < 0x1000105fL) 55 #define FOLLY_OPENSSL_IS_101 \ 56 (OPENSSL_VERSION_NUMBER >= 0x1000105fL && \ 57 OPENSSL_VERSION_NUMBER < 0x1000200fL) 58 #define FOLLY_OPENSSL_IS_102 \ 59 (OPENSSL_VERSION_NUMBER >= 0x1000200fL && \ 60 OPENSSL_VERSION_NUMBER < 0x10100000L) 61 #define FOLLY_OPENSSL_IS_110 (OPENSSL_VERSION_NUMBER >= 0x10100000L) 64 #if !defined(OPENSSL_IS_BORINGSSL) && !FOLLY_OPENSSL_IS_100 && \ 65 !FOLLY_OPENSSL_IS_101 && !FOLLY_OPENSSL_IS_102 && !FOLLY_OPENSSL_IS_110 66 #warning Compiling with unsupported OpenSSL version 70 #if defined(OPENSSL_IS_BORINGSSL) || \ 71 (OPENSSL_VERSION_NUMBER >= 0x00908070L && !defined(OPENSSL_NO_TLSEXT)) 72 #define FOLLY_OPENSSL_HAS_SNI 1 74 #define FOLLY_OPENSSL_HAS_SNI 0 78 #if defined(OPENSSL_IS_BORINGSSL) || \ 79 (OPENSSL_VERSION_NUMBER >= 0x1000200fL && !defined(OPENSSL_NO_TLSEXT)) 80 #define FOLLY_OPENSSL_HAS_ALPN 1 82 #define FOLLY_OPENSSL_HAS_ALPN 0 92 namespace portability {
95 #ifdef OPENSSL_IS_BORINGSSL 96 int SSL_CTX_set1_sigalgs_list(SSL_CTX* ctx,
const char* sigalgs_list);
97 int TLS1_get_client_version(SSL*
s);
100 #if FOLLY_OPENSSL_IS_100 101 uint32_t SSL_CIPHER_get_id(
const SSL_CIPHER*);
102 int TLS1_get_client_version(
const SSL*);
105 #if FOLLY_OPENSSL_IS_100 || FOLLY_OPENSSL_IS_101 106 int X509_get_signature_nid(X509* cert);
109 #if FOLLY_OPENSSL_IS_100 || FOLLY_OPENSSL_IS_101 || FOLLY_OPENSSL_IS_102 110 int SSL_CTX_up_ref(SSL_CTX* session);
111 int SSL_SESSION_up_ref(SSL_SESSION* session);
112 int X509_up_ref(X509*
x);
113 int X509_STORE_up_ref(X509_STORE*
v);
114 int EVP_PKEY_up_ref(EVP_PKEY* evp);
120 RSA* EVP_PKEY_get0_RSA(EVP_PKEY* pkey);
121 DSA* EVP_PKEY_get0_DSA(EVP_PKEY* pkey);
122 DH* EVP_PKEY_get0_DH(EVP_PKEY* pkey);
123 EC_KEY* EVP_PKEY_get0_EC_KEY(EVP_PKEY* pkey);
126 #if !FOLLY_OPENSSL_IS_110 156 int DH_set0_pqg(DH* dh, BIGNUM* p, BIGNUM* q, BIGNUM*
g);
162 void DH_get0_key(
const DH* dh,
const BIGNUM** pub_key,
const BIGNUM** priv_key);
171 const BIGNUM** pub_key,
172 const BIGNUM** priv_key);
174 STACK_OF(X509_OBJECT) * X509_STORE_get0_objects(X509_STORE* store);
177 STACK_OF(X509) * X509_STORE_CTX_get0_chain(X509_STORE_CTX* ctx);
178 STACK_OF(X509) * X509_STORE_CTX_get0_untrusted(X509_STORE_CTX* ctx);
179 bool RSA_set0_key(RSA* r, BIGNUM* n, BIGNUM* e, BIGNUM* d);
185 const BIGNUM** iqmp);
187 void ECDSA_SIG_get0(
const ECDSA_SIG* sig,
const BIGNUM** pr,
const BIGNUM** ps);
210 #if FOLLY_OPENSSL_IS_110 213 #define OPENSSL_lh_new OPENSSL_LH_new 217 #define OPENSSL_NO_SSL2 225 using namespace
folly::portability::ssl;
X509 * X509_OBJECT_get0_X509(const X509_OBJECT *obj)
#define FOLLY_POP_WARNING
const X509_ALGOR * X509_get0_tbs_sigalg(const X509 *x)
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
void write(const T &in, folly::io::Appender &appender)
void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps)
void BIO_set_data(BIO *bio, void *ptr)
#define FOLLY_PUSH_WARNING
int BIO_meth_set_destroy(BIO_METHOD *biom, int(*destroy)(BIO *))
bool RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
const ASN1_INTEGER * X509_REVOKED_get0_serialNumber(const X509_REVOKED *r)
STACK_OF(X509_OBJECT)*X509_STORE_get0_objects(X509_STORE *store)
X509 * X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx)
int BIO_meth_set_create(BIO_METHOD *biom, int(*create)(BIO *))
unsigned char * ASN1_STRING_get0_data(const ASN1_STRING *x)
static http_parser_settings settings
void BIO_meth_free(BIO_METHOD *biom)
void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
—— Concurrent Priority Queue Implementation ——
int OPENSSL_init_ssl(uint64_t, const OPENSSL_INIT_SETTINGS *)
const SSL_METHOD * TLS_client_method(void)
int BIO_meth_set_write(BIO_METHOD *biom, int(*write)(BIO *, const char *, int))
void * BIO_get_data(BIO *bio)
void init(int *argc, char ***argv, bool removeFlags)
uint32_t X509_get_extended_key_usage(X509 *x)
int BIO_meth_set_gets(BIO_METHOD *biom, int(*bgets)(BIO *, char *, int))
HMAC_CTX * HMAC_CTX_new()
int SSL_SESSION_has_ticket(const SSL_SESSION *s)
int BIO_meth_set_ctrl(BIO_METHOD *biom, long(*ctrl)(BIO *, int, long, void *))
uint32_t X509_get_extension_flags(X509 *x)
size_t read(T &out, folly::io::Cursor &cursor)
int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
const ASN1_TIME * X509_CRL_get0_nextUpdate(const X509_CRL *crl)
const ASN1_TIME * X509_REVOKED_get0_revocationDate(const X509_REVOKED *r)
void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, const BIGNUM **iqmp)
const ASN1_TIME * X509_CRL_get0_lastUpdate(const X509_CRL *crl)
uint32_t X509_get_key_usage(X509 *x)
void DSA_get0_pqg(const DSA *dsa, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
constexpr detail::Sig< Sig > const sig
void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)
const char * SSL_SESSION_get0_hostname(const SSL_SESSION *s)
void BIO_set_init(BIO *bio, int init)
const SSL_METHOD * TLS_server_method(void)
void BIO_set_shutdown(BIO *bio, int shutdown)
unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s)
int X509_OBJECT_get_type(const X509_OBJECT *obj)
void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
void DSA_get0_key(const DSA *dsa, const BIGNUM **pub_key, const BIGNUM **priv_key)
EVP_MD_CTX * EVP_MD_CTX_new()
void HMAC_CTX_free(HMAC_CTX *ctx)
#define FOLLY_CLANG_DISABLE_WARNING(warningName)
BIO_METHOD * BIO_meth_new(int type, const char *name)
void OPENSSL_INIT_SETTINGS
int BIO_meth_set_puts(BIO_METHOD *biom, int(*bputs)(BIO *, const char *))
int BIO_meth_set_read(BIO_METHOD *biom, int(*read)(BIO *, char *, int))