diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 01:03:05 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-31 01:03:05 +0000 |
commit | 1970276bae9957b7f6bc9da28bca9d11549c03fb (patch) | |
tree | 7105b627bc48dddd22ebea249e654965a8a67104 /crypto/encryptor_unittest.cc | |
parent | d380e730eb080bca3935feeea6d2afeff78ab70f (diff) | |
download | chromium_src-1970276bae9957b7f6bc9da28bca9d11549c03fb.zip chromium_src-1970276bae9957b7f6bc9da28bca9d11549c03fb.tar.gz chromium_src-1970276bae9957b7f6bc9da28bca9d11549c03fb.tar.bz2 |
Relax the failure mode of EncryptorTest.UnsupportedKeySize so that we
can run the test on all platforms.
R=davidben@chromium.org,joth@chromium.org,rsleevi@chromium.org
BUG=
Review URL: https://codereview.chromium.org/432443003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/encryptor_unittest.cc')
-rw-r--r-- | crypto/encryptor_unittest.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crypto/encryptor_unittest.cc b/crypto/encryptor_unittest.cc index f095659..1a99783 100644 --- a/crypto/encryptor_unittest.cc +++ b/crypto/encryptor_unittest.cc @@ -456,22 +456,21 @@ TEST(EncryptorTest, EncryptAES128CBCRegression) { EXPECT_EQ(plaintext, decrypted); } -// Not all platforms allow import/generation of symmetric keys with an -// unsupported size. -#if !defined(USE_NSS) && !defined(OS_WIN) && !defined(OS_MACOSX) +// Symmetric keys with an unsupported size should be rejected. Whether they are +// rejected by SymmetricKey::Import or Encryptor::Init depends on the platform. TEST(EncryptorTest, UnsupportedKeySize) { std::string key = "7 = bad"; std::string iv = "Sweet Sixteen IV"; scoped_ptr<crypto::SymmetricKey> sym_key(crypto::SymmetricKey::Import( crypto::SymmetricKey::AES, key)); - ASSERT_TRUE(sym_key.get()); + if (!sym_key.get()) + return; crypto::Encryptor encryptor; - // The IV must be exactly as long a the cipher block size. + // The IV must be exactly as long as the cipher block size. EXPECT_EQ(16U, iv.size()); EXPECT_FALSE(encryptor.Init(sym_key.get(), crypto::Encryptor::CBC, iv)); } -#endif // unsupported platforms. TEST(EncryptorTest, UnsupportedIV) { std::string key = "128=SixteenBytes"; |