diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 04:11:06 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 04:11:06 +0000 |
commit | 2ade8a8a544e155dac374e35a8fd1440104fa45a (patch) | |
tree | 5977c092691cbcdb6d0606023c59115f7b9c3b82 /content/child/webcrypto | |
parent | d623b65cc3db23bb032725b1d1c0cca14ecb5c86 (diff) | |
download | chromium_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
Diffstat (limited to 'content/child/webcrypto')
-rw-r--r-- | content/child/webcrypto/platform_crypto_nss.cc | 20 | ||||
-rw-r--r-- | content/child/webcrypto/webcrypto_util.cc | 10 |
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; |