Fix WebRTC Win64 + BoringSSL build.
There were many size_t to int conversions. RAND_poll and RAND_seed no longer do
anything in BoringSSL, so fix that one by removing it. Use a checked_cast for
the remaining ones.
BUG=chromium:429039
R=henrike@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/28909004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7655 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/base/helpers.cc b/webrtc/base/helpers.cc
index 8b14cdf..84d1c93 100644
--- a/webrtc/base/helpers.cc
+++ b/webrtc/base/helpers.cc
@@ -47,36 +47,17 @@
};
#if defined(SSL_USE_OPENSSL)
-// The OpenSSL RNG. Need to make sure it doesn't run out of entropy.
+// The OpenSSL RNG.
class SecureRandomGenerator : public RandomGenerator {
public:
- SecureRandomGenerator() : inited_(false) {
- }
- ~SecureRandomGenerator() {
- }
+ SecureRandomGenerator() {}
+ ~SecureRandomGenerator() {}
virtual bool Init(const void* seed, size_t len) {
- // By default, seed from the system state.
- if (!inited_) {
- if (RAND_poll() <= 0) {
- return false;
- }
- inited_ = true;
- }
- // Allow app data to be mixed in, if provided.
- if (seed) {
- RAND_seed(seed, len);
- }
return true;
}
virtual bool Generate(void* buf, size_t len) {
- if (!inited_ && !Init(NULL, 0)) {
- return false;
- }
return (RAND_bytes(reinterpret_cast<unsigned char*>(buf), len) > 0);
}
-
- private:
- bool inited_;
};
#elif defined(SSL_USE_NSS_RNG)