Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Unified Diff: components/webcrypto/algorithms/test_helpers.cc

Issue 1355873002: [refactor] More post-NSS WebCrypto cleanups (utility functions). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address David's comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/webcrypto/algorithms/test_helpers.h ('k') | components/webcrypto/algorithms/util_openssl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « components/webcrypto/algorithms/test_helpers.h ('k') | components/webcrypto/algorithms/util_openssl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698