Commit 0bf8178f authored by eroman@chromium.org's avatar eroman@chromium.org

[refactor] Remove IsHashAlgorithm() function.

BUG=245025

Review URL: https://codereview.chromium.org/274863003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270204 0039d316-1c4b-4281-b951-d872f2087c98
parent 17ec4f03
...@@ -126,7 +126,7 @@ blink::WebCryptoAlgorithm CreateRsaHashedKeyGenAlgorithm( ...@@ -126,7 +126,7 @@ blink::WebCryptoAlgorithm CreateRsaHashedKeyGenAlgorithm(
const std::vector<uint8>& public_exponent) { const std::vector<uint8>& public_exponent) {
DCHECK(algorithm_id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 || DCHECK(algorithm_id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 ||
algorithm_id == blink::WebCryptoAlgorithmIdRsaOaep); algorithm_id == blink::WebCryptoAlgorithmIdRsaOaep);
DCHECK(IsHashAlgorithm(hash_id)); DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id));
return blink::WebCryptoAlgorithm::adoptParamsAndCreate( return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
algorithm_id, algorithm_id,
new blink::WebCryptoRsaHashedKeyGenParams( new blink::WebCryptoRsaHashedKeyGenParams(
...@@ -166,7 +166,7 @@ blink::WebCryptoAlgorithm CreateAesGcmAlgorithm( ...@@ -166,7 +166,7 @@ blink::WebCryptoAlgorithm CreateAesGcmAlgorithm(
blink::WebCryptoAlgorithm CreateHmacKeyGenAlgorithm( blink::WebCryptoAlgorithm CreateHmacKeyGenAlgorithm(
blink::WebCryptoAlgorithmId hash_id, blink::WebCryptoAlgorithmId hash_id,
unsigned int key_length_bits) { unsigned int key_length_bits) {
DCHECK(IsHashAlgorithm(hash_id)); DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id));
// key_length_bytes == 0 means unspecified // key_length_bytes == 0 means unspecified
return blink::WebCryptoAlgorithm::adoptParamsAndCreate( return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
blink::WebCryptoAlgorithmIdHmac, blink::WebCryptoAlgorithmIdHmac,
......
...@@ -114,13 +114,6 @@ base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages( ...@@ -114,13 +114,6 @@ base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages(
return jwk_key_ops; return jwk_key_ops;
} }
bool IsHashAlgorithm(blink::WebCryptoAlgorithmId alg_id) {
return alg_id == blink::WebCryptoAlgorithmIdSha1 ||
alg_id == blink::WebCryptoAlgorithmIdSha256 ||
alg_id == blink::WebCryptoAlgorithmIdSha384 ||
alg_id == blink::WebCryptoAlgorithmIdSha512;
}
blink::WebCryptoAlgorithm GetInnerHashAlgorithm( blink::WebCryptoAlgorithm GetInnerHashAlgorithm(
const blink::WebCryptoAlgorithm& algorithm) { const blink::WebCryptoAlgorithm& algorithm) {
DCHECK(!algorithm.isNull()); DCHECK(!algorithm.isNull());
...@@ -144,7 +137,7 @@ blink::WebCryptoAlgorithm CreateAlgorithm(blink::WebCryptoAlgorithmId id) { ...@@ -144,7 +137,7 @@ blink::WebCryptoAlgorithm CreateAlgorithm(blink::WebCryptoAlgorithmId id) {
blink::WebCryptoAlgorithm CreateHmacImportAlgorithm( blink::WebCryptoAlgorithm CreateHmacImportAlgorithm(
blink::WebCryptoAlgorithmId hash_id) { blink::WebCryptoAlgorithmId hash_id) {
DCHECK(IsHashAlgorithm(hash_id)); DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id));
return blink::WebCryptoAlgorithm::adoptParamsAndCreate( return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
blink::WebCryptoAlgorithmIdHmac, blink::WebCryptoAlgorithmIdHmac,
new blink::WebCryptoHmacImportParams(CreateAlgorithm(hash_id))); new blink::WebCryptoHmacImportParams(CreateAlgorithm(hash_id)));
...@@ -153,7 +146,7 @@ blink::WebCryptoAlgorithm CreateHmacImportAlgorithm( ...@@ -153,7 +146,7 @@ blink::WebCryptoAlgorithm CreateHmacImportAlgorithm(
blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm(
blink::WebCryptoAlgorithmId id, blink::WebCryptoAlgorithmId id,
blink::WebCryptoAlgorithmId hash_id) { blink::WebCryptoAlgorithmId hash_id) {
DCHECK(IsHashAlgorithm(hash_id)); DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id));
DCHECK(id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 || DCHECK(id == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 ||
id == blink::WebCryptoAlgorithmIdRsaOaep); id == blink::WebCryptoAlgorithmIdRsaOaep);
return blink::WebCryptoAlgorithm::adoptParamsAndCreate( return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
......
...@@ -46,8 +46,6 @@ CONTENT_EXPORT Status GetWebCryptoUsagesFromJwkKeyOps( ...@@ -46,8 +46,6 @@ CONTENT_EXPORT Status GetWebCryptoUsagesFromJwkKeyOps(
base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages( base::ListValue* CreateJwkKeyOpsFromWebCryptoUsages(
blink::WebCryptoKeyUsageMask usage_mask); blink::WebCryptoKeyUsageMask usage_mask);
CONTENT_EXPORT bool IsHashAlgorithm(blink::WebCryptoAlgorithmId alg_id);
// Returns the "hash" param for an algorithm if it exists, otherwise returns // Returns the "hash" param for an algorithm if it exists, otherwise returns
// a null algorithm. // a null algorithm.
blink::WebCryptoAlgorithm GetInnerHashAlgorithm( blink::WebCryptoAlgorithm GetInnerHashAlgorithm(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment