| Index: content/child/webcrypto/jwk.cc
|
| diff --git a/content/child/webcrypto/jwk.cc b/content/child/webcrypto/jwk.cc
|
| index a540c025eede6ed328e7d45d5b152fb0537ea30d..70529e407fe89223093aa1c4a9969b6045e64977 100644
|
| --- a/content/child/webcrypto/jwk.cc
|
| +++ b/content/child/webcrypto/jwk.cc
|
| @@ -165,20 +165,25 @@ bool ImportAlgorithmsConsistent(const blink::WebCryptoAlgorithm& alg1,
|
| DCHECK(!alg2.isNull());
|
| if (alg1.id() != alg2.id())
|
| return false;
|
| - if (alg1.paramsType() != alg2.paramsType())
|
| - return false;
|
| - switch (alg1.paramsType()) {
|
| - case blink::WebCryptoAlgorithmParamsTypeNone:
|
| - return true;
|
| - case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams:
|
| - return ImportAlgorithmsConsistent(alg1.rsaHashedImportParams()->hash(),
|
| - alg2.rsaHashedImportParams()->hash());
|
| - case blink::WebCryptoAlgorithmParamsTypeHmacImportParams:
|
| - return ImportAlgorithmsConsistent(alg1.hmacImportParams()->hash(),
|
| - alg2.hmacImportParams()->hash());
|
| - default:
|
| + // Inner hash algorithms must be compared too, but only if present.
|
| + if (alg1.paramsType() ==
|
| + blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams ||
|
| + alg1.paramsType() ==
|
| + blink::WebCryptoAlgorithmParamsTypeHmacImportParams) {
|
| + if (alg1.paramsType() != alg2.paramsType())
|
| return false;
|
| + switch (alg1.paramsType()) {
|
| + case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams:
|
| + return ImportAlgorithmsConsistent(alg1.rsaHashedImportParams()->hash(),
|
| + alg2.rsaHashedImportParams()->hash());
|
| + case blink::WebCryptoAlgorithmParamsTypeHmacImportParams:
|
| + return ImportAlgorithmsConsistent(alg1.hmacImportParams()->hash(),
|
| + alg2.hmacImportParams()->hash());
|
| + default:
|
| + return false;
|
| + }
|
| }
|
| + return true;
|
| }
|
|
|
| // Extracts the required string property with key |path| from |dict| and saves
|
| @@ -388,9 +393,6 @@ Status ImportKeyJwk(const CryptoData& key_data,
|
| // TODO(padolph): Generalize this comment to include export, and move to top
|
| // of file.
|
|
|
| - // TODO(padolph): Generalize this comment to include export, and move to top
|
| - // of file.
|
| -
|
| // The goal of this method is to extract key material and meta data from the
|
| // incoming JWK, combine them with the input parameters, and ultimately import
|
| // a Web Crypto Key.
|
|
|