OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chacha20_poly1305_decrypter.h" | 5 #include "net/quic/crypto/chacha20_poly1305_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 using std::string; |
10 | 11 |
11 namespace { | 12 namespace { |
12 | 13 |
13 // The test vectors come from draft-agl-tls-chacha20poly1305-04 Section 7. | 14 // The test vectors come from draft-agl-tls-chacha20poly1305-04 Section 7. |
14 | 15 |
15 // Each test vector consists of six strings of lowercase hexadecimal digits. | 16 // Each test vector consists of six strings of lowercase hexadecimal digits. |
16 // The strings may be empty (zero length). A test vector with a NULL |key| | 17 // The strings may be empty (zero length). A test vector with a NULL |key| |
17 // marks the end of an array of test vectors. | 18 // marks the end of an array of test vectors. |
18 struct TestVector { | 19 struct TestVector { |
19 // Input: | 20 // Input: |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 EXPECT_TRUE(has_pt); | 124 EXPECT_TRUE(has_pt); |
124 | 125 |
125 ASSERT_EQ(pt.length(), decrypted->length()); | 126 ASSERT_EQ(pt.length(), decrypted->length()); |
126 test::CompareCharArraysWithHexError("plaintext", decrypted->data(), | 127 test::CompareCharArraysWithHexError("plaintext", decrypted->data(), |
127 pt.length(), pt.data(), pt.length()); | 128 pt.length(), pt.data(), pt.length()); |
128 } | 129 } |
129 } | 130 } |
130 | 131 |
131 } // namespace test | 132 } // namespace test |
132 } // namespace net | 133 } // namespace net |
OLD | NEW |