| Index: components/webcrypto/algorithms/hkdf.cc
|
| diff --git a/components/webcrypto/algorithms/hkdf.cc b/components/webcrypto/algorithms/hkdf.cc
|
| index bc10c35bc8a80f15f01011c0d8ef58f2e97a22d5..6b22d248989e80e826fef5170d1a37f8f05d57e6 100644
|
| --- a/components/webcrypto/algorithms/hkdf.cc
|
| +++ b/components/webcrypto/algorithms/hkdf.cc
|
| @@ -29,19 +29,29 @@ class HkdfImplementation : public AlgorithmImplementation {
|
| public:
|
| HkdfImplementation() {}
|
|
|
| - Status VerifyKeyUsagesBeforeImportKey(
|
| - blink::WebCryptoKeyFormat format,
|
| - blink::WebCryptoKeyUsageMask usages) const override {
|
| - if (format != blink::WebCryptoKeyFormatRaw)
|
| - return Status::ErrorUnsupportedImportKeyFormat();
|
| - return CheckSecretKeyCreationUsages(kValidUsages, usages);
|
| + Status ImportKey(blink::WebCryptoKeyFormat format,
|
| + const CryptoData& key_data,
|
| + const blink::WebCryptoAlgorithm& algorithm,
|
| + bool extractable,
|
| + blink::WebCryptoKeyUsageMask usages,
|
| + blink::WebCryptoKey* key) const override {
|
| + switch (format) {
|
| + case blink::WebCryptoKeyFormatRaw:
|
| + return ImportKeyRaw(key_data, algorithm, extractable, usages, key);
|
| + default:
|
| + return Status::ErrorUnsupportedImportKeyFormat();
|
| + }
|
| }
|
|
|
| Status ImportKeyRaw(const CryptoData& key_data,
|
| const blink::WebCryptoAlgorithm& algorithm,
|
| bool extractable,
|
| blink::WebCryptoKeyUsageMask usages,
|
| - blink::WebCryptoKey* key) const override {
|
| + blink::WebCryptoKey* key) const {
|
| + Status status = CheckKeyCreationUsages(kValidUsages, usages);
|
| + if (status.IsError())
|
| + return status;
|
| +
|
| return CreateWebCryptoSecretKey(
|
| key_data, blink::WebCryptoKeyAlgorithm::createWithoutParams(
|
| blink::WebCryptoAlgorithmIdHkdf),
|
|
|