| Index: base/crypto/symmetric_key_win.cc
|
| diff --git a/base/crypto/symmetric_key_win.cc b/base/crypto/symmetric_key_win.cc
|
| index 0a1c234a4b585249803949802dd47863961a6367..d36dd1f769fbe4251a7adfe84b029c060af4ee90 100644
|
| --- a/base/crypto/symmetric_key_win.cc
|
| +++ b/base/crypto/symmetric_key_win.cc
|
| @@ -312,6 +312,26 @@ SymmetricKey::~SymmetricKey() {
|
| }
|
|
|
| // static
|
| +bool SymmetricKey::GenerateRandomBytes(size_t num_bytes, uint8* out) {
|
| + if (num_bytes == 0)
|
| + return true;
|
| + if (out == NULL)
|
| + return false;
|
| +
|
| + ScopedHCRYPTPROV provider;
|
| + // See comment in GenerateAESKey as to why NULL is acceptable for the
|
| + // container name.
|
| + if (!CryptAcquireContext(
|
| + provider.receive(), NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
|
| + return false;
|
| + }
|
| + if (CryptGenRandom(provider, num_bytes, out))
|
| + return true;
|
| + else
|
| + return false;
|
| +}
|
| +
|
| +// static
|
| SymmetricKey* SymmetricKey::GenerateRandomKey(Algorithm algorithm,
|
| size_t key_size_in_bits) {
|
| DCHECK_GE(key_size_in_bits, 8);
|
|
|