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

Unified Diff: content/child/webcrypto/openssl/hmac_openssl.cc

Issue 512023002: Refactor the interface for generating keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run git-cl format Created 6 years, 2 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
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 c7b4b37686834578726b7a1e2363d61f47dd82dd..f618501c02b7cbecacf676bb4cb9fde31d0d1ac7 100644
--- a/content/child/webcrypto/openssl/hmac_openssl.cc
+++ b/content/child/webcrypto/openssl/hmac_openssl.cc
@@ -70,15 +70,19 @@ class HmacImplementation : public AlgorithmImplementation {
public:
HmacImplementation() {}
- virtual Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usage_mask,
- blink::WebCryptoKey* key) const override {
+ virtual Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
+ bool extractable,
+ blink::WebCryptoKeyUsageMask usage_mask,
+ GenerateKeyResult* result) const override {
+ Status status = CheckKeyCreationUsages(kAllKeyUsages, usage_mask);
+ if (status.IsError())
+ return status;
+
const blink::WebCryptoHmacKeyGenParams* params =
algorithm.hmacKeyGenParams();
unsigned int keylen_bits = 0;
- Status status = GetHmacKeyGenLengthInBits(params, &keylen_bits);
+ status = GetHmacKeyGenLengthInBits(params, &keylen_bits);
if (status.IsError())
return status;
@@ -87,7 +91,7 @@ class HmacImplementation : public AlgorithmImplementation {
extractable,
usage_mask,
keylen_bits / 8,
- key);
+ result);
}
virtual Status VerifyKeyUsagesBeforeImportKey(
@@ -102,11 +106,6 @@ class HmacImplementation : public AlgorithmImplementation {
}
}
- virtual Status VerifyKeyUsagesBeforeGenerateKey(
- blink::WebCryptoKeyUsageMask usage_mask) const override {
- return CheckKeyCreationUsages(kAllKeyUsages, usage_mask);
- }
-
virtual Status ImportKeyRaw(const CryptoData& key_data,
const blink::WebCryptoAlgorithm& algorithm,
bool extractable,
« no previous file with comments | « content/child/webcrypto/openssl/aes_key_openssl.cc ('k') | content/child/webcrypto/openssl/rsa_key_openssl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698