Chromium Code Reviews| Index: crypto/encryptor_unittest.cc |
| diff --git a/crypto/encryptor_unittest.cc b/crypto/encryptor_unittest.cc |
| index ac78b966da394b4bbeec520ef8cb31312f33619f..df74c06f3e9619b5db536b632d890f13d2280de2 100644 |
| --- a/crypto/encryptor_unittest.cc |
| +++ b/crypto/encryptor_unittest.cc |
| @@ -92,7 +92,7 @@ TEST(EncryptorTest, DecryptWrongKey) { |
| // determine the padding length without checking every padding byte, |
| // Encryptor::Decrypt() will still return true. This is the case for NSS |
| // (crbug.com/124434) and Mac OS X 10.7 (crbug.com/127586). |
| -#if !defined(USE_NSS) |
| +#if !defined(USE_NSS) && !defined(OS_WIN) && !defined(OS_MACOSX) |
| crypto::Encryptor decryptor; |
| EXPECT_TRUE(decryptor.Init(wrong_key.get(), crypto::Encryptor::CBC, iv)); |
| EXPECT_FALSE(decryptor.Decrypt(ciphertext, &decypted)); |
| @@ -113,7 +113,7 @@ TEST(EncryptorTest, DecryptWrongKey) { |
| } |
| // CTR mode encryption is only implemented using NSS. |
| -#if defined(USE_NSS) |
| +#if defined(USE_NSS) || defined(OS_WIN) || defined(OS_MACOSX) |
| TEST(EncryptorTest, EncryptDecryptCTR) { |
| scoped_ptr<crypto::SymmetricKey> key( |
| @@ -149,11 +149,12 @@ TEST(EncryptorTest, EncryptDecryptCTR) { |
| TEST(EncryptorTest, CTRCounter) { |
| const int kCounterSize = 16; |
| - const char kTest1[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| + const uint8 kTest1[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
|
Ryan Sleevi
2012/06/14 19:35:26
unsigned char, to be consistent with the rest of t
ddorwin
2012/06/14 20:44:19
Done.
|
| uint8 buf[16]; |
| // Increment 10 times. |
| - crypto::Encryptor::Counter counter1(std::string(kTest1, kCounterSize)); |
| + crypto::Encryptor::Counter counter1( |
| + std::string(reinterpret_cast<const char*>(kTest1), kCounterSize)); |
| for (int i = 0; i < 10; ++i) |
| counter1.Increment(); |
| counter1.Write(buf); |
| @@ -161,18 +162,20 @@ TEST(EncryptorTest, CTRCounter) { |
| EXPECT_TRUE(buf[15] == 10); |
| // Check corner cases. |
| - const char kTest2[] = {0, 0, 0, 0, 0, 0, 0, 0, |
| + const uint8 kTest2[] = {0, 0, 0, 0, 0, 0, 0, 0, |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| - const char kExpect2[] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}; |
| - crypto::Encryptor::Counter counter2(std::string(kTest2, kCounterSize)); |
| + const uint8 kExpect2[] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}; |
| + crypto::Encryptor::Counter counter2( |
| + std::string(reinterpret_cast<const char*>(kTest2), kCounterSize)); |
| counter2.Increment(); |
| counter2.Write(buf); |
| EXPECT_EQ(0, memcmp(buf, kExpect2, kCounterSize)); |
| - const char kTest3[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| + const uint8 kTest3[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| - const char kExpect3[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| - crypto::Encryptor::Counter counter3(std::string(kTest3, kCounterSize)); |
| + const uint8 kExpect3[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| + crypto::Encryptor::Counter counter3( |
| + std::string(reinterpret_cast<const char*>(kTest3), kCounterSize)); |
| counter3.Increment(); |
| counter3.Write(buf); |
| EXPECT_EQ(0, memcmp(buf, kExpect3, kCounterSize)); |
| @@ -312,7 +315,7 @@ TEST(EncryptorTest, EncryptAES192CBCRegression) { |
| // Not all platforms allow import/generation of symmetric keys with an |
| // unsupported size. |
| -#if !defined(OS_WIN) && !defined(USE_NSS) |
| +#if !defined(USE_NSS) && !defined(OS_WIN) && !defined(OS_MACOSX) |
| TEST(EncryptorTest, UnsupportedKeySize) { |
| std::string key = "7 = bad"; |
| std::string iv = "Sweet Sixteen IV"; |