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

Unified Diff: content/child/webcrypto/nss/rsa_key_nss.cc

Issue 512023002: Refactor the interface for generating keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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: content/child/webcrypto/nss/rsa_key_nss.cc
diff --git a/content/child/webcrypto/nss/rsa_key_nss.cc b/content/child/webcrypto/nss/rsa_key_nss.cc
index 99c32bc3d336f681c2f98a225a022b25787729a3..90d0a3063529434fde1dc4cbad86db1880ae7dc2 100644
--- a/content/child/webcrypto/nss/rsa_key_nss.cc
+++ b/content/child/webcrypto/nss/rsa_key_nss.cc
@@ -532,33 +532,27 @@ Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm,
} // namespace
-Status RsaHashedAlgorithm::VerifyKeyUsagesBeforeGenerateKeyPair(
+Status RsaHashedAlgorithm::GenerateKey(
+ const blink::WebCryptoAlgorithm& algorithm,
+ bool extractable,
blink::WebCryptoKeyUsageMask combined_usage_mask,
- blink::WebCryptoKeyUsageMask* public_usage_mask,
- blink::WebCryptoKeyUsageMask* private_usage_mask) const {
+ blink::WebCryptoKey* public_key,
+ blink::WebCryptoKey* private_key) const {
Status status = CheckKeyCreationUsages(
all_public_key_usages_ | all_private_key_usages_, combined_usage_mask);
if (status.IsError())
return status;
- *public_usage_mask = combined_usage_mask & all_public_key_usages_;
- *private_usage_mask = combined_usage_mask & all_private_key_usages_;
+ const blink::WebCryptoKeyUsageMask public_usage_mask =
+ combined_usage_mask & all_public_key_usages_;
+ const blink::WebCryptoKeyUsageMask private_usage_mask =
+ combined_usage_mask & all_private_key_usages_;
- return Status::Success();
-}
-
-Status RsaHashedAlgorithm::GenerateKeyPair(
- const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask public_usage_mask,
- blink::WebCryptoKeyUsageMask private_usage_mask,
- blink::WebCryptoKey* public_key,
- blink::WebCryptoKey* private_key) const {
unsigned int public_exponent = 0;
unsigned int modulus_length_bits = 0;
- Status status = GetRsaKeyGenParameters(algorithm.rsaHashedKeyGenParams(),
- &public_exponent,
- &modulus_length_bits);
+ status = GetRsaKeyGenParameters(algorithm.rsaHashedKeyGenParams(),
+ &public_exponent,
+ &modulus_length_bits);
if (status.IsError())
return status;

Powered by Google App Engine
This is Rietveld 408576698