summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-25 04:11:06 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-25 04:11:06 +0000
commit2ade8a8a544e155dac374e35a8fd1440104fa45a (patch)
tree5977c092691cbcdb6d0606023c59115f7b9c3b82
parentd623b65cc3db23bb032725b1d1c0cca14ecb5c86 (diff)
downloadchromium_src-2ade8a8a544e155dac374e35a8fd1440104fa45a.zip
chromium_src-2ade8a8a544e155dac374e35a8fd1440104fa45a.tar.gz
chromium_src-2ade8a8a544e155dac374e35a8fd1440104fa45a.tar.bz2
[webcrypto] Refactor to use WebCryptoKeyAlgorithm create* functions.
BUG=245025 Review URL: https://codereview.chromium.org/210583003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259143 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/child/webcrypto/platform_crypto_nss.cc20
-rw-r--r--content/child/webcrypto/webcrypto_util.cc10
2 files changed, 13 insertions, 17 deletions
diff --git a/content/child/webcrypto/platform_crypto_nss.cc b/content/child/webcrypto/platform_crypto_nss.cc
index 5192cf4..a9387e7 100644
--- a/content/child/webcrypto/platform_crypto_nss.cc
+++ b/content/child/webcrypto/platform_crypto_nss.cc
@@ -414,22 +414,20 @@ bool CreatePublicKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm,
switch (algorithm.paramsType()) {
case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams:
case blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams:
- *key_algorithm = blink::WebCryptoKeyAlgorithm::adoptParamsAndCreate(
+ *key_algorithm = blink::WebCryptoKeyAlgorithm::createRsaHashed(
algorithm.id(),
- new blink::WebCryptoRsaHashedKeyAlgorithmParams(
- modulus_length_bits,
- public_exponent.bytes(),
- public_exponent.byte_length(),
- GetInnerHashAlgorithm(algorithm)));
+ modulus_length_bits,
+ public_exponent.bytes(),
+ public_exponent.byte_length(),
+ GetInnerHashAlgorithm(algorithm).id());
return true;
case blink::WebCryptoAlgorithmParamsTypeRsaKeyGenParams:
case blink::WebCryptoAlgorithmParamsTypeNone:
- *key_algorithm = blink::WebCryptoKeyAlgorithm::adoptParamsAndCreate(
+ *key_algorithm = blink::WebCryptoKeyAlgorithm::createRsa(
algorithm.id(),
- new blink::WebCryptoRsaKeyAlgorithmParams(
- modulus_length_bits,
- public_exponent.bytes(),
- public_exponent.byte_length()));
+ modulus_length_bits,
+ public_exponent.bytes(),
+ public_exponent.byte_length());
return true;
default:
return false;
diff --git a/content/child/webcrypto/webcrypto_util.cc b/content/child/webcrypto/webcrypto_util.cc
index 294c4b2..d7326f9 100644
--- a/content/child/webcrypto/webcrypto_util.cc
+++ b/content/child/webcrypto/webcrypto_util.cc
@@ -205,18 +205,16 @@ bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm,
return false;
if (keylen_bytes > UINT_MAX / 8)
return false;
- *key_algorithm = blink::WebCryptoKeyAlgorithm::adoptParamsAndCreate(
- algorithm.id(),
- new blink::WebCryptoHmacKeyAlgorithmParams(hash, keylen_bytes * 8));
+ *key_algorithm =
+ blink::WebCryptoKeyAlgorithm::createHmac(hash.id(), keylen_bytes * 8);
return true;
}
case blink::WebCryptoAlgorithmIdAesKw:
case blink::WebCryptoAlgorithmIdAesCbc:
case blink::WebCryptoAlgorithmIdAesCtr:
case blink::WebCryptoAlgorithmIdAesGcm:
- *key_algorithm = blink::WebCryptoKeyAlgorithm::adoptParamsAndCreate(
- algorithm.id(),
- new blink::WebCryptoAesKeyAlgorithmParams(keylen_bytes * 8));
+ *key_algorithm = blink::WebCryptoKeyAlgorithm::createAes(
+ algorithm.id(), keylen_bytes * 8);
return true;
default:
return false;