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

Unified Diff: content/child/webcrypto/openssl/sym_key_openssl.cc

Issue 512023002: Refactor the interface for generating keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run git-cl format Created 6 years, 2 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
« no previous file with comments | « content/child/webcrypto/openssl/sym_key_openssl.h ('k') | content/child/webcrypto/test/test_helpers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/openssl/sym_key_openssl.cc
diff --git a/content/child/webcrypto/openssl/sym_key_openssl.cc b/content/child/webcrypto/openssl/sym_key_openssl.cc
index e07db69ee7f3f6e96feb5cdcfe34913da8f0f908..e03cc588718fad857dbd076f4bbd31b6cfbd82ad 100644
--- a/content/child/webcrypto/openssl/sym_key_openssl.cc
+++ b/content/child/webcrypto/openssl/sym_key_openssl.cc
@@ -8,6 +8,7 @@
#include <openssl/rand.h>
#include "content/child/webcrypto/crypto_data.h"
+#include "content/child/webcrypto/generate_key_result.h"
#include "content/child/webcrypto/openssl/key_openssl.h"
#include "content/child/webcrypto/status.h"
#include "crypto/openssl_util.h"
@@ -21,7 +22,7 @@ Status GenerateSecretKeyOpenSsl(const blink::WebCryptoKeyAlgorithm& algorithm,
bool extractable,
blink::WebCryptoKeyUsageMask usage_mask,
unsigned keylen_bytes,
- blink::WebCryptoKey* key) {
+ GenerateKeyResult* result) {
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
std::vector<unsigned char> random_bytes(keylen_bytes, 0);
@@ -31,12 +32,13 @@ Status GenerateSecretKeyOpenSsl(const blink::WebCryptoKeyAlgorithm& algorithm,
return Status::OperationError();
}
- *key =
+ result->AssignSecretKey(
blink::WebCryptoKey::create(new SymKeyOpenSsl(CryptoData(random_bytes)),
blink::WebCryptoKeyTypeSecret,
extractable,
algorithm,
- usage_mask);
+ usage_mask));
+
return Status::Success();
}
« no previous file with comments | « content/child/webcrypto/openssl/sym_key_openssl.h ('k') | content/child/webcrypto/test/test_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698