Chromium Code Reviews| Index: content/child/webcrypto/shared_crypto_unittest.cc |
| diff --git a/content/child/webcrypto/shared_crypto_unittest.cc b/content/child/webcrypto/shared_crypto_unittest.cc |
| index a25db7760542b637480a8d077e1d5bb736771f95..f0a2a585a0f35764b746f1b97dfa3c24ee6ae2e8 100644 |
| --- a/content/child/webcrypto/shared_crypto_unittest.cc |
| +++ b/content/child/webcrypto/shared_crypto_unittest.cc |
| @@ -1083,7 +1083,7 @@ TEST_F(SharedCryptoTest, MAYBE(GenerateKeyAes)) { |
| for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kKeyLength); ++i) { |
| algorithm.push_back(CreateAesCbcKeyGenAlgorithm(kKeyLength[i])); |
| algorithm.push_back(CreateAesKwKeyGenAlgorithm(kKeyLength[i])); |
| - if (SupportsAesGcm()) |
| + if (SupportsAesGcm() && kKeyLength[i] != 192) |
|
Ryan Sleevi
2014/06/10 23:44:21
ditto re: all AES
|
| algorithm.push_back(CreateAesGcmKeyGenAlgorithm(kKeyLength[i])); |
| } |
| blink::WebCryptoKey key = blink::WebCryptoKey::createNull(); |
| @@ -1872,8 +1872,6 @@ TEST_F(SharedCryptoTest, MAYBE(ImportExportJwkSymmetricKey)) { |
| {key_hex_128, aes_gcm_alg, |
| blink::WebCryptoKeyUsageEncrypt | blink::WebCryptoKeyUsageDecrypt, |
| "A128GCM"}, |
| - // AES-CGM 192 |
| - {key_hex_192, aes_gcm_alg, blink::WebCryptoKeyUsageEncrypt, "A192GCM"}, |
| // AES-GCM 256 |
| {key_hex_256, aes_gcm_alg, blink::WebCryptoKeyUsageDecrypt, "A256GCM"}, |
| // AES-KW 128 |
| @@ -3266,6 +3264,41 @@ TEST_F(SharedCryptoTest, MAYBE(AesGcmSampleSets)) { |
| } |
| } |
| +// AES-GCM 192-bit is not allowed: http://crbug.com/381829 |
| +TEST_F(SharedCryptoTest, MAYBE(ImportAesGcm192Raw)) { |
| + // Some Linux test runners may not have a new enough version of NSS. |
| + if (!SupportsAesGcm()) { |
| + LOG(WARNING) << "AES GCM not supported, skipping tests"; |
| + return; |
| + } |
| + |
| + std::vector<uint8> key_raw(24, 0); |
| + blink::WebCryptoKey key = blink::WebCryptoKey::createNull(); |
| + Status status = ImportKey(blink::WebCryptoKeyFormatRaw, |
| + CryptoData(key_raw), |
| + CreateAlgorithm(blink::WebCryptoAlgorithmIdAesGcm), |
| + true, |
| + blink::WebCryptoKeyUsageEncrypt, |
| + &key); |
| + ASSERT_EQ(Status::ErrorAesGcm192Unsupported(), status); |
| +} |
| + |
| +// AES-GCM 192-bit is not allowed: http://crbug.com/381829 |
| +TEST_F(SharedCryptoTest, MAYBE(GenerateAesGcm192)) { |
| + // Some Linux test runners may not have a new enough version of NSS. |
| + if (!SupportsAesGcm()) { |
| + LOG(WARNING) << "AES GCM not supported, skipping tests"; |
| + return; |
| + } |
| + |
| + blink::WebCryptoKey key = blink::WebCryptoKey::createNull(); |
| + Status status = GenerateSecretKey(CreateAesGcmKeyGenAlgorithm(192), |
| + true, |
| + blink::WebCryptoKeyUsageEncrypt, |
| + &key); |
| + ASSERT_EQ(Status::ErrorAesGcm192Unsupported(), status); |
| +} |
| + |
| class SharedCryptoRsaOaepTest : public ::testing::Test { |
| public: |
| SharedCryptoRsaOaepTest() { Init(); } |