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

Unified Diff: content/child/webcrypto/openssl/rsa_key_openssl.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/openssl/rsa_key_openssl.cc
diff --git a/content/child/webcrypto/openssl/rsa_key_openssl.cc b/content/child/webcrypto/openssl/rsa_key_openssl.cc
index cd8197aa86177952c96c873874fefd655ad3aa3a..52673f2d3c00184c9b1971d9e3182b09ed412864 100644
--- a/content/child/webcrypto/openssl/rsa_key_openssl.cc
+++ b/content/child/webcrypto/openssl/rsa_key_openssl.cc
@@ -228,34 +228,28 @@ 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_;
-
- return Status::Success();
-}
+ 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_;
-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 {
const blink::WebCryptoRsaHashedKeyGenParams* params =
algorithm.rsaHashedKeyGenParams();
unsigned int public_exponent = 0;
unsigned int modulus_length_bits = 0;
- Status status =
+ status =
GetRsaKeyGenParameters(params, &public_exponent, &modulus_length_bits);
if (status.IsError())
return status;

Powered by Google App Engine
This is Rietveld 408576698