| 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 1ad4cb309338498d07c52fa93f28817c94c67cc6..370bdb2f81cffd0a61e99dc77ab7a1c7cdb4fcaf 100644
|
| --- a/content/child/webcrypto/nss/rsa_key_nss.cc
|
| +++ b/content/child/webcrypto/nss/rsa_key_nss.cc
|
| @@ -307,7 +307,7 @@ Status ExportKeyPkcs8Nss(SECKEYPrivateKey* key, std::vector<uint8_t>* buffer) {
|
|
|
| Status ImportRsaPrivateKey(const blink::WebCryptoAlgorithm& algorithm,
|
| bool extractable,
|
| - blink::WebCryptoKeyUsageMask usage_mask,
|
| + blink::WebCryptoKeyUsageMask usages,
|
| const JwkRsaInfo& params,
|
| blink::WebCryptoKey* key) {
|
| Status status = NssSupportsRsaPrivateKeyImport();
|
| @@ -409,7 +409,7 @@ Status ImportRsaPrivateKey(const blink::WebCryptoAlgorithm& algorithm,
|
| blink::WebCryptoKeyTypePrivate,
|
| extractable,
|
| key_algorithm,
|
| - usage_mask);
|
| + usages);
|
| return Status::Success();
|
| }
|
|
|
| @@ -425,7 +425,7 @@ Status ExportKeySpkiNss(SECKEYPublicKey* key, std::vector<uint8_t>* buffer) {
|
|
|
| Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm,
|
| bool extractable,
|
| - blink::WebCryptoKeyUsageMask usage_mask,
|
| + blink::WebCryptoKeyUsageMask usages,
|
| const CryptoData& modulus_data,
|
| const CryptoData& exponent_data,
|
| blink::WebCryptoKey* key) {
|
| @@ -500,7 +500,7 @@ Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm,
|
| blink::WebCryptoKeyTypePublic,
|
| extractable,
|
| key_algorithm,
|
| - usage_mask);
|
| + usages);
|
| return Status::Success();
|
| }
|
|
|
| @@ -509,17 +509,17 @@ Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm,
|
| Status RsaHashedAlgorithm::GenerateKey(
|
| const blink::WebCryptoAlgorithm& algorithm,
|
| bool extractable,
|
| - blink::WebCryptoKeyUsageMask combined_usage_mask,
|
| + blink::WebCryptoKeyUsageMask combined_usages,
|
| GenerateKeyResult* result) const {
|
| Status status = CheckKeyCreationUsages(
|
| - all_public_key_usages_ | all_private_key_usages_, combined_usage_mask);
|
| + all_public_key_usages_ | all_private_key_usages_, combined_usages);
|
| if (status.IsError())
|
| return status;
|
|
|
| - 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_;
|
| + const blink::WebCryptoKeyUsageMask public_usages =
|
| + combined_usages & all_public_key_usages_;
|
| + const blink::WebCryptoKeyUsageMask private_usages =
|
| + combined_usages & all_private_key_usages_;
|
|
|
| unsigned int public_exponent = 0;
|
| unsigned int modulus_length_bits = 0;
|
| @@ -590,14 +590,14 @@ Status RsaHashedAlgorithm::GenerateKey(
|
| blink::WebCryptoKeyTypePublic,
|
| true,
|
| key_algorithm,
|
| - public_usage_mask);
|
| + public_usages);
|
|
|
| blink::WebCryptoKey private_key =
|
| blink::WebCryptoKey::create(private_key_handle.release(),
|
| blink::WebCryptoKeyTypePrivate,
|
| extractable,
|
| key_algorithm,
|
| - private_usage_mask);
|
| + private_usages);
|
|
|
| result->AssignKeyPair(public_key, private_key);
|
| return Status::Success();
|
| @@ -605,15 +605,15 @@ Status RsaHashedAlgorithm::GenerateKey(
|
|
|
| Status RsaHashedAlgorithm::VerifyKeyUsagesBeforeImportKey(
|
| blink::WebCryptoKeyFormat format,
|
| - blink::WebCryptoKeyUsageMask usage_mask) const {
|
| + blink::WebCryptoKeyUsageMask usages) const {
|
| switch (format) {
|
| case blink::WebCryptoKeyFormatSpki:
|
| - return CheckKeyCreationUsages(all_public_key_usages_, usage_mask);
|
| + return CheckKeyCreationUsages(all_public_key_usages_, usages);
|
| case blink::WebCryptoKeyFormatPkcs8:
|
| - return CheckKeyCreationUsages(all_private_key_usages_, usage_mask);
|
| + return CheckKeyCreationUsages(all_private_key_usages_, usages);
|
| case blink::WebCryptoKeyFormatJwk:
|
| return CheckKeyCreationUsages(
|
| - all_public_key_usages_ | all_private_key_usages_, usage_mask);
|
| + all_public_key_usages_ | all_private_key_usages_, usages);
|
| default:
|
| return Status::ErrorUnsupportedImportKeyFormat();
|
| }
|
| @@ -623,7 +623,7 @@ Status RsaHashedAlgorithm::ImportKeyPkcs8(
|
| const CryptoData& key_data,
|
| const blink::WebCryptoAlgorithm& algorithm,
|
| bool extractable,
|
| - blink::WebCryptoKeyUsageMask usage_mask,
|
| + blink::WebCryptoKeyUsageMask usages,
|
| blink::WebCryptoKey* key) const {
|
| Status status = NssSupportsRsaPrivateKeyImport();
|
| if (status.IsError())
|
| @@ -678,7 +678,7 @@ Status RsaHashedAlgorithm::ImportKeyPkcs8(
|
| blink::WebCryptoKeyTypePrivate,
|
| extractable,
|
| key_algorithm,
|
| - usage_mask);
|
| + usages);
|
|
|
| return Status::Success();
|
| }
|
| @@ -687,7 +687,7 @@ Status RsaHashedAlgorithm::ImportKeySpki(
|
| const CryptoData& key_data,
|
| const blink::WebCryptoAlgorithm& algorithm,
|
| bool extractable,
|
| - blink::WebCryptoKeyUsageMask usage_mask,
|
| + blink::WebCryptoKeyUsageMask usages,
|
| blink::WebCryptoKey* key) const {
|
| if (!key_data.byte_length())
|
| return Status::ErrorImportEmptyKeyData();
|
| @@ -731,7 +731,7 @@ Status RsaHashedAlgorithm::ImportKeySpki(
|
| blink::WebCryptoKeyTypePublic,
|
| extractable,
|
| key_algorithm,
|
| - usage_mask);
|
| + usages);
|
|
|
| return Status::Success();
|
| }
|
| @@ -756,7 +756,7 @@ Status RsaHashedAlgorithm::ImportKeyJwk(
|
| const CryptoData& key_data,
|
| const blink::WebCryptoAlgorithm& algorithm,
|
| bool extractable,
|
| - blink::WebCryptoKeyUsageMask usage_mask,
|
| + blink::WebCryptoKeyUsageMask usages,
|
| blink::WebCryptoKey* key) const {
|
| const char* jwk_algorithm =
|
| GetJwkAlgorithm(algorithm.rsaHashedImportParams()->hash().id());
|
| @@ -766,22 +766,22 @@ Status RsaHashedAlgorithm::ImportKeyJwk(
|
|
|
| JwkRsaInfo jwk;
|
| Status status =
|
| - ReadRsaKeyJwk(key_data, jwk_algorithm, extractable, usage_mask, &jwk);
|
| + ReadRsaKeyJwk(key_data, jwk_algorithm, extractable, usages, &jwk);
|
| if (status.IsError())
|
| return status;
|
|
|
| // Once the key type is known, verify the usages.
|
| status = CheckKeyCreationUsages(
|
| jwk.is_private_key ? all_private_key_usages_ : all_public_key_usages_,
|
| - usage_mask);
|
| + usages);
|
| if (status.IsError())
|
| return Status::ErrorCreateKeyBadUsages();
|
|
|
| return jwk.is_private_key
|
| - ? ImportRsaPrivateKey(algorithm, extractable, usage_mask, jwk, key)
|
| + ? ImportRsaPrivateKey(algorithm, extractable, usages, jwk, key)
|
| : ImportRsaPublicKey(algorithm,
|
| extractable,
|
| - usage_mask,
|
| + usages,
|
| CryptoData(jwk.n),
|
| CryptoData(jwk.e),
|
| key);
|
|
|