Index: content/child/webcrypto/openssl/hmac_openssl.cc |
diff --git a/content/child/webcrypto/openssl/hmac_openssl.cc b/content/child/webcrypto/openssl/hmac_openssl.cc |
index 76f63c3236818e539f11baed09808b6cbd6fb484..73f0d4d2f9b62221cba8d5462e1d898c2c3c5a94 100644 |
--- a/content/child/webcrypto/openssl/hmac_openssl.cc |
+++ b/content/child/webcrypto/openssl/hmac_openssl.cc |
@@ -105,6 +105,9 @@ class HmacImplementation : public AlgorithmImplementation { |
bool extractable, |
blink::WebCryptoKeyUsageMask usages, |
blink::WebCryptoKey* key) const override { |
+ if (usages == 0) |
+ return ErrorImportKeyEmptyUsages(); |
+ |
const blink::WebCryptoAlgorithm& hash = |
algorithm.hmacImportParams()->hash(); |
@@ -125,6 +128,9 @@ class HmacImplementation : public AlgorithmImplementation { |
bool extractable, |
blink::WebCryptoKeyUsageMask usages, |
blink::WebCryptoKey* key) const override { |
+ if (usages == 0) |
+ return ErrorImportKeyEmptyUsages(); |
+ |
const char* algorithm_name = |
GetJwkHmacAlgorithmName(algorithm.hmacImportParams()->hash().id()); |
if (!algorithm_name) |