OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/crypto/aes_128_gcm_12_decrypter.h" | 5 #include "net/quic/crypto/aes_128_gcm_12_decrypter.h" |
6 | 6 |
7 #include "net/quic/test_tools/quic_test_utils.h" | 7 #include "net/quic/test_tools/quic_test_utils.h" |
8 | 8 |
9 using base::StringPiece; | 9 using base::StringPiece; |
10 | 10 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 if (!decrypter->Decrypt(nonce, associated_data, ciphertext, | 303 if (!decrypter->Decrypt(nonce, associated_data, ciphertext, |
304 reinterpret_cast<unsigned char*>(plaintext.get()), | 304 reinterpret_cast<unsigned char*>(plaintext.get()), |
305 &plaintext_size)) { | 305 &plaintext_size)) { |
306 return NULL; | 306 return NULL; |
307 } | 307 } |
308 return new QuicData(plaintext.release(), plaintext_size, true); | 308 return new QuicData(plaintext.release(), plaintext_size, true); |
309 } | 309 } |
310 | 310 |
311 TEST(Aes128Gcm12DecrypterTest, Decrypt) { | 311 TEST(Aes128Gcm12DecrypterTest, Decrypt) { |
312 if (!Aes128Gcm12Decrypter::IsSupported()) { | 312 if (!Aes128Gcm12Decrypter::IsSupported()) { |
313 LOG(INFO) << "AES GCM not supported. Test skipped."; | 313 VLOG(0) << "AES GCM not supported. Test skipped."; |
314 return; | 314 return; |
315 } | 315 } |
316 | 316 |
317 char key[1024]; | 317 char key[1024]; |
318 size_t key_len; | 318 size_t key_len; |
319 char iv[1024]; | 319 char iv[1024]; |
320 size_t iv_len; | 320 size_t iv_len; |
321 char ct[1024]; | 321 char ct[1024]; |
322 size_t ct_len; | 322 size_t ct_len; |
323 char aad[1024]; | 323 char aad[1024]; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 ASSERT_EQ(pt_len, decrypted->length()); | 378 ASSERT_EQ(pt_len, decrypted->length()); |
379 test::CompareCharArraysWithHexError("plaintext", decrypted->data(), | 379 test::CompareCharArraysWithHexError("plaintext", decrypted->data(), |
380 pt_len, pt, pt_len); | 380 pt_len, pt, pt_len); |
381 } | 381 } |
382 } | 382 } |
383 } | 383 } |
384 | 384 |
385 } // namespace test | 385 } // namespace test |
386 } // namespace net | 386 } // namespace net |
OLD | NEW |