Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2999)

Unified Diff: base/crypto/symmetric_key_nss.cc

Issue 6683060: Private API for extensions like ssh-client that need access to TCP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sigh-nedness Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698