Index: components/webcrypto/algorithms/test_helpers.cc |
diff --git a/components/webcrypto/algorithms/test_helpers.cc b/components/webcrypto/algorithms/test_helpers.cc |
index 9aa0e41769f1a6de559c034aa2619744b9d3a949..b096ac3786d6d606b2325d4c458ad8db9e28bcfc 100644 |
--- a/components/webcrypto/algorithms/test_helpers.cc |
+++ b/components/webcrypto/algorithms/test_helpers.cc |
@@ -645,4 +645,22 @@ blink::WebCryptoNamedCurve GetCurveNameFromDictionary( |
return blink::WebCryptoNamedCurveP384; |
} |
+blink::WebCryptoAlgorithm CreateHmacImportAlgorithm( |
+ blink::WebCryptoAlgorithmId hash_id, |
+ unsigned int length_bits) { |
+ DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id)); |
+ return blink::WebCryptoAlgorithm::adoptParamsAndCreate( |
+ blink::WebCryptoAlgorithmIdHmac, |
+ new blink::WebCryptoHmacImportParams(CreateAlgorithm(hash_id), true, |
+ length_bits)); |
+} |
+ |
+blink::WebCryptoAlgorithm CreateHmacImportAlgorithmNoLength( |
+ blink::WebCryptoAlgorithmId hash_id) { |
+ DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id)); |
+ return blink::WebCryptoAlgorithm::adoptParamsAndCreate( |
+ blink::WebCryptoAlgorithmIdHmac, |
+ new blink::WebCryptoHmacImportParams(CreateAlgorithm(hash_id), false, 0)); |
+} |
+ |
} // namespace webcrypto |