Index: content/child/webcrypto/nss/hmac_nss.cc |
diff --git a/content/child/webcrypto/nss/hmac_nss.cc b/content/child/webcrypto/nss/hmac_nss.cc |
index bb146d4977708f8572ecee0207d3643629bb3749..f72b3d9d2bb416693210655cef3078690513f15c 100644 |
--- a/content/child/webcrypto/nss/hmac_nss.cc |
+++ b/content/child/webcrypto/nss/hmac_nss.cc |
@@ -98,6 +98,9 @@ class HmacImplementation : public AlgorithmImplementation { |
bool extractable, |
blink::WebCryptoKeyUsageMask usages, |
blink::WebCryptoKey* key) const override { |
+ if (usages == 0) |
+ return Status::ErrorImportKeyEmptyUsages(); |
+ |
const blink::WebCryptoAlgorithm& hash = |
algorithm.hmacImportParams()->hash(); |
@@ -122,6 +125,9 @@ class HmacImplementation : public AlgorithmImplementation { |
bool extractable, |
blink::WebCryptoKeyUsageMask usages, |
blink::WebCryptoKey* key) const override { |
+ if (usages == 0) |
+ return Status::ErrorImportKeyEmptyUsages(); |
+ |
const char* algorithm_name = |
GetJwkHmacAlgorithmName(algorithm.hmacImportParams()->hash().id()); |
if (!algorithm_name) |