proxygen
folly::ssl Namespace Reference

Namespaces

 detail
 
 ssl_options_detail
 

Classes

struct  ClientHelloInfo
 
class  OpenSSLCertUtils
 
class  OpenSSLHash
 
class  OpenSSLUtils
 
struct  SSLCommonOptions
 
struct  SSLServerOptions
 
class  SSLSession
 

Typedefs

using LockTypeMapping = std::map< int, LockType >
 
using ASN1TimeDeleter = folly::static_function_deleter< ASN1_TIME,&ASN1_TIME_free >
 
using ASN1TimeUniquePtr = std::unique_ptr< ASN1_TIME, ASN1TimeDeleter >
 
using ASN1Ia5StrDeleter = folly::static_function_deleter< ASN1_IA5STRING,&ASN1_IA5STRING_free >
 
using ASN1Ia5StrUniquePtr = std::unique_ptr< ASN1_IA5STRING, ASN1Ia5StrDeleter >
 
using ASN1IntDeleter = folly::static_function_deleter< ASN1_INTEGER,&ASN1_INTEGER_free >
 
using ASN1IntUniquePtr = std::unique_ptr< ASN1_INTEGER, ASN1IntDeleter >
 
using ASN1ObjDeleter = folly::static_function_deleter< ASN1_OBJECT,&ASN1_OBJECT_free >
 
using ASN1ObjUniquePtr = std::unique_ptr< ASN1_OBJECT, ASN1ObjDeleter >
 
using ASN1StrDeleter = folly::static_function_deleter< ASN1_STRING,&ASN1_STRING_free >
 
using ASN1StrUniquePtr = std::unique_ptr< ASN1_STRING, ASN1StrDeleter >
 
using ASN1TypeDeleter = folly::static_function_deleter< ASN1_TYPE,&ASN1_TYPE_free >
 
using ASN1TypeUniquePtr = std::unique_ptr< ASN1_TYPE, ASN1TypeDeleter >
 
using ASN1UTF8StrDeleter = folly::static_function_deleter< ASN1_UTF8STRING,&ASN1_UTF8STRING_free >
 
using ASN1UTF8StrUniquePtr = std::unique_ptr< ASN1_UTF8STRING, ASN1UTF8StrDeleter >
 
using X509Deleter = folly::static_function_deleter< X509,&X509_free >
 
using X509UniquePtr = std::unique_ptr< X509, X509Deleter >
 
using X509ExtensionDeleter = folly::static_function_deleter< X509_EXTENSION,&X509_EXTENSION_free >
 
using X509ExtensionUniquePtr = std::unique_ptr< X509_EXTENSION, X509ExtensionDeleter >
 
using X509StoreDeleter = folly::static_function_deleter< X509_STORE,&X509_STORE_free >
 
using X509StoreUniquePtr = std::unique_ptr< X509_STORE, X509StoreDeleter >
 
using X509StoreCtxDeleter = folly::static_function_deleter< X509_STORE_CTX,&X509_STORE_CTX_free >
 
using X509StoreCtxUniquePtr = std::unique_ptr< X509_STORE_CTX, X509StoreCtxDeleter >
 
using X509VerifyParamDeleter = folly::static_function_deleter< X509_VERIFY_PARAM,&X509_VERIFY_PARAM_free >
 
using X509VerifyParam = std::unique_ptr< X509_VERIFY_PARAM, X509VerifyParamDeleter >
 
using GeneralNameDeleter = folly::static_function_deleter< GENERAL_NAME,&GENERAL_NAME_free >
 
using GeneralNameUniquePtr = std::unique_ptr< GENERAL_NAME, GeneralNameDeleter >
 
using GeneralNamesDeleter = folly::static_function_deleter< GENERAL_NAMES,&GENERAL_NAMES_free >
 
using GeneralNamesUniquePtr = std::unique_ptr< GENERAL_NAMES, GeneralNamesDeleter >
 
using AccessDescriptionDeleter = folly::static_function_deleter< ACCESS_DESCRIPTION,&ACCESS_DESCRIPTION_free >
 
using AccessDescriptionUniquePtr = std::unique_ptr< ACCESS_DESCRIPTION, AccessDescriptionDeleter >
 
using AuthorityInfoAccessDeleter = folly::static_function_deleter< AUTHORITY_INFO_ACCESS,&AUTHORITY_INFO_ACCESS_free >
 
using AuthorityInfoAccessUniquePtr = std::unique_ptr< AUTHORITY_INFO_ACCESS, AuthorityInfoAccessDeleter >
 
using DistPointNameDeleter = folly::static_function_deleter< DIST_POINT_NAME,&DIST_POINT_NAME_free >
 
using DistPointNameUniquePtr = std::unique_ptr< DIST_POINT_NAME, DistPointNameDeleter >
 
using DistPointDeleter = folly::static_function_deleter< DIST_POINT,&DIST_POINT_free >
 
using DistPointUniquePtr = std::unique_ptr< DIST_POINT, DistPointDeleter >
 
using CrlDistPointsDeleter = folly::static_function_deleter< CRL_DIST_POINTS,&CRL_DIST_POINTS_free >
 
using CrlDistPointsUniquePtr = std::unique_ptr< CRL_DIST_POINTS, CrlDistPointsDeleter >
 
using X509CrlDeleter = folly::static_function_deleter< X509_CRL,&X509_CRL_free >
 
using X509CrlUniquePtr = std::unique_ptr< X509_CRL, X509CrlDeleter >
 
using X509NameDeleter = folly::static_function_deleter< X509_NAME,&X509_NAME_free >
 
using X509NameUniquePtr = std::unique_ptr< X509_NAME, X509NameDeleter >
 
using X509ReqDeleter = folly::static_function_deleter< X509_REQ,&X509_REQ_free >
 
using X509ReqUniquePtr = std::unique_ptr< X509_REQ, X509ReqDeleter >
 
using X509RevokedDeleter = folly::static_function_deleter< X509_REVOKED,&X509_REVOKED_free >
 
using X509RevokedUniquePtr = std::unique_ptr< X509_REVOKED, X509RevokedDeleter >
 
using EvpPkeyDeleter = folly::static_function_deleter< EVP_PKEY,&EVP_PKEY_free >
 
using EvpPkeyUniquePtr = std::unique_ptr< EVP_PKEY, EvpPkeyDeleter >
 
using EvpPkeySharedPtr = std::shared_ptr< EVP_PKEY >
 
using EvpMdCtxDeleter = folly::static_function_deleter< EVP_MD_CTX,&EVP_MD_CTX_free >
 
using EvpMdCtxUniquePtr = std::unique_ptr< EVP_MD_CTX, EvpMdCtxDeleter >
 
using EvpCipherCtxDeleter = folly::static_function_deleter< EVP_CIPHER_CTX,&EVP_CIPHER_CTX_free >
 
using EvpCipherCtxUniquePtr = std::unique_ptr< EVP_CIPHER_CTX, EvpCipherCtxDeleter >
 
using HmacCtxDeleter = folly::static_function_deleter< HMAC_CTX,&HMAC_CTX_free >
 
using HmacCtxUniquePtr = std::unique_ptr< HMAC_CTX, HmacCtxDeleter >
 
using BioMethodDeleter = folly::static_function_deleter< BIO_METHOD,&BIO_meth_free >
 
using BioMethodUniquePtr = std::unique_ptr< BIO_METHOD, BioMethodDeleter >
 
using BioDeleter = folly::static_function_deleter< BIO,&BIO_vfree >
 
using BioUniquePtr = std::unique_ptr< BIO, BioDeleter >
 
using BioChainDeleter = folly::static_function_deleter< BIO,&BIO_free_all >
 
using BioChainUniquePtr = std::unique_ptr< BIO, BioChainDeleter >
 
using BioDeleterFb = folly::static_function_deleter< BIO,&BIO_free_fb >
 
using BioUniquePtrFb = std::unique_ptr< BIO, BioDeleterFb >
 
using RsaDeleter = folly::static_function_deleter< RSA,&RSA_free >
 
using RsaUniquePtr = std::unique_ptr< RSA, RsaDeleter >
 
using EcKeyDeleter = folly::static_function_deleter< EC_KEY,&EC_KEY_free >
 
using EcKeyUniquePtr = std::unique_ptr< EC_KEY, EcKeyDeleter >
 
using EcGroupDeleter = folly::static_function_deleter< EC_GROUP,&EC_GROUP_free >
 
using EcGroupUniquePtr = std::unique_ptr< EC_GROUP, EcGroupDeleter >
 
using EcPointDeleter = folly::static_function_deleter< EC_POINT,&EC_POINT_free >
 
using EcPointUniquePtr = std::unique_ptr< EC_POINT, EcPointDeleter >
 
using EcdsaSigDeleter = folly::static_function_deleter< ECDSA_SIG,&ECDSA_SIG_free >
 
using EcdsaSigUniquePtr = std::unique_ptr< ECDSA_SIG, EcdsaSigDeleter >
 
using BIGNUMDeleter = folly::static_function_deleter< BIGNUM,&BN_clear_free >
 
using BIGNUMUniquePtr = std::unique_ptr< BIGNUM, BIGNUMDeleter >
 
using BNCtxDeleter = folly::static_function_deleter< BN_CTX,&BN_CTX_free >
 
using BNCtxUniquePtr = std::unique_ptr< BN_CTX, BNCtxDeleter >
 
using SSLDeleter = folly::static_function_deleter< SSL,&SSL_free >
 
using SSLUniquePtr = std::unique_ptr< SSL, SSLDeleter >
 
using SSLSessionDeleter = folly::static_function_deleter< SSL_SESSION,&SSL_SESSION_free >
 
using SSLSessionUniquePtr = std::unique_ptr< SSL_SESSION, SSLSessionDeleter >
 

Enumerations

enum  TLSExtension : uint16_t {
  TLSExtension::SERVER_NAME = 0, TLSExtension::MAX_FRAGMENT_LENGTH = 1, TLSExtension::CLIENT_CERTIFICATE_URL = 2, TLSExtension::TRUSTED_CA_KEYS = 3,
  TLSExtension::TRUNCATED_HMAC = 4, TLSExtension::STATUS_REQUEST = 5, TLSExtension::USER_MAPPING = 6, TLSExtension::CLIENT_AUTHZ = 7,
  TLSExtension::SERVER_AUTHZ = 8, TLSExtension::CERT_TYPE = 9, TLSExtension::SUPPORTED_GROUPS = 10, TLSExtension::EC_POINT_FORMATS = 11,
  TLSExtension::SRP = 12, TLSExtension::SIGNATURE_ALGORITHMS = 13, TLSExtension::USE_SRTP = 14, TLSExtension::HEARTBEAT = 15,
  TLSExtension::APPLICATION_LAYER_PROTOCOL_NEGOTIATION = 16, TLSExtension::STATUS_REQUEST_V2 = 17, TLSExtension::SIGNED_CERTIFICATE_TIMESTAMP = 18, TLSExtension::CLIENT_CERTIFICATE_TYPE = 19,
  TLSExtension::SERVER_CERTIFICATE_TYPE = 20, TLSExtension::PADDING = 21, TLSExtension::ENCRYPT_THEN_MAC = 22, TLSExtension::EXTENDED_MASTER_SECRET = 23,
  TLSExtension::SESSION_TICKET = 35, TLSExtension::SUPPORTED_VERSIONS = 43, TLSExtension::TLS_CACHED_INFO_FB = 60001, TLSExtension::RENEGOTIATION_INFO = 65281
}
 
enum  HashAlgorithm : uint8_t {
  HashAlgorithm::NONE = 0, HashAlgorithm::MD5 = 1, HashAlgorithm::SHA1 = 2, HashAlgorithm::SHA224 = 3,
  HashAlgorithm::SHA256 = 4, HashAlgorithm::SHA384 = 5, HashAlgorithm::SHA512 = 6
}
 
enum  SignatureAlgorithm : uint8_t { SignatureAlgorithm::ANONYMOUS = 0, SignatureAlgorithm::RSA = 1, SignatureAlgorithm::DSA = 2, SignatureAlgorithm::ECDSA = 3 }
 
enum  LockType { LockType::MUTEX, LockType::SPINLOCK, LockType::SHAREDMUTEX, LockType::NONE }
 

Functions

static std::unordered_map< uint16_t, std::stringgetOpenSSLCipherNames ()
 
template<typename TSSLOptions >
void setCipherSuites (SSLContext &ctx)
 
template<typename TSSLOptions >
void setSignatureAlgorithms (SSLContext &ctx)
 
void init ()
 
void cleanup ()
 
void markInitialized ()
 
void setLockTypesAndInit (LockTypeMapping inLockTypes)
 
void setLockTypes (LockTypeMapping inLockTypes)
 
void randomize ()
 
bool isLockDisabled (int lockId)
 
void BIO_free_fb (BIO *bio)
 
std::string getOpenSSLLongVersion ()
 
uint64_t getOpenSSLNumericVersion ()
 

Typedef Documentation

using folly::ssl::AccessDescriptionDeleter = typedef folly::static_function_deleter< ACCESS_DESCRIPTION , & ACCESS_DESCRIPTION_free >

Definition at line 58 of file OpenSSLPtrTypes.h.

using folly::ssl::AccessDescriptionUniquePtr = typedef std::unique_ptr< ACCESS_DESCRIPTION , AccessDescriptionDeleter>

Definition at line 58 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1Ia5StrDeleter = typedef folly::static_function_deleter< ASN1_IA5STRING , & ASN1_IA5STRING_free >

Definition at line 36 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1Ia5StrUniquePtr = typedef std::unique_ptr< ASN1_IA5STRING , ASN1Ia5StrDeleter>

Definition at line 36 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1IntDeleter = typedef folly::static_function_deleter< ASN1_INTEGER , & ASN1_INTEGER_free >

Definition at line 37 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1IntUniquePtr = typedef std::unique_ptr< ASN1_INTEGER , ASN1IntDeleter>

Definition at line 37 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1ObjDeleter = typedef folly::static_function_deleter< ASN1_OBJECT , & ASN1_OBJECT_free >

Definition at line 38 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1ObjUniquePtr = typedef std::unique_ptr< ASN1_OBJECT , ASN1ObjDeleter>

Definition at line 38 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1StrDeleter = typedef folly::static_function_deleter< ASN1_STRING , & ASN1_STRING_free >

Definition at line 39 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1StrUniquePtr = typedef std::unique_ptr< ASN1_STRING , ASN1StrDeleter>

Definition at line 39 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1TimeDeleter = typedef folly::static_function_deleter< ASN1_TIME , & ASN1_TIME_free >

Definition at line 35 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1TimeUniquePtr = typedef std::unique_ptr< ASN1_TIME , ASN1TimeDeleter>

Definition at line 35 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1TypeDeleter = typedef folly::static_function_deleter< ASN1_TYPE , & ASN1_TYPE_free >

Definition at line 40 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1TypeUniquePtr = typedef std::unique_ptr< ASN1_TYPE , ASN1TypeDeleter>

Definition at line 40 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1UTF8StrDeleter = typedef folly::static_function_deleter< ASN1_UTF8STRING , & ASN1_UTF8STRING_free >

Definition at line 41 of file OpenSSLPtrTypes.h.

using folly::ssl::ASN1UTF8StrUniquePtr = typedef std::unique_ptr< ASN1_UTF8STRING , ASN1UTF8StrDeleter>

Definition at line 41 of file OpenSSLPtrTypes.h.

using folly::ssl::AuthorityInfoAccessDeleter = typedef folly::static_function_deleter< AUTHORITY_INFO_ACCESS , & AUTHORITY_INFO_ACCESS_free >

Definition at line 62 of file OpenSSLPtrTypes.h.

using folly::ssl::AuthorityInfoAccessUniquePtr = typedef std::unique_ptr< AUTHORITY_INFO_ACCESS , AuthorityInfoAccessDeleter>

Definition at line 62 of file OpenSSLPtrTypes.h.

using folly::ssl::BIGNUMDeleter = typedef folly::static_function_deleter< BIGNUM , & BN_clear_free >

Definition at line 108 of file OpenSSLPtrTypes.h.

using folly::ssl::BIGNUMUniquePtr = typedef std::unique_ptr< BIGNUM , BIGNUMDeleter>

Definition at line 108 of file OpenSSLPtrTypes.h.

using folly::ssl::BioChainDeleter = typedef folly::static_function_deleter< BIO , & BIO_free_all >

Definition at line 91 of file OpenSSLPtrTypes.h.

using folly::ssl::BioChainUniquePtr = typedef std::unique_ptr< BIO , BioChainDeleter>

Definition at line 91 of file OpenSSLPtrTypes.h.

using folly::ssl::BioDeleter = typedef folly::static_function_deleter< BIO , & BIO_vfree >

Definition at line 90 of file OpenSSLPtrTypes.h.

Definition at line 95 of file OpenSSLPtrTypes.h.

using folly::ssl::BioMethodDeleter = typedef folly::static_function_deleter< BIO_METHOD , & BIO_meth_free >

Definition at line 89 of file OpenSSLPtrTypes.h.

using folly::ssl::BioMethodUniquePtr = typedef std::unique_ptr< BIO_METHOD , BioMethodDeleter>

Definition at line 89 of file OpenSSLPtrTypes.h.

using folly::ssl::BioUniquePtr = typedef std::unique_ptr< BIO , BioDeleter>

Definition at line 90 of file OpenSSLPtrTypes.h.

using folly::ssl::BioUniquePtrFb = typedef std::unique_ptr<BIO, BioDeleterFb>

Definition at line 96 of file OpenSSLPtrTypes.h.

using folly::ssl::BNCtxDeleter = typedef folly::static_function_deleter< BN_CTX , & BN_CTX_free >

Definition at line 109 of file OpenSSLPtrTypes.h.

using folly::ssl::BNCtxUniquePtr = typedef std::unique_ptr< BN_CTX , BNCtxDeleter>

Definition at line 109 of file OpenSSLPtrTypes.h.

using folly::ssl::CrlDistPointsDeleter = typedef folly::static_function_deleter< CRL_DIST_POINTS , & CRL_DIST_POINTS_free >

Definition at line 65 of file OpenSSLPtrTypes.h.

using folly::ssl::CrlDistPointsUniquePtr = typedef std::unique_ptr< CRL_DIST_POINTS , CrlDistPointsDeleter>

Definition at line 65 of file OpenSSLPtrTypes.h.

using folly::ssl::DistPointDeleter = typedef folly::static_function_deleter< DIST_POINT , & DIST_POINT_free >

Definition at line 64 of file OpenSSLPtrTypes.h.

using folly::ssl::DistPointNameDeleter = typedef folly::static_function_deleter< DIST_POINT_NAME , & DIST_POINT_NAME_free >

Definition at line 63 of file OpenSSLPtrTypes.h.

using folly::ssl::DistPointNameUniquePtr = typedef std::unique_ptr< DIST_POINT_NAME , DistPointNameDeleter>

Definition at line 63 of file OpenSSLPtrTypes.h.

using folly::ssl::DistPointUniquePtr = typedef std::unique_ptr< DIST_POINT , DistPointDeleter>

Definition at line 64 of file OpenSSLPtrTypes.h.

using folly::ssl::EcdsaSigDeleter = typedef folly::static_function_deleter< ECDSA_SIG , & ECDSA_SIG_free >

Definition at line 104 of file OpenSSLPtrTypes.h.

using folly::ssl::EcdsaSigUniquePtr = typedef std::unique_ptr< ECDSA_SIG , EcdsaSigDeleter>

Definition at line 104 of file OpenSSLPtrTypes.h.

using folly::ssl::EcGroupDeleter = typedef folly::static_function_deleter< EC_GROUP , & EC_GROUP_free >

Definition at line 102 of file OpenSSLPtrTypes.h.

using folly::ssl::EcGroupUniquePtr = typedef std::unique_ptr< EC_GROUP , EcGroupDeleter>

Definition at line 102 of file OpenSSLPtrTypes.h.

using folly::ssl::EcKeyDeleter = typedef folly::static_function_deleter< EC_KEY , & EC_KEY_free >

Definition at line 101 of file OpenSSLPtrTypes.h.

using folly::ssl::EcKeyUniquePtr = typedef std::unique_ptr< EC_KEY , EcKeyDeleter>

Definition at line 101 of file OpenSSLPtrTypes.h.

using folly::ssl::EcPointDeleter = typedef folly::static_function_deleter< EC_POINT , & EC_POINT_free >

Definition at line 103 of file OpenSSLPtrTypes.h.

using folly::ssl::EcPointUniquePtr = typedef std::unique_ptr< EC_POINT , EcPointDeleter>

Definition at line 103 of file OpenSSLPtrTypes.h.

using folly::ssl::EvpCipherCtxDeleter = typedef folly::static_function_deleter< EVP_CIPHER_CTX , & EVP_CIPHER_CTX_free >

Definition at line 83 of file OpenSSLPtrTypes.h.

using folly::ssl::EvpCipherCtxUniquePtr = typedef std::unique_ptr< EVP_CIPHER_CTX , EvpCipherCtxDeleter>

Definition at line 83 of file OpenSSLPtrTypes.h.

using folly::ssl::EvpMdCtxDeleter = typedef folly::static_function_deleter< EVP_MD_CTX , & EVP_MD_CTX_free >

Definition at line 82 of file OpenSSLPtrTypes.h.

using folly::ssl::EvpMdCtxUniquePtr = typedef std::unique_ptr< EVP_MD_CTX , EvpMdCtxDeleter>

Definition at line 82 of file OpenSSLPtrTypes.h.

using folly::ssl::EvpPkeyDeleter = typedef folly::static_function_deleter< EVP_PKEY , & EVP_PKEY_free >

Definition at line 72 of file OpenSSLPtrTypes.h.

using folly::ssl::EvpPkeySharedPtr = typedef std::shared_ptr<EVP_PKEY>

Definition at line 73 of file OpenSSLPtrTypes.h.

using folly::ssl::EvpPkeyUniquePtr = typedef std::unique_ptr< EVP_PKEY , EvpPkeyDeleter>

Definition at line 72 of file OpenSSLPtrTypes.h.

using folly::ssl::GeneralNameDeleter = typedef folly::static_function_deleter< GENERAL_NAME , & GENERAL_NAME_free >

Definition at line 53 of file OpenSSLPtrTypes.h.

using folly::ssl::GeneralNamesDeleter = typedef folly::static_function_deleter< GENERAL_NAMES , & GENERAL_NAMES_free >

Definition at line 54 of file OpenSSLPtrTypes.h.

using folly::ssl::GeneralNamesUniquePtr = typedef std::unique_ptr< GENERAL_NAMES , GeneralNamesDeleter>

Definition at line 54 of file OpenSSLPtrTypes.h.

using folly::ssl::GeneralNameUniquePtr = typedef std::unique_ptr< GENERAL_NAME , GeneralNameDeleter>

Definition at line 53 of file OpenSSLPtrTypes.h.

using folly::ssl::HmacCtxDeleter = typedef folly::static_function_deleter< HMAC_CTX , & HMAC_CTX_free >

Definition at line 86 of file OpenSSLPtrTypes.h.

using folly::ssl::HmacCtxUniquePtr = typedef std::unique_ptr< HMAC_CTX , HmacCtxDeleter>

Definition at line 86 of file OpenSSLPtrTypes.h.

Map between an OpenSSL lock (see constants in crypto/crypto.h) and the implementation of the lock

Definition at line 29 of file OpenSSLLockTypes.h.

using folly::ssl::RsaDeleter = typedef folly::static_function_deleter< RSA , & RSA_free >

Definition at line 99 of file OpenSSLPtrTypes.h.

using folly::ssl::RsaUniquePtr = typedef std::unique_ptr< RSA , RsaDeleter>

Definition at line 99 of file OpenSSLPtrTypes.h.

using folly::ssl::SSLDeleter = typedef folly::static_function_deleter< SSL , & SSL_free >

Definition at line 112 of file OpenSSLPtrTypes.h.

using folly::ssl::SSLSessionDeleter = typedef folly::static_function_deleter< SSL_SESSION , & SSL_SESSION_free >

Definition at line 113 of file OpenSSLPtrTypes.h.

using folly::ssl::SSLSessionUniquePtr = typedef std::unique_ptr< SSL_SESSION , SSLSessionDeleter>

Definition at line 113 of file OpenSSLPtrTypes.h.

using folly::ssl::SSLUniquePtr = typedef std::unique_ptr< SSL , SSLDeleter>

Definition at line 112 of file OpenSSLPtrTypes.h.

using folly::ssl::X509CrlDeleter = typedef folly::static_function_deleter< X509_CRL , & X509_CRL_free >

Definition at line 66 of file OpenSSLPtrTypes.h.

using folly::ssl::X509CrlUniquePtr = typedef std::unique_ptr< X509_CRL , X509CrlDeleter>

Definition at line 66 of file OpenSSLPtrTypes.h.

using folly::ssl::X509Deleter = typedef folly::static_function_deleter< X509 , & X509_free >

Definition at line 44 of file OpenSSLPtrTypes.h.

using folly::ssl::X509ExtensionDeleter = typedef folly::static_function_deleter< X509_EXTENSION , & X509_EXTENSION_free >

Definition at line 45 of file OpenSSLPtrTypes.h.

using folly::ssl::X509ExtensionUniquePtr = typedef std::unique_ptr< X509_EXTENSION , X509ExtensionDeleter>

Definition at line 45 of file OpenSSLPtrTypes.h.

using folly::ssl::X509NameDeleter = typedef folly::static_function_deleter< X509_NAME , & X509_NAME_free >

Definition at line 67 of file OpenSSLPtrTypes.h.

using folly::ssl::X509NameUniquePtr = typedef std::unique_ptr< X509_NAME , X509NameDeleter>

Definition at line 67 of file OpenSSLPtrTypes.h.

using folly::ssl::X509ReqDeleter = typedef folly::static_function_deleter< X509_REQ , & X509_REQ_free >

Definition at line 68 of file OpenSSLPtrTypes.h.

using folly::ssl::X509ReqUniquePtr = typedef std::unique_ptr< X509_REQ , X509ReqDeleter>

Definition at line 68 of file OpenSSLPtrTypes.h.

using folly::ssl::X509RevokedDeleter = typedef folly::static_function_deleter< X509_REVOKED , & X509_REVOKED_free >

Definition at line 69 of file OpenSSLPtrTypes.h.

using folly::ssl::X509RevokedUniquePtr = typedef std::unique_ptr< X509_REVOKED , X509RevokedDeleter>

Definition at line 69 of file OpenSSLPtrTypes.h.

using folly::ssl::X509StoreCtxDeleter = typedef folly::static_function_deleter< X509_STORE_CTX , & X509_STORE_CTX_free >

Definition at line 47 of file OpenSSLPtrTypes.h.

using folly::ssl::X509StoreCtxUniquePtr = typedef std::unique_ptr< X509_STORE_CTX , X509StoreCtxDeleter>

Definition at line 47 of file OpenSSLPtrTypes.h.

using folly::ssl::X509StoreDeleter = typedef folly::static_function_deleter< X509_STORE , & X509_STORE_free >

Definition at line 46 of file OpenSSLPtrTypes.h.

using folly::ssl::X509StoreUniquePtr = typedef std::unique_ptr< X509_STORE , X509StoreDeleter>

Definition at line 46 of file OpenSSLPtrTypes.h.

using folly::ssl::X509UniquePtr = typedef std::unique_ptr< X509 , X509Deleter>

Definition at line 44 of file OpenSSLPtrTypes.h.

using folly::ssl::X509VerifyParam = typedef std::unique_ptr<X509_VERIFY_PARAM, X509VerifyParamDeleter>

Definition at line 51 of file OpenSSLPtrTypes.h.

using folly::ssl::X509VerifyParamDeleter = typedef folly::static_function_deleter<X509_VERIFY_PARAM, &X509_VERIFY_PARAM_free>

Definition at line 49 of file OpenSSLPtrTypes.h.

Enumeration Type Documentation

Enumerator
NONE 
MD5 
SHA1 
SHA224 
SHA256 
SHA384 
SHA512 

Definition at line 62 of file TLSDefinitions.h.

Enumerator
ANONYMOUS 
RSA 
DSA 
ECDSA 

Definition at line 73 of file TLSDefinitions.h.

Enumerator
SERVER_NAME 
MAX_FRAGMENT_LENGTH 
CLIENT_CERTIFICATE_URL 
TRUSTED_CA_KEYS 
TRUNCATED_HMAC 
STATUS_REQUEST 
USER_MAPPING 
CLIENT_AUTHZ 
SERVER_AUTHZ 
CERT_TYPE 
SUPPORTED_GROUPS 
EC_POINT_FORMATS 
SRP 
SIGNATURE_ALGORITHMS 
USE_SRTP 
HEARTBEAT 
APPLICATION_LAYER_PROTOCOL_NEGOTIATION 
STATUS_REQUEST_V2 
SIGNED_CERTIFICATE_TIMESTAMP 
CLIENT_CERTIFICATE_TYPE 
SERVER_CERTIFICATE_TYPE 
PADDING 
ENCRYPT_THEN_MAC 
EXTENDED_MASTER_SECRET 
SESSION_TICKET 
SUPPORTED_VERSIONS 
TLS_CACHED_INFO_FB 
RENEGOTIATION_INFO 

Definition at line 28 of file TLSDefinitions.h.

28  : uint16_t {
29  SERVER_NAME = 0,
32  TRUSTED_CA_KEYS = 3,
33  TRUNCATED_HMAC = 4,
34  STATUS_REQUEST = 5,
35  USER_MAPPING = 6,
36  CLIENT_AUTHZ = 7,
37  SERVER_AUTHZ = 8,
38  CERT_TYPE = 9,
39  SUPPORTED_GROUPS = 10,
40  EC_POINT_FORMATS = 11,
41  SRP = 12,
43  USE_SRTP = 14,
44  HEARTBEAT = 15,
46  STATUS_REQUEST_V2 = 17,
50  PADDING = 21,
51  ENCRYPT_THEN_MAC = 22,
53  SESSION_TICKET = 35,
54  SUPPORTED_VERSIONS = 43,
55  // Facebook-specific, not IANA assigned yet
56  TLS_CACHED_INFO_FB = 60001,
57  // End Facebook-specific
58  RENEGOTIATION_INFO = 65281
59 };

Function Documentation

void folly::ssl::BIO_free_fb ( BIO *  bio)
inline

Definition at line 92 of file OpenSSLPtrTypes.h.

92  {
93  CHECK_EQ(1, BIO_free(bio));
94 }
void folly::ssl::cleanup ( )

Cleans up openssl. This should be invoked at most once during the lifetime of the application. OpenSSL >= 1.1.0 users do not need to manually invoke this method, as OpenSSL will automatically cleanup itself during the exit of the application.

Definition at line 59 of file Init.cpp.

References g().

Referenced by proxygen::WorkerThread::getCurrentWorkerThread(), folly::threadlocal_detail::ElementWrapper::release(), TEST_F(), TYPED_TEST_P(), and folly::IndexedMemPool< T, NumLocalLists_, LocalListLimit_, Atom, Traits >::~IndexedMemPool().

59  {
60  std::lock_guard<std::mutex> g(initMutex());
61  cleanupOpenSSLLocked();
62 }
g_t g(f_t)
static std::unordered_map<uint16_t, std::string> folly::ssl::getOpenSSLCipherNames ( )
static

Definition at line 152 of file OpenSSLUtils.cpp.

References c, i, init(), SCOPE_EXIT, folly::portability::ssl::STACK_OF(), and uint16_t.

Referenced by folly::ssl::OpenSSLUtils::getCipherName().

152  {
154  std::unordered_map<uint16_t, std::string> ret;
155  SSL_CTX* ctx = nullptr;
156  SSL* ssl = nullptr;
157 
158  const SSL_METHOD* meth = SSLv23_server_method();
159  OpenSSL_add_ssl_algorithms();
160 
161  if ((ctx = SSL_CTX_new(meth)) == nullptr) {
162  return ret;
163  }
164  SCOPE_EXIT {
165  SSL_CTX_free(ctx);
166  };
167 
168  if ((ssl = SSL_new(ctx)) == nullptr) {
169  return ret;
170  }
171  SCOPE_EXIT {
172  SSL_free(ssl);
173  };
174 
175  STACK_OF(SSL_CIPHER)* sk = SSL_get_ciphers(ssl);
176  for (int i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
177  const SSL_CIPHER* c = sk_SSL_CIPHER_value(sk, i);
178  unsigned long id = SSL_CIPHER_get_id(c);
179  // OpenSSL 1.0.2 and prior does weird things such as stuff the SSL/TLS
180  // version into the top 16 bits. Let's ignore those for now. This is
181  // BoringSSL compatible (their id can be cast as uint16_t)
182  uint16_t cipherCode = id & 0xffffL;
183  ret[cipherCode] = SSL_CIPHER_get_name(c);
184  }
185  return ret;
186 }
STACK_OF(X509_OBJECT)*X509_STORE_get0_objects(X509_STORE *store)
Definition: OpenSSL.cpp:305
void init()
Definition: Init.cpp:54
#define SCOPE_EXIT
Definition: ScopeGuard.h:274
char c
std::string folly::ssl::getOpenSSLLongVersion ( )
inline

Definition at line 26 of file OpenSSLVersionFinder.h.

References folly::format().

26  {
27 #ifdef OPENSSL_VERSION_TEXT
28  return SSLeay_version(SSLEAY_VERSION);
29 #elif defined(OPENSSL_VERSION_NUMBER)
30  return folly::format("0x{:x}", OPENSSL_VERSION_NUMBER).str();
31 #else
32  return "";
33 #endif
34 }
Formatter< false, Args... > format(StringPiece fmt, Args &&...args)
Definition: Format.h:271
uint64_t folly::ssl::getOpenSSLNumericVersion ( )
inline

Definition at line 36 of file OpenSSLVersionFinder.h.

36  {
37 #ifdef OPENSSL_VERSION_NUMBER
38  return SSLeay();
39 #else
40  return 0;
41 #endif
42 }
void folly::ssl::init ( )

Initializes openssl. This should be invoked once, during the start of an application. Subsequent calls to this function are no-ops.

For OpenSSL < 1.1.0, any lock types should be set with setLockTypes prior to the call to folly::ssl::init()

Definition at line 54 of file Init.cpp.

References g().

Referenced by getOpenSSLCipherNames(), folly::SSLContext::initializeOpenSSL(), main(), fizz::test::AuthenticatorTest::SetUp(), OpenSSLCertUtilsTest::SetUp(), fizz::test::ValidateAuthenticatorTest::SetUp(), folly::SSLContext::SSLContext(), folly::TEST(), and TEST().

54  {
55  std::lock_guard<std::mutex> g(initMutex());
56  initializeOpenSSLLocked();
57 }
g_t g(f_t)
bool folly::ssl::isLockDisabled ( int  lockId)

Definition at line 91 of file Init.cpp.

References folly::ssl::detail::isSSLLockDisabled().

Referenced by folly::TEST().

91  {
92  return detail::isSSLLockDisabled(lockId);
93 }
bool isSSLLockDisabled(int lockId)
void folly::ssl::markInitialized ( )

Mark openssl as initialized without actually performing any initialization. Please use this only if you are using a library which requires that it must make its own calls to SSL_library_init() and related functions.

Definition at line 64 of file Init.cpp.

References g().

64  {
65  std::lock_guard<std::mutex> g(initMutex());
66  initialized_ = true;
67 }
g_t g(f_t)
void folly::ssl::randomize ( )

Definition at line 87 of file Init.cpp.

87  {
88  RAND_poll();
89 }
template<typename TSSLOptions >
void folly::ssl::setCipherSuites ( SSLContext ctx)

Set the cipher suite of ctx to that in TSSLOptions, and print any runtime error it catches.

Parameters
ctxThe SSLContext to apply the desired SSL options to.

Definition at line 97 of file SSLOptions.h.

References folly::ssl::ssl_options_detail::logDfatal(), and folly::SSLContext::setCipherList().

97  {
98  try {
99  ctx.setCipherList(TSSLOptions::kCipherList);
100  } catch (std::runtime_error const& e) {
102  }
103 }
void logDfatal(std::exception const &e)
Definition: SSLOptions.cpp:25
void folly::ssl::setLockTypes ( LockTypeMapping  inLockTypes)

Set preferences for how to treat locks in OpenSSL. This must be called before folly::ssl::init(), otherwise the defaults will be used.

OpenSSL has a lock for each module rather than for each object or data that needs locking. Some locks protect only refcounts, and might be better as spinlocks rather than mutexes. Other locks may be totally unnecessary if the objects being protected are not shared between threads in the application.

For a list of OpenSSL lock types, refer to crypto/crypto.h.

By default, all locks are initialized as mutexes. OpenSSL's lock usage may change from version to version and you should know what you are doing before disabling any locks entirely.

In newer versions of OpenSSL (>= 1.1.0), OpenSSL manages its own locks, and this function is a no-op.

Example: if you don't share SSL sessions between threads in your application, you may be able to do this

setSSLLockTypes({{ CRYPTO_LOCK_SSL_SESSION, SSLContext::SSLLockType::LOCK_NONE }})

Definition at line 76 of file Init.cpp.

References g(), folly::INFO, folly::gen::move, and folly::ssl::detail::setLockTypes().

Referenced by folly::setupSSLLocks(), and folly::TEST().

76  {
77  std::lock_guard<std::mutex> g(initMutex());
78  if (initialized_) {
79  // We set the locks on initialization, so if we are already initialized
80  // this would have no affect.
81  LOG(INFO) << "Ignoring setSSLLockTypes after initialization";
82  return;
83  }
84  detail::setLockTypes(std::move(inLockTypes));
85 }
void setLockTypes(LockTypeMapping inLockTypes)
Definition: Init.cpp:76
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
g_t g(f_t)
void folly::ssl::setLockTypesAndInit ( LockTypeMapping  lockTypes)

Set the lock types and initialize OpenSSL in an atomic fashion. This aborts if the library has already been initialized.

Definition at line 69 of file Init.cpp.

References g(), folly::gen::move, and folly::ssl::detail::setLockTypes().

Referenced by folly::TEST().

69  {
70  std::lock_guard<std::mutex> g(initMutex());
71  CHECK(!initialized_) << "OpenSSL is already initialized";
72  detail::setLockTypes(std::move(inLockTypes));
73  initializeOpenSSLLocked();
74 }
void setLockTypes(LockTypeMapping inLockTypes)
Definition: Init.cpp:76
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
g_t g(f_t)
template<typename TSSLOptions >
void folly::ssl::setSignatureAlgorithms ( SSLContext ctx)

Set the signature algorithm list of ctx to that in TSSLOptions, and print any runtime errors it catche.

Parameters
ctxThe SSLContext to apply the desired SSL options to.

Definition at line 111 of file SSLOptions.h.

References folly::ssl::ssl_options_detail::logDfatal(), and folly::SSLContext::setSignatureAlgorithms().

Referenced by folly::SSLContext::setSignatureAlgorithms().

111  {
112  try {
113  ctx.setSignatureAlgorithms(TSSLOptions::kSignatureAlgorithms);
114  } catch (std::runtime_error const& e) {
116  }
117 }
void logDfatal(std::exception const &e)
Definition: SSLOptions.cpp:25