Index: content/child/webcrypto/webcrypto_util.cc |
diff --git a/content/child/webcrypto/webcrypto_util.cc b/content/child/webcrypto/webcrypto_util.cc |
index 537e551f0363bd39a316405e86ddf1c6822deed4..5e5fc8e4c3d2b7857e438bdb0c32e5af6f59f2f0 100644 |
--- a/content/child/webcrypto/webcrypto_util.cc |
+++ b/content/child/webcrypto/webcrypto_util.cc |
@@ -340,20 +340,26 @@ blink::WebCryptoAlgorithm CreateHmacImportAlgorithm( |
new blink::WebCryptoHmacImportParams(CreateAlgorithm(hash_id))); |
} |
-blink::WebCryptoAlgorithm CreateRsaSsaImportAlgorithm( |
+blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( |
+ blink::WebCryptoAlgorithmId id, |
blink::WebCryptoAlgorithmId hash_id) { |
DCHECK(IsHashAlgorithm(hash_id)); |
+ DCHECK(id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 || |
+ id == blink::WebCryptoAlgorithmIdRsaOaep); |
return blink::WebCryptoAlgorithm::adoptParamsAndCreate( |
- blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
- new blink::WebCryptoRsaHashedImportParams(CreateAlgorithm(hash_id))); |
+ id, new blink::WebCryptoRsaHashedImportParams(CreateAlgorithm(hash_id))); |
+} |
+ |
+blink::WebCryptoAlgorithm CreateRsaSsaImportAlgorithm( |
+ blink::WebCryptoAlgorithmId hash_id) { |
+ return CreateRsaHashedImportAlgorithm( |
+ blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, hash_id); |
} |
blink::WebCryptoAlgorithm CreateRsaOaepImportAlgorithm( |
blink::WebCryptoAlgorithmId hash_id) { |
- DCHECK(IsHashAlgorithm(hash_id)); |
- return blink::WebCryptoAlgorithm::adoptParamsAndCreate( |
- blink::WebCryptoAlgorithmIdRsaOaep, |
- new blink::WebCryptoRsaHashedImportParams(CreateAlgorithm(hash_id))); |
+ return CreateRsaHashedImportAlgorithm(blink::WebCryptoAlgorithmIdRsaOaep, |
+ hash_id); |
} |
unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id) { |