Update talk to 59039880.

R=mallinath@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/6569004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5339 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org
2014-01-03 22:08:47 +00:00
parent e667234ee2
commit f6d6ed0c66
38 changed files with 975 additions and 354 deletions

View File

@@ -29,6 +29,7 @@
#include <limits>
#if defined(FEATURE_ENABLE_SSL)
#include "talk/base/sslconfig.h"
#if defined(SSL_USE_OPENSSL)
#include <openssl/rand.h>
@@ -40,7 +41,8 @@
#include <windows.h>
#include <ntsecapi.h>
#endif // WIN32
#endif
#endif // else
#endif // FEATURE_ENABLED_SSL
#include "talk/base/base64.h"
#include "talk/base/basictypes.h"
@@ -153,6 +155,28 @@ class SecureRandomGenerator : public RandomGenerator {
RtlGenRandomProc rtl_gen_random_;
};
#elif !defined(FEATURE_ENABLE_SSL)
// No SSL implementation -- use rand()
class SecureRandomGenerator : public RandomGenerator {
public:
virtual bool Init(const void* seed, size_t len) {
if (len >= 4) {
srand(*reinterpret_cast<const int*>(seed));
} else {
srand(*reinterpret_cast<const char*>(seed));
}
return true;
}
virtual bool Generate(void* buf, size_t len) {
char* bytes = reinterpret_cast<char*>(buf);
for (size_t i = 0; i < len; ++i) {
bytes[i] = static_cast<char>(rand());
}
return true;
}
};
#else
#error No SSL implementation has been selected!