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

Unified Diff: content/child/webcrypto/nss/aes_key_nss.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/nss/aes_key_nss.h ('k') | content/child/webcrypto/nss/hmac_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/nss/aes_key_nss.cc
diff --git a/content/child/webcrypto/nss/aes_key_nss.cc b/content/child/webcrypto/nss/aes_key_nss.cc
index a4a742a1d2c0745ca8fb091c5b2336604f5be15c..dda4d6bd89b8739f226dfb0784c947e240edc509 100644
--- a/content/child/webcrypto/nss/aes_key_nss.cc
+++ b/content/child/webcrypto/nss/aes_key_nss.cc
@@ -38,19 +38,16 @@ AesAlgorithm::AesAlgorithm(CK_MECHANISM_TYPE import_mechanism,
jwk_suffix_(jwk_suffix) {
}
-Status AesAlgorithm::VerifyKeyUsagesBeforeGenerateKey(
- blink::WebCryptoKeyUsageMask usage_mask) const {
- return CheckKeyCreationUsages(all_key_usages_, usage_mask);
-}
+Status AesAlgorithm::GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
+ bool extractable,
+ blink::WebCryptoKeyUsageMask usage_mask,
+ GenerateKeyResult* result) const {
+ Status status = CheckKeyCreationUsages(all_key_usages_, usage_mask);
+ if (status.IsError())
+ return status;
-Status AesAlgorithm::GenerateSecretKey(
- const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usage_mask,
- blink::WebCryptoKey* key) const {
unsigned int keylen_bits;
- Status status =
- GetAesKeyGenLengthInBits(algorithm.aesKeyGenParams(), &keylen_bits);
+ status = GetAesKeyGenLengthInBits(algorithm.aesKeyGenParams(), &keylen_bits);
if (status.IsError())
return status;
@@ -60,7 +57,7 @@ Status AesAlgorithm::GenerateSecretKey(
usage_mask,
keylen_bits / 8,
CKM_AES_KEY_GEN,
- key);
+ result);
}
Status AesAlgorithm::VerifyKeyUsagesBeforeImportKey(
« no previous file with comments | « content/child/webcrypto/nss/aes_key_nss.h ('k') | content/child/webcrypto/nss/hmac_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698