@@ -29,10 +29,10 @@ TEST(EncryptorTest, EncryptDecrypt) {
29
29
30
30
EXPECT_LT (0U , ciphertext.size ());
31
31
32
- std::string decypted ;
33
- EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decypted ));
32
+ std::string decrypted ;
33
+ EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decrypted ));
34
34
35
- EXPECT_EQ (plaintext, decypted );
35
+ EXPECT_EQ (plaintext, decrypted );
36
36
}
37
37
38
38
TEST (EncryptorTest, DecryptWrongKey) {
@@ -84,7 +84,7 @@ TEST(EncryptorTest, DecryptWrongKey) {
84
84
static_cast <unsigned char >(ciphertext[i]));
85
85
}
86
86
87
- std::string decypted ;
87
+ std::string decrypted ;
88
88
89
89
// This wrong key causes the last padding byte to be 5, which is a valid
90
90
// padding length, and the second to last padding byte to be 137, which is
@@ -95,21 +95,21 @@ TEST(EncryptorTest, DecryptWrongKey) {
95
95
#if !defined(USE_NSS) && !defined(OS_WIN) && !defined(OS_MACOSX)
96
96
crypto::Encryptor decryptor;
97
97
EXPECT_TRUE (decryptor.Init (wrong_key.get (), crypto::Encryptor::CBC, iv));
98
- EXPECT_FALSE (decryptor.Decrypt (ciphertext, &decypted ));
98
+ EXPECT_FALSE (decryptor.Decrypt (ciphertext, &decrypted ));
99
99
#endif
100
100
101
101
// This demonstrates that not all wrong keys can be detected by padding
102
102
// error. This wrong key causes the last padding byte to be 1, which is
103
103
// a valid padding block of length 1.
104
104
crypto::Encryptor decryptor2;
105
105
EXPECT_TRUE (decryptor2.Init (wrong_key2.get (), crypto::Encryptor::CBC, iv));
106
- EXPECT_TRUE (decryptor2.Decrypt (ciphertext, &decypted ));
106
+ EXPECT_TRUE (decryptor2.Decrypt (ciphertext, &decrypted ));
107
107
108
108
// This wrong key causes the last padding byte to be 253, which should be
109
109
// rejected by all implementations.
110
110
crypto::Encryptor decryptor3;
111
111
EXPECT_TRUE (decryptor3.Init (wrong_key3.get (), crypto::Encryptor::CBC, iv));
112
- EXPECT_FALSE (decryptor3.Decrypt (ciphertext, &decypted ));
112
+ EXPECT_FALSE (decryptor3.Decrypt (ciphertext, &decrypted ));
113
113
}
114
114
115
115
namespace {
@@ -205,11 +205,11 @@ void TestAESCTREncrypt(
205
205
EXPECT_EQ (ciphertext_size, encrypted.size ());
206
206
EXPECT_EQ (0 , memcmp (encrypted.data (), ciphertext, encrypted.size ()));
207
207
208
- std::string decypted ;
208
+ std::string decrypted ;
209
209
EXPECT_TRUE (encryptor.SetCounter (init_counter_str));
210
- EXPECT_TRUE (encryptor.Decrypt (encrypted, &decypted ));
210
+ EXPECT_TRUE (encryptor.Decrypt (encrypted, &decrypted ));
211
211
212
- EXPECT_EQ (plaintext_str, decypted );
212
+ EXPECT_EQ (plaintext_str, decrypted );
213
213
}
214
214
215
215
void TestAESCTRMultipleDecrypt (
@@ -236,12 +236,12 @@ void TestAESCTRMultipleDecrypt(
236
236
237
237
int offset = 0 ;
238
238
for (size_t i = 0 ; i < arraysize (kTestDecryptSizes ); ++i) {
239
- std::string decypted ;
239
+ std::string decrypted ;
240
240
size_t len = kTestDecryptSizes [i];
241
241
EXPECT_TRUE (
242
- encryptor.Decrypt (ciphertext_str.substr (offset, len), &decypted ));
243
- EXPECT_EQ (len, decypted .size ());
244
- EXPECT_EQ (0 , memcmp (decypted .data (), plaintext + offset, len));
242
+ encryptor.Decrypt (ciphertext_str.substr (offset, len), &decrypted ));
243
+ EXPECT_EQ (len, decrypted .size ());
244
+ EXPECT_EQ (0 , memcmp (decrypted .data (), plaintext + offset, len));
245
245
offset += len;
246
246
}
247
247
}
@@ -296,19 +296,19 @@ TEST(EncryptorTest, EncryptDecryptCTR) {
296
296
EXPECT_TRUE (encryptor.Encrypt (plaintext, &ciphertext));
297
297
EXPECT_LT (0U , ciphertext.size ());
298
298
299
- std::string decypted ;
299
+ std::string decrypted ;
300
300
EXPECT_TRUE (encryptor.SetCounter (kInitialCounter ));
301
- EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decypted ));
302
- EXPECT_EQ (plaintext, decypted );
301
+ EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decrypted ));
302
+ EXPECT_EQ (plaintext, decrypted );
303
303
304
304
plaintext = " 0123456789012345" ;
305
305
EXPECT_TRUE (encryptor.SetCounter (kInitialCounter ));
306
306
EXPECT_TRUE (encryptor.Encrypt (plaintext, &ciphertext));
307
307
EXPECT_LT (0U , ciphertext.size ());
308
308
309
309
EXPECT_TRUE (encryptor.SetCounter (kInitialCounter ));
310
- EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decypted ));
311
- EXPECT_EQ (plaintext, decypted );
310
+ EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decrypted ));
311
+ EXPECT_EQ (plaintext, decrypted );
312
312
}
313
313
314
314
TEST (EncryptorTest, CTRCounter) {
@@ -422,10 +422,10 @@ TEST(EncryptorTest, EncryptAES256CBC) {
422
422
EXPECT_EQ (sizeof (kRawCiphertext ), ciphertext.size ());
423
423
EXPECT_EQ (0 , memcmp (ciphertext.data (), kRawCiphertext , ciphertext.size ()));
424
424
425
- std::string decypted ;
426
- EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decypted ));
425
+ std::string decrypted ;
426
+ EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decrypted ));
427
427
428
- EXPECT_EQ (plaintext, decypted );
428
+ EXPECT_EQ (plaintext, decrypted );
429
429
}
430
430
431
431
// Expected output derived from the NSS implementation.
@@ -451,9 +451,9 @@ TEST(EncryptorTest, EncryptAES128CBCRegression) {
451
451
EXPECT_EQ (expected_ciphertext_hex, base::HexEncode (ciphertext.data (),
452
452
ciphertext.size ()));
453
453
454
- std::string decypted ;
455
- EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decypted ));
456
- EXPECT_EQ (plaintext, decypted );
454
+ std::string decrypted ;
455
+ EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decrypted ));
456
+ EXPECT_EQ (plaintext, decrypted );
457
457
}
458
458
459
459
// Expected output derived from the NSS implementation.
@@ -477,9 +477,9 @@ TEST(EncryptorTest, EncryptAES192CBCRegression) {
477
477
EXPECT_EQ (expected_ciphertext_hex, base::HexEncode (ciphertext.data (),
478
478
ciphertext.size ()));
479
479
480
- std::string decypted ;
481
- EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decypted ));
482
- EXPECT_EQ (plaintext, decypted );
480
+ std::string decrypted ;
481
+ EXPECT_TRUE (encryptor.Decrypt (ciphertext, &decrypted ));
482
+ EXPECT_EQ (plaintext, decrypted );
483
483
}
484
484
485
485
// Not all platforms allow import/generation of symmetric keys with an
0 commit comments