Index: base/crypto/symmetric_key_nss.cc |
diff --git a/base/crypto/symmetric_key_nss.cc b/base/crypto/symmetric_key_nss.cc |
index 1e3551d32ed75fc80132b1880b80facef44daad8..819eadcd459bc9b2d9539482b879f090b96588f6 100644 |
--- a/base/crypto/symmetric_key_nss.cc |
+++ b/base/crypto/symmetric_key_nss.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -15,6 +15,12 @@ namespace base { |
SymmetricKey::~SymmetricKey() {} |
// static |
+bool SymmetricKey::GenerateRandomBytes(size_t num_bytes, uint8* out) { |
+ return num_bytes == 0 || |
+ (out == NULL && PK11_GenerateRandom(out, num_bytes) == SECSuccess); |
+} |
+ |
+// static |
SymmetricKey* SymmetricKey::GenerateRandomKey(Algorithm algorithm, |
size_t key_size_in_bits) { |
DCHECK_EQ(AES, algorithm); |