#include <folly/Format.h>
#include <folly/Memory.h>
#include <folly/Format.h>
#include <folly/Memory.h>
+#include <folly/Random.h>
#include <folly/SpinLock.h>
// ---------------------------------------------------------------------
#include <folly/SpinLock.h>
// ---------------------------------------------------------------------
SSL_CTX_set_tlsext_servername_callback(ctx_, baseServerNameOpenSSLCallback);
SSL_CTX_set_tlsext_servername_arg(ctx_, this);
#endif
SSL_CTX_set_tlsext_servername_callback(ctx_, baseServerNameOpenSSLCallback);
SSL_CTX_set_tlsext_servername_arg(ctx_, this);
#endif
-
- Random::seed(randomGenerator_);
}
SSLContext::~SSLContext() {
}
SSLContext::~SSLContext() {
cipherListPicker_.reset(
new std::discrete_distribution<int>(weights.begin(), weights.end()));
}
cipherListPicker_.reset(
new std::discrete_distribution<int>(weights.begin(), weights.end()));
}
- auto index = (*cipherListPicker_)(randomGenerator_);
+ auto rng = ThreadLocalPRNG();
+ auto index = (*cipherListPicker_)(rng);
if ((size_t)index >= tls11AltCipherlist.size()) {
LOG(ERROR) << "Trying to pick alt TLS11 cipher index " << index
<< ", but tls11AltCipherlist is of length "
if ((size_t)index >= tls11AltCipherlist.size()) {
LOG(ERROR) << "Trying to pick alt TLS11 cipher index " << index
<< ", but tls11AltCipherlist is of length "
size_t SSLContext::pickNextProtocols() {
CHECK(!advertisedNextProtocols_.empty()) << "Failed to pickNextProtocols";
size_t SSLContext::pickNextProtocols() {
CHECK(!advertisedNextProtocols_.empty()) << "Failed to pickNextProtocols";
- return nextProtocolDistribution_(randomGenerator_);
+ auto rng = ThreadLocalPRNG();
+ return nextProtocolDistribution_(rng);
}
int SSLContext::advertisedNextProtocolCallback(SSL* ssl,
}
int SSLContext::advertisedNextProtocolCallback(SSL* ssl,
#include <folly/folly-config.h>
#endif
#include <folly/folly-config.h>
#endif
-#include <folly/Random.h>
#include <folly/Range.h>
#include <folly/io/async/ssl/OpenSSLPtrTypes.h>
#include <folly/io/async/ssl/OpenSSLUtils.h>
#include <folly/Range.h>
#include <folly/io/async/ssl/OpenSSLPtrTypes.h>
#include <folly/io/async/ssl/OpenSSLUtils.h>
static bool initialized_;
static bool initialized_;
- // Used in randomized next-proto pick / randomized cipherlist
- Random::DefaultGenerator randomGenerator_;
// To provide control over choice of server ciphersuites
std::unique_ptr<std::discrete_distribution<int>> cipherListPicker_;
// To provide control over choice of server ciphersuites
std::unique_ptr<std::discrete_distribution<int>> cipherListPicker_;