Index: content/renderer/webcrypto/shared_crypto_unittest.cc |
diff --git a/content/renderer/webcrypto/shared_crypto_unittest.cc b/content/renderer/webcrypto/shared_crypto_unittest.cc |
index c02b8aa783158c7379972499a251f49444e24376..e5806e18fec54724b263d9ed7da2c8d8fdbd588b 100644 |
--- a/content/renderer/webcrypto/shared_crypto_unittest.cc |
+++ b/content/renderer/webcrypto/shared_crypto_unittest.cc |
@@ -108,16 +108,20 @@ blink::WebCryptoAlgorithm CreateAesGcmAlgorithm( |
// Creates an HMAC algorithm whose parameters struct is compatible with key |
// generation. It is an error to call this with a hash_id that is not a SHA*. |
-// The key_length_bytes parameter is optional, with zero meaning unspecified. |
+// The key_length_bits parameter is optional, with zero meaning unspecified. |
blink::WebCryptoAlgorithm CreateHmacKeyGenAlgorithm( |
blink::WebCryptoAlgorithmId hash_id, |
- unsigned int key_length_bytes) { |
+ unsigned int key_length_bits) { |
+#ifndef WEBCRYPTO_HMAC_BITS |
Ryan Sleevi
2014/03/06 21:51:37
!defined
eroman
2014/03/06 21:54:18
Done.
|
+ // TODO(eroman): Delete |
+ key_length_bits /= 8; |
+#endif |
DCHECK(IsHashAlgorithm(hash_id)); |
// key_length_bytes == 0 means unspecified |
return blink::WebCryptoAlgorithm::adoptParamsAndCreate( |
blink::WebCryptoAlgorithmIdHmac, |
new blink::WebCryptoHmacKeyGenParams( |
- CreateAlgorithm(hash_id), (key_length_bytes != 0), key_length_bytes)); |
+ CreateAlgorithm(hash_id), (key_length_bits != 0), key_length_bits)); |
} |
// Returns a slightly modified version of the input vector. |
@@ -865,7 +869,7 @@ TEST_F(SharedCryptoTest, MAYBE(GenerateKeyHmac)) { |
blink::WebArrayBuffer key_bytes; |
blink::WebCryptoKey key = blink::WebCryptoKey::createNull(); |
blink::WebCryptoAlgorithm algorithm = |
- CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha1, 64); |
+ CreateHmacKeyGenAlgorithm(blink::WebCryptoAlgorithmIdSha1, 512); |
ASSERT_STATUS_SUCCESS(GenerateSecretKey(algorithm, true, 0, &key)); |
EXPECT_FALSE(key.isNull()); |
EXPECT_TRUE(key.handle()); |