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

Unified Diff: 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: c Created 9 years, 7 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: crypto/symmetric_key_nss.cc
diff --git a/crypto/symmetric_key_nss.cc b/crypto/symmetric_key_nss.cc
index 9690265c8c7613c76329c9b81d56b392a7cea806..c84c2839bb484340f784ed020831f0feebd75ad0 100644
--- a/crypto/symmetric_key_nss.cc
+++ b/crypto/symmetric_key_nss.cc
@@ -15,6 +15,12 @@ namespace crypto {
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