#include <folly/io/async/SSLContext.h>
#include <folly/Format.h>
#include <folly/Memory.h>
#include <folly/Random.h>
#include <folly/SharedMutex.h>
#include <folly/SpinLock.h>
#include <folly/ssl/OpenSSLTicketHandler.h>
#include <folly/ssl/PasswordCollector.h>
#include <folly/ssl/SSLSessionManager.h>
#include <folly/system/ThreadId.h>
namespace folly {
namespace {
int getExDataIndex() { … }
void configureProtocolVersion(SSL_CTX* ctx, SSLContext::SSLVersion version) { … }
static int dispatchTicketCrypto(
SSL* ssl,
unsigned char* keyName,
unsigned char* iv,
EVP_CIPHER_CTX* cipherCtx,
HMAC_CTX* hmacCtx,
int encrypt) { … }
}
SSLContext::SSLContext(SSLVersion version) { … }
SSLContext::~SSLContext() { … }
void SSLContext::ciphers(const std::string& ciphers) { … }
void SSLContext::setClientECCurvesList(
const std::vector<std::string>& ecCurves) { … }
void SSLContext::setSupportedGroups(const std::vector<std::string>& groups) { … }
void SSLContext::setServerECCurve(const std::string& curveName) { … }
SSLContext::SSLContext(SSL_CTX* ctx) : … { … }
void SSLContext::setX509VerifyParam(
const ssl::X509VerifyParam& x509VerifyParam) { … }
void SSLContext::setCiphersOrThrow(const std::string& ciphers) { … }
void SSLContext::setSigAlgsOrThrow(const std::string& sigalgs) { … }
void SSLContext::setVerificationOption(
const SSLContext::SSLVerifyPeerEnum& verifyPeer) { … }
void SSLContext::setVerificationOption(
const SSLContext::VerifyClientCertificate& verifyClient) { … }
void SSLContext::setVerificationOption(
const SSLContext::VerifyServerCertificate& verifyServer) { … }
int SSLContext::getVerificationMode(
const SSLContext::VerifyClientCertificate& verifyClient) { … }
int SSLContext::getVerificationMode(
const SSLContext::VerifyServerCertificate& verifyServer) { … }
int SSLContext::getVerificationMode(
const SSLContext::SSLVerifyPeerEnum& verifyPeer) { … }
int SSLContext::getVerificationMode() const { … }
void SSLContext::authenticate(
bool checkPeerCert, bool checkPeerName, const std::string& peerName) { … }
void SSLContext::loadCertificate(const char* path, const char* format) { … }
void SSLContext::loadCertificateFromBufferPEM(folly::StringPiece cert) { … }
void SSLContext::loadPrivateKey(const char* path, const char* format) { … }
void SSLContext::loadPrivateKeyFromBufferPEM(folly::StringPiece pkey) { … }
void SSLContext::loadCertKeyPairFromBufferPEM(
folly::StringPiece cert, folly::StringPiece pkey) { … }
void SSLContext::loadCertKeyPairFromFiles(
const char* certPath,
const char* keyPath,
const char* certFormat,
const char* keyFormat) { … }
void SSLContext::setCertChainKeyPair(
std::vector<ssl::X509UniquePtr>&& certChain, ssl::EvpPkeyUniquePtr&& key) { … }
bool SSLContext::isCertKeyPairValid() const { … }
void SSLContext::loadTrustedCertificates(const char* path) { … }
void SSLContext::loadTrustedCertificates(X509_STORE* store) { … }
void SSLContext::setSupportedClientCertificateAuthorityNames(
std::vector<ssl::X509NameUniquePtr> names) { … }
void SSLContext::passwordCollector(
std::shared_ptr<ssl::PasswordCollector> collector) { … }
void SSLContext::setServerNameCallback(const ServerNameCallback& cb) { … }
void SSLContext::addClientHelloCallback(const ClientHelloCallback& cb) { … }
int SSLContext::baseServerNameOpenSSLCallback(SSL* ssl, int* al, void* data) { … }
int SSLContext::alpnSelectCallback(
SSL* ,
const unsigned char** out,
unsigned char* outlen,
const unsigned char* in,
unsigned int inlen,
void* data) { … }
std::string SSLContext::getAdvertisedNextProtocols() const { … }
bool SSLContext::setAdvertisedNextProtocols(
const std::list<std::string>& protocols) { … }
bool SSLContext::setRandomizedAdvertisedNextProtocols(
const std::list<NextProtocolsItem>& items) { … }
void SSLContext::deleteNextProtocolsStrings() { … }
void SSLContext::unsetNextProtocols() { … }
size_t SSLContext::pickNextProtocols() { … }
SSL* SSLContext::createSSL() const { … }
void SSLContext::setSessionCacheContext(const std::string& context) { … }
bool SSLContext::matchName(const char* host, const char* pattern, int size) { … }
int SSLContext::passwordCallback(char* password, int size, int, void* data) { … }
#if defined(SSL_MODE_HANDSHAKE_CUTTHROUGH)
void SSLContext::enableFalseStart() {
SSL_CTX_set_mode(ctx_, SSL_MODE_HANDSHAKE_CUTTHROUGH);
}
#endif
void SSLContext::setOptions(long options) { … }
std::string SSLContext::getErrors(int errnoCopy) { … }
void SSLContext::disableTLS13() { … }
void SSLContext::setupCtx(SSL_CTX* ctx) { … }
SSLContext* SSLContext::getFromSSLCtx(const SSL_CTX* ctx) { … }
int SSLContext::newSessionCallback(SSL* ssl, SSL_SESSION* session) { … }
void SSLContext::setSessionLifecycleCallbacks(
std::unique_ptr<SessionLifecycleCallbacks> cb) { … }
void SSLContext::setCiphersuitesOrThrow(const std::string& ciphersuites) { … }
void SSLContext::setAllowNoDheKex(bool flag) { … }
void SSLContext::setTicketHandler(
std::unique_ptr<OpenSSLTicketHandler> handler) { … }
}