Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2083)

Unified Diff: net/quic/crypto/aes_128_gcm_12_encrypter_test.cc

Issue 189893002: Add ChaCha20Poly1305Encrypter, based on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove the six svn copy files from the CL Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/crypto/aes_128_gcm_12_encrypter_openssl.cc ('k') | net/quic/crypto/chacha20_poly1305_decrypter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/aes_128_gcm_12_encrypter_test.cc
===================================================================
--- net/quic/crypto/aes_128_gcm_12_encrypter_test.cc (revision 255481)
+++ net/quic/crypto/aes_128_gcm_12_encrypter_test.cc (working copy)
@@ -224,25 +224,24 @@
}
TEST(Aes128Gcm12EncrypterTest, Encrypt) {
- string key;
- string iv;
- string pt;
- string aad;
- string ct;
- string tag;
-
for (size_t i = 0; i < arraysize(test_group_array); i++) {
SCOPED_TRACE(i);
- const TestVector* test_vector = test_group_array[i];
+ const TestVector* test_vectors = test_group_array[i];
const TestGroupInfo& test_info = test_group_info[i];
- for (size_t j = 0; test_vector[j].key != NULL; j++) {
+ for (size_t j = 0; test_vectors[j].key != NULL; j++) {
// Decode the test vector.
- ASSERT_TRUE(DecodeHexString(test_vector[j].key, &key));
- ASSERT_TRUE(DecodeHexString(test_vector[j].iv, &iv));
- ASSERT_TRUE(DecodeHexString(test_vector[j].pt, &pt));
- ASSERT_TRUE(DecodeHexString(test_vector[j].aad, &aad));
- ASSERT_TRUE(DecodeHexString(test_vector[j].ct, &ct));
- ASSERT_TRUE(DecodeHexString(test_vector[j].tag, &tag));
+ string key;
+ string iv;
+ string pt;
+ string aad;
+ string ct;
+ string tag;
+ ASSERT_TRUE(DecodeHexString(test_vectors[j].key, &key));
+ ASSERT_TRUE(DecodeHexString(test_vectors[j].iv, &iv));
+ ASSERT_TRUE(DecodeHexString(test_vectors[j].pt, &pt));
+ ASSERT_TRUE(DecodeHexString(test_vectors[j].aad, &aad));
+ ASSERT_TRUE(DecodeHexString(test_vectors[j].ct, &ct));
+ ASSERT_TRUE(DecodeHexString(test_vectors[j].tag, &tag));
// The test vector's lengths should look sane. Note that the lengths
// in |test_info| are in bits.
@@ -257,9 +256,8 @@
ASSERT_TRUE(encrypter.SetKey(key));
scoped_ptr<QuicData> encrypted(EncryptWithNonce(
&encrypter, iv,
- // OpenSSL fails if NULL is set as the AAD, as opposed to a
- // zero-length, non-NULL pointer. This deliberately tests that we
- // handle this case.
+ // This deliberately tests that the encrypter can handle an AAD that
+ // is set to NULL, as opposed to a zero-length, non-NULL pointer.
aad.size() ? aad : StringPiece(), pt));
ASSERT_TRUE(encrypted.get());
« no previous file with comments | « net/quic/crypto/aes_128_gcm_12_encrypter_openssl.cc ('k') | net/quic/crypto/chacha20_poly1305_decrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698