@@ -67,14 +67,16 @@ int main(int argc, char **argv)
67
67
EXPECT_SUCCESS (setup_server_keys (conn , & aes128 ));
68
68
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
69
69
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .server_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
70
- conn -> actual_protocol_version = S2N_TLS12 ;
71
70
72
71
int max_fragment = S2N_SMALL_FRAGMENT_LENGTH ;
73
72
for (int i = 0 ; i < max_fragment ; i ++ ) {
74
73
struct s2n_blob in = {.data = random_data ,.size = i };
75
74
int bytes_written ;
76
75
77
76
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
77
+ conn -> server_protocol_version = S2N_TLS12 ;
78
+ conn -> client_protocol_version = S2N_TLS12 ;
79
+ conn -> actual_protocol_version = S2N_TLS12 ;
78
80
conn -> server = & conn -> initial ;
79
81
conn -> client = & conn -> initial ;
80
82
EXPECT_SUCCESS (setup_server_keys (conn , & aes128 ));
@@ -125,6 +127,9 @@ int main(int argc, char **argv)
125
127
126
128
/* Start over */
127
129
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
130
+ conn -> server_protocol_version = S2N_TLS12 ;
131
+ conn -> client_protocol_version = S2N_TLS12 ;
132
+ conn -> actual_protocol_version = S2N_TLS12 ;
128
133
EXPECT_SUCCESS (setup_server_keys (conn , & aes128 ));
129
134
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
130
135
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .server_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
@@ -149,6 +154,9 @@ int main(int argc, char **argv)
149
154
/* Tamper with the IV and ensure decryption fails */
150
155
for (int j = 0 ; j < S2N_TLS_GCM_IV_LEN ; j ++ ) {
151
156
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
157
+ conn -> server_protocol_version = S2N_TLS12 ;
158
+ conn -> client_protocol_version = S2N_TLS12 ;
159
+ conn -> actual_protocol_version = S2N_TLS12 ;
152
160
EXPECT_SUCCESS (setup_server_keys (conn , & aes128 ));
153
161
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
154
162
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .server_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
@@ -171,6 +179,9 @@ int main(int argc, char **argv)
171
179
/* Tamper with the TAG and ensure decryption fails */
172
180
for (int j = 0 ; j < S2N_TLS_GCM_TAG_LEN ; j ++ ) {
173
181
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
182
+ conn -> server_protocol_version = S2N_TLS12 ;
183
+ conn -> client_protocol_version = S2N_TLS12 ;
184
+ conn -> actual_protocol_version = S2N_TLS12 ;
174
185
EXPECT_SUCCESS (setup_server_keys (conn , & aes128 ));
175
186
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
176
187
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .server_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
@@ -193,6 +204,9 @@ int main(int argc, char **argv)
193
204
/* Tamper with the ciphertext and ensure decryption fails */
194
205
for (int j = 0 ; j < i - S2N_TLS_GCM_TAG_LEN ; j ++ ) {
195
206
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
207
+ conn -> server_protocol_version = S2N_TLS12 ;
208
+ conn -> client_protocol_version = S2N_TLS12 ;
209
+ conn -> actual_protocol_version = S2N_TLS12 ;
196
210
EXPECT_SUCCESS (setup_server_keys (conn , & aes128 ));
197
211
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
198
212
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .server_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
@@ -230,6 +244,9 @@ int main(int argc, char **argv)
230
244
int bytes_written ;
231
245
232
246
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
247
+ conn -> server_protocol_version = S2N_TLS12 ;
248
+ conn -> client_protocol_version = S2N_TLS12 ;
249
+ conn -> actual_protocol_version = S2N_TLS12 ;
233
250
conn -> initial .cipher_suite -> cipher = & s2n_aes256_gcm ;
234
251
EXPECT_SUCCESS (setup_server_keys (conn , & aes256 ));
235
252
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
@@ -279,6 +296,9 @@ int main(int argc, char **argv)
279
296
EXPECT_SUCCESS (s2n_stuffer_wipe (& conn -> in ));
280
297
281
298
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
299
+ conn -> server_protocol_version = S2N_TLS12 ;
300
+ conn -> client_protocol_version = S2N_TLS12 ;
301
+ conn -> actual_protocol_version = S2N_TLS12 ;
282
302
conn -> initial .cipher_suite -> cipher = & s2n_aes256_gcm ;
283
303
EXPECT_SUCCESS (setup_server_keys (conn , & aes256 ));
284
304
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
@@ -305,6 +325,9 @@ int main(int argc, char **argv)
305
325
/* Tamper with the IV and ensure decryption fails */
306
326
for (int j = 0 ; j < S2N_TLS_GCM_IV_LEN ; j ++ ) {
307
327
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
328
+ conn -> server_protocol_version = S2N_TLS12 ;
329
+ conn -> client_protocol_version = S2N_TLS12 ;
330
+ conn -> actual_protocol_version = S2N_TLS12 ;
308
331
conn -> initial .cipher_suite -> cipher = & s2n_aes256_gcm ;
309
332
EXPECT_SUCCESS (setup_server_keys (conn , & aes256 ));
310
333
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
@@ -329,6 +352,9 @@ int main(int argc, char **argv)
329
352
/* Tamper with the TAG and ensure decryption fails */
330
353
for (int j = 0 ; j < S2N_TLS_GCM_TAG_LEN ; j ++ ) {
331
354
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
355
+ conn -> server_protocol_version = S2N_TLS12 ;
356
+ conn -> client_protocol_version = S2N_TLS12 ;
357
+ conn -> actual_protocol_version = S2N_TLS12 ;
332
358
conn -> initial .cipher_suite -> cipher = & s2n_aes256_gcm ;
333
359
EXPECT_SUCCESS (setup_server_keys (conn , & aes256 ));
334
360
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
@@ -353,6 +379,9 @@ int main(int argc, char **argv)
353
379
/* Tamper with the ciphertext and ensure decryption fails */
354
380
for (int j = S2N_TLS_GCM_IV_LEN ; j < i - S2N_TLS_GCM_TAG_LEN ; j ++ ) {
355
381
EXPECT_SUCCESS (s2n_connection_wipe (conn ));
382
+ conn -> server_protocol_version = S2N_TLS12 ;
383
+ conn -> client_protocol_version = S2N_TLS12 ;
384
+ conn -> actual_protocol_version = S2N_TLS12 ;
356
385
conn -> initial .cipher_suite -> cipher = & s2n_aes256_gcm ;
357
386
EXPECT_SUCCESS (setup_server_keys (conn , & aes256 ));
358
387
EXPECT_SUCCESS (s2n_hmac_init (& conn -> initial .client_record_mac , S2N_HMAC_SHA1 , mac_key , sizeof (mac_key )));
0 commit comments