Chromium Code Reviews| Index: content/child/webcrypto/jwk.cc |
| diff --git a/content/child/webcrypto/jwk.cc b/content/child/webcrypto/jwk.cc |
| index 6defa3184304117e4d2d86ddcaa664cabfba2162..2601323696255909def76883948e3de6bf5365cc 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() == |
|
eroman
2014/03/18 06:18:39
I am not sure that I understand the change made he
padolph
2014/03/18 17:52:19
Without this change the RsaEsJwkSymkeyWrapUnwrapRo
eroman
2014/03/19 04:04:00
I see thanks for explaining.
That sounds like a p
|
| + 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 |
| @@ -391,9 +396,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. |