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_encrypter.h" | 5 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
6 | 6 |
| 7 #include <string> |
| 8 |
7 #include "net/quic/test_tools/quic_test_utils.h" | 9 #include "net/quic/test_tools/quic_test_utils.h" |
8 | 10 |
9 using base::StringPiece; | 11 using base::StringPiece; |
| 12 using std::string; |
10 | 13 |
11 namespace { | 14 namespace { |
12 | 15 |
13 // The AES GCM test vectors come from the file gcmEncryptExtIV128.rsp | 16 // The AES GCM test vectors come from the file gcmEncryptExtIV128.rsp |
14 // downloaded from http://csrc.nist.gov/groups/STM/cavp/index.html on | 17 // downloaded from http://csrc.nist.gov/groups/STM/cavp/index.html on |
15 // 2013-02-01. The test vectors in that file look like this: | 18 // 2013-02-01. The test vectors in that file look like this: |
16 // | 19 // |
17 // [Keylen = 128] | 20 // [Keylen = 128] |
18 // [IVlen = 96] | 21 // [IVlen = 96] |
19 // [PTlen = 0] | 22 // [PTlen = 0] |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 290 |
288 TEST(Aes128Gcm12EncrypterTest, GetCiphertextSize) { | 291 TEST(Aes128Gcm12EncrypterTest, GetCiphertextSize) { |
289 Aes128Gcm12Encrypter encrypter; | 292 Aes128Gcm12Encrypter encrypter; |
290 EXPECT_EQ(1012u, encrypter.GetCiphertextSize(1000)); | 293 EXPECT_EQ(1012u, encrypter.GetCiphertextSize(1000)); |
291 EXPECT_EQ(112u, encrypter.GetCiphertextSize(100)); | 294 EXPECT_EQ(112u, encrypter.GetCiphertextSize(100)); |
292 EXPECT_EQ(22u, encrypter.GetCiphertextSize(10)); | 295 EXPECT_EQ(22u, encrypter.GetCiphertextSize(10)); |
293 } | 296 } |
294 | 297 |
295 } // namespace test | 298 } // namespace test |
296 } // namespace net | 299 } // namespace net |
OLD | NEW |