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

Side by Side Diff: net/quic/crypto/aes_128_gcm_12_encrypter_test.cc

Issue 1542753004: Replace last remaining NULLs in gfe/quic with nullptr. No behavior change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@110554875
Patch Set: Created 4 years, 12 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 unified diff | Download patch
OLDNEW
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 "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 using std::string;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // length, plaintext length, AAD length, and tag length. 46 // length, plaintext length, AAD length, and tag length.
47 struct TestGroupInfo { 47 struct TestGroupInfo {
48 size_t key_len; 48 size_t key_len;
49 size_t iv_len; 49 size_t iv_len;
50 size_t pt_len; 50 size_t pt_len;
51 size_t aad_len; 51 size_t aad_len;
52 size_t tag_len; 52 size_t tag_len;
53 }; 53 };
54 54
55 // Each test vector consists of six strings of lowercase hexadecimal digits. 55 // Each test vector consists of six strings of lowercase hexadecimal digits.
56 // The strings may be empty (zero length). A test vector with a NULL |key| 56 // The strings may be empty (zero length). A test vector with a nullptr |key|
57 // marks the end of an array of test vectors. 57 // marks the end of an array of test vectors.
58 struct TestVector { 58 struct TestVector {
59 const char* key; 59 const char* key;
60 const char* iv; 60 const char* iv;
61 const char* pt; 61 const char* pt;
62 const char* aad; 62 const char* aad;
63 const char* ct; 63 const char* ct;
64 const char* tag; 64 const char* tag;
65 }; 65 };
66 66
67 const TestGroupInfo test_group_info[] = { 67 const TestGroupInfo test_group_info[] = {
68 { 128, 96, 0, 0, 128 }, 68 { 128, 96, 0, 0, 128 },
69 { 128, 96, 0, 128, 128 }, 69 { 128, 96, 0, 128, 128 },
70 { 128, 96, 128, 0, 128 }, 70 { 128, 96, 128, 0, 128 },
71 { 128, 96, 408, 160, 128 }, 71 { 128, 96, 408, 160, 128 },
72 { 128, 96, 408, 720, 128 }, 72 { 128, 96, 408, 720, 128 },
73 { 128, 96, 104, 0, 128 }, 73 { 128, 96, 104, 0, 128 },
74 }; 74 };
75 75
76 const TestVector test_group_0[] = { 76 const TestVector test_group_0[] = {
77 { "11754cd72aec309bf52f7687212e8957", 77 {"11754cd72aec309bf52f7687212e8957", "3c819d9a9bed087615030b65", "", "", "",
78 "3c819d9a9bed087615030b65", 78 "250327c674aaf477aef2675748cf6971"},
79 "", 79 {"ca47248ac0b6f8372a97ac43508308ed", "ffd2b598feabc9019262d2be", "", "", "",
80 "", 80 "60d20404af527d248d893ae495707d1a"},
81 "", 81 {nullptr}};
82 "250327c674aaf477aef2675748cf6971"
83 },
84 { "ca47248ac0b6f8372a97ac43508308ed",
85 "ffd2b598feabc9019262d2be",
86 "",
87 "",
88 "",
89 "60d20404af527d248d893ae495707d1a"
90 },
91 { NULL }
92 };
93 82
94 const TestVector test_group_1[] = { 83 const TestVector test_group_1[] = {
95 { "77be63708971c4e240d1cb79e8d77feb", 84 {"77be63708971c4e240d1cb79e8d77feb", "e0e00f19fed7ba0136a797f3", "",
96 "e0e00f19fed7ba0136a797f3", 85 "7a43ec1d9c0a5a78a0b16533a6213cab", "",
97 "", 86 "209fcc8d3675ed938e9c7166709dd946"},
98 "7a43ec1d9c0a5a78a0b16533a6213cab", 87 {"7680c5d3ca6154758e510f4d25b98820", "f8f105f9c3df4965780321f8", "",
99 "", 88 "c94c410194c765e3dcc7964379758ed3", "",
100 "209fcc8d3675ed938e9c7166709dd946" 89 "94dca8edfcf90bb74b153c8d48a17930"},
101 }, 90 {nullptr}};
102 { "7680c5d3ca6154758e510f4d25b98820",
103 "f8f105f9c3df4965780321f8",
104 "",
105 "c94c410194c765e3dcc7964379758ed3",
106 "",
107 "94dca8edfcf90bb74b153c8d48a17930"
108 },
109 { NULL }
110 };
111 91
112 const TestVector test_group_2[] = { 92 const TestVector test_group_2[] = {
113 { "7fddb57453c241d03efbed3ac44e371c", 93 {"7fddb57453c241d03efbed3ac44e371c", "ee283a3fc75575e33efd4887",
114 "ee283a3fc75575e33efd4887", 94 "d5de42b461646c255c87bd2962d3b9a2", "", "2ccda4a5415cb91e135c2a0f78c9b2fd",
115 "d5de42b461646c255c87bd2962d3b9a2", 95 "b36d1df9b9d5e596f83e8b7f52971cb3"},
116 "", 96 {"ab72c77b97cb5fe9a382d9fe81ffdbed", "54cc7dc2c37ec006bcc6d1da",
117 "2ccda4a5415cb91e135c2a0f78c9b2fd", 97 "007c5e5b3e59df24a7c355584fc1518d", "", "0e1bde206a07a9c2c1b65300f8c64997",
118 "b36d1df9b9d5e596f83e8b7f52971cb3" 98 "2b4401346697138c7a4891ee59867d0c"},
119 }, 99 {nullptr}};
120 { "ab72c77b97cb5fe9a382d9fe81ffdbed",
121 "54cc7dc2c37ec006bcc6d1da",
122 "007c5e5b3e59df24a7c355584fc1518d",
123 "",
124 "0e1bde206a07a9c2c1b65300f8c64997",
125 "2b4401346697138c7a4891ee59867d0c"
126 },
127 { NULL }
128 };
129 100
130 const TestVector test_group_3[] = { 101 const TestVector test_group_3[] = {
131 { "fe47fcce5fc32665d2ae399e4eec72ba", 102 {"fe47fcce5fc32665d2ae399e4eec72ba", "5adb9609dbaeb58cbd6e7275",
132 "5adb9609dbaeb58cbd6e7275", 103 "7c0e88c88899a779228465074797cd4c2e1498d259b54390b85e3eef1c02df60e743f1"
133 "7c0e88c88899a779228465074797cd4c2e1498d259b54390b85e3eef1c02df60e743f1" 104 "b840382c4bccaf3bafb4ca8429bea063",
134 "b840382c4bccaf3bafb4ca8429bea063", 105 "88319d6e1d3ffa5f987199166c8a9b56c2aeba5a",
135 "88319d6e1d3ffa5f987199166c8a9b56c2aeba5a", 106 "98f4826f05a265e6dd2be82db241c0fbbbf9ffb1c173aa83964b7cf539304373636525"
136 "98f4826f05a265e6dd2be82db241c0fbbbf9ffb1c173aa83964b7cf539304373636525" 107 "3ddbc5db8778371495da76d269e5db3e",
137 "3ddbc5db8778371495da76d269e5db3e", 108 "291ef1982e4defedaa2249f898556b47"},
138 "291ef1982e4defedaa2249f898556b47" 109 {"ec0c2ba17aa95cd6afffe949da9cc3a8", "296bce5b50b7d66096d627ef",
139 }, 110 "b85b3753535b825cbe5f632c0b843c741351f18aa484281aebec2f45bb9eea2d79d987"
140 { "ec0c2ba17aa95cd6afffe949da9cc3a8", 111 "b764b9611f6c0f8641843d5d58f3a242",
141 "296bce5b50b7d66096d627ef", 112 "f8d00f05d22bf68599bcdeb131292ad6e2df5d14",
142 "b85b3753535b825cbe5f632c0b843c741351f18aa484281aebec2f45bb9eea2d79d987" 113 "a7443d31c26bdf2a1c945e29ee4bd344a99cfaf3aa71f8b3f191f83c2adfc7a0716299"
143 "b764b9611f6c0f8641843d5d58f3a242", 114 "5506fde6309ffc19e716eddf1a828c5a",
144 "f8d00f05d22bf68599bcdeb131292ad6e2df5d14", 115 "890147971946b627c40016da1ecf3e77"},
145 "a7443d31c26bdf2a1c945e29ee4bd344a99cfaf3aa71f8b3f191f83c2adfc7a0716299" 116 {nullptr}};
146 "5506fde6309ffc19e716eddf1a828c5a",
147 "890147971946b627c40016da1ecf3e77"
148 },
149 { NULL }
150 };
151 117
152 const TestVector test_group_4[] = { 118 const TestVector test_group_4[] = {
153 { "2c1f21cf0f6fb3661943155c3e3d8492", 119 {"2c1f21cf0f6fb3661943155c3e3d8492", "23cb5ff362e22426984d1907",
154 "23cb5ff362e22426984d1907", 120 "42f758836986954db44bf37c6ef5e4ac0adaf38f27252a1b82d02ea949c8a1a2dbc0d6"
155 "42f758836986954db44bf37c6ef5e4ac0adaf38f27252a1b82d02ea949c8a1a2dbc0d6" 121 "8b5615ba7c1220ff6510e259f06655d8",
156 "8b5615ba7c1220ff6510e259f06655d8", 122 "5d3624879d35e46849953e45a32a624d6a6c536ed9857c613b572b0333e701557a713e"
157 "5d3624879d35e46849953e45a32a624d6a6c536ed9857c613b572b0333e701557a713e" 123 "3f010ecdf9a6bd6c9e3e44b065208645aff4aabee611b391528514170084ccf587177f"
158 "3f010ecdf9a6bd6c9e3e44b065208645aff4aabee611b391528514170084ccf587177f" 124 "4488f33cfb5e979e42b6e1cfc0a60238982a7aec",
159 "4488f33cfb5e979e42b6e1cfc0a60238982a7aec", 125 "81824f0e0d523db30d3da369fdc0d60894c7a0a20646dd015073ad2732bd989b14a222"
160 "81824f0e0d523db30d3da369fdc0d60894c7a0a20646dd015073ad2732bd989b14a222" 126 "b6ad57af43e1895df9dca2a5344a62cc",
161 "b6ad57af43e1895df9dca2a5344a62cc", 127 "57a3ee28136e94c74838997ae9823f3a"},
162 "57a3ee28136e94c74838997ae9823f3a" 128 {"d9f7d2411091f947b4d6f1e2d1f0fb2e", "e1934f5db57cc983e6b180e7",
163 }, 129 "73ed042327f70fe9c572a61545eda8b2a0c6e1d6c291ef19248e973aee6c312012f490"
164 { "d9f7d2411091f947b4d6f1e2d1f0fb2e", 130 "c2c6f6166f4a59431e182663fcaea05a",
165 "e1934f5db57cc983e6b180e7", 131 "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d"
166 "73ed042327f70fe9c572a61545eda8b2a0c6e1d6c291ef19248e973aee6c312012f490" 132 "0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a201"
167 "c2c6f6166f4a59431e182663fcaea05a", 133 "15d2e51398344b16bee1ed7c499b353d6c597af8",
168 "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d" 134 "aaadbd5c92e9151ce3db7210b8714126b73e43436d242677afa50384f2149b831f1d57"
169 "0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a201" 135 "3c7891c2a91fbc48db29967ec9542b23",
170 "15d2e51398344b16bee1ed7c499b353d6c597af8", 136 "21b51ca862cb637cdd03b99a0f93b134"},
171 "aaadbd5c92e9151ce3db7210b8714126b73e43436d242677afa50384f2149b831f1d57" 137 {nullptr}};
172 "3c7891c2a91fbc48db29967ec9542b23",
173 "21b51ca862cb637cdd03b99a0f93b134"
174 },
175 { NULL }
176 };
177 138
178 const TestVector test_group_5[] = { 139 const TestVector test_group_5[] = {
179 { "fe9bb47deb3a61e423c2231841cfd1fb", 140 {"fe9bb47deb3a61e423c2231841cfd1fb", "4d328eb776f500a2f7fb47aa",
180 "4d328eb776f500a2f7fb47aa", 141 "f1cc3818e421876bb6b8bbd6c9", "", "b88c5c1977b35b517b0aeae967",
181 "f1cc3818e421876bb6b8bbd6c9", 142 "43fd4727fe5cdb4b5b42818dea7ef8c9"},
182 "", 143 {"6703df3701a7f54911ca72e24dca046a", "12823ab601c350ea4bc2488c",
183 "b88c5c1977b35b517b0aeae967", 144 "793cd125b0b84a043e3ac67717", "", "b2051c80014f42f08735a7b0cd",
184 "43fd4727fe5cdb4b5b42818dea7ef8c9" 145 "38e6bcd29962e5f2c13626b85a877101"},
185 }, 146 {nullptr}};
186 { "6703df3701a7f54911ca72e24dca046a",
187 "12823ab601c350ea4bc2488c",
188 "793cd125b0b84a043e3ac67717",
189 "",
190 "b2051c80014f42f08735a7b0cd",
191 "38e6bcd29962e5f2c13626b85a877101"
192 },
193 { NULL }
194 };
195 147
196 const TestVector* const test_group_array[] = { 148 const TestVector* const test_group_array[] = {
197 test_group_0, 149 test_group_0,
198 test_group_1, 150 test_group_1,
199 test_group_2, 151 test_group_2,
200 test_group_3, 152 test_group_3,
201 test_group_4, 153 test_group_4,
202 test_group_5, 154 test_group_5,
203 }; 155 };
204 156
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 240
289 TEST(Aes128Gcm12EncrypterTest, GetCiphertextSize) { 241 TEST(Aes128Gcm12EncrypterTest, GetCiphertextSize) {
290 Aes128Gcm12Encrypter encrypter; 242 Aes128Gcm12Encrypter encrypter;
291 EXPECT_EQ(1012u, encrypter.GetCiphertextSize(1000)); 243 EXPECT_EQ(1012u, encrypter.GetCiphertextSize(1000));
292 EXPECT_EQ(112u, encrypter.GetCiphertextSize(100)); 244 EXPECT_EQ(112u, encrypter.GetCiphertextSize(100));
293 EXPECT_EQ(22u, encrypter.GetCiphertextSize(10)); 245 EXPECT_EQ(22u, encrypter.GetCiphertextSize(10));
294 } 246 }
295 247
296 } // namespace test 248 } // namespace test
297 } // namespace net 249 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/aes_128_gcm_12_decrypter_test.cc ('k') | net/quic/crypto/chacha20_poly1305_decrypter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698