summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbeck <>2019-11-18 02:04:56 +0000
committerbeck <>2019-11-18 02:04:56 +0000
commit333e1f47a74f568820d388dacc2803ae91b4c4ac (patch)
treed6bef3763462bc1db00606233992a9ce3b908fe2
parent6a29f6c11055ec2099ab6780e23aa0d6af56da21 (diff)
downloadopenbsd-333e1f47a74f568820d388dacc2803ae91b4c4ac.tar.gz
openbsd-333e1f47a74f568820d388dacc2803ae91b4c4ac.tar.bz2
openbsd-333e1f47a74f568820d388dacc2803ae91b4c4ac.zip
Add regress for the updating of sever and client application secrets
-rw-r--r--src/regress/lib/libssl/key_schedule/key_schedule.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/src/regress/lib/libssl/key_schedule/key_schedule.c b/src/regress/lib/libssl/key_schedule/key_schedule.c
index 2b03b9a4d9..0c66d1c7e4 100644
--- a/src/regress/lib/libssl/key_schedule/key_schedule.c
+++ b/src/regress/lib/libssl/key_schedule/key_schedule.c
@@ -1,6 +1,6 @@
1/* $OpenBSD: key_schedule.c,v 1.7 2019/05/09 05:47:27 claudio Exp $ */ 1/* $OpenBSD: key_schedule.c,v 1.8 2019/11/18 02:04:56 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2018-2019 Bob Beck <beck@openbsd.org>
4 * 4 *
5 * Permission to use, copy, modify, and distribute this software for any 5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above 6 * purpose with or without fee is hereby granted, provided that the above
@@ -154,6 +154,27 @@ uint8_t expected_server_application_traffic[] = {
154 0x4b, 0x4f, 0x1f, 0x3f, 0xcb, 0x63, 0x16, 0x43 154 0x4b, 0x4f, 0x1f, 0x3f, 0xcb, 0x63, 0x16, 0x43
155}; 155};
156 156
157uint8_t expected_server_application_traffic_updated[] = {
158 0x51, 0x92, 0x1b, 0x8a, 0xa3, 0x00, 0x19, 0x76,
159 0xeb, 0x40, 0x1d, 0x0a, 0x43, 0x19, 0xa8, 0x51,
160 0x64, 0x16, 0xa6, 0xc5, 0x60, 0x01, 0xa3, 0x57,
161 0xe5, 0xd1, 0x62, 0x03, 0x1e, 0x84, 0xf9, 0x16,
162};
163
164uint8_t expected_client_application_traffic[] = {
165 0x9e, 0x40, 0x64, 0x6c, 0xe7, 0x9a, 0x7f, 0x9d,
166 0xc0, 0x5a, 0xf8, 0x88, 0x9b, 0xce, 0x65, 0x52,
167 0x87, 0x5a, 0xfa, 0x0b, 0x06, 0xdf, 0x00, 0x87,
168 0xf7, 0x92, 0xeb, 0xb7, 0xc1, 0x75, 0x04, 0xa5,
169};
170
171uint8_t expected_client_application_traffic_updated[] = {
172 0xfc, 0xdf, 0xcc, 0x72, 0x72, 0x5a, 0xae, 0xe4,
173 0x8b, 0xf6, 0x4e, 0x4f, 0xd8, 0xb7, 0x49, 0xcd,
174 0xbd, 0xba, 0xb3, 0x9d, 0x90, 0xda, 0x0b, 0x26,
175 0xe2, 0x24, 0x5c, 0xa6, 0xea, 0x16, 0x72, 0x07,
176};
177
157uint8_t expected_exporter_master[] = { 178uint8_t expected_exporter_master[] = {
158 0xfe, 0x22, 0xf8, 0x81, 0x17, 0x6e, 0xda, 0x18, 179 0xfe, 0x22, 0xf8, 0x81, 0x17, 0x6e, 0xda, 0x18,
159 0xeb, 0x8f, 0x44, 0x52, 0x9e, 0x67, 0x92, 0xc5, 180 0xeb, 0x8f, 0x44, 0x52, 0x9e, 0x67, 0x92, 0xc5,
@@ -259,6 +280,13 @@ main (int argc, char **argv)
259 expected_server_application_traffic, 32) != 0) 280 expected_server_application_traffic, 32) != 0)
260 FAIL("server_application_traffic does not match\n"); 281 FAIL("server_application_traffic does not match\n");
261 282
283 fprintf(stderr, "client_application_traffic:\n");
284 compare_data(secrets->client_application_traffic.data, 32,
285 expected_client_application_traffic, 32);
286 if (memcmp(secrets->client_application_traffic.data,
287 expected_client_application_traffic, 32) != 0)
288 FAIL("server_application_traffic does not match\n");
289
262 fprintf(stderr, "exporter_master:\n"); 290 fprintf(stderr, "exporter_master:\n");
263 compare_data(secrets->exporter_master.data, 32, 291 compare_data(secrets->exporter_master.data, 32,
264 expected_exporter_master, 32); 292 expected_exporter_master, 32);
@@ -266,6 +294,23 @@ main (int argc, char **argv)
266 expected_exporter_master, 32) != 0) 294 expected_exporter_master, 32) != 0)
267 FAIL("exporter_master does not match\n"); 295 FAIL("exporter_master does not match\n");
268 296
297 tls13_update_server_traffic_secret(secrets);
298 fprintf(stderr, "server_application_traffic after update:\n");
299 compare_data(secrets->server_application_traffic.data, 32,
300 expected_server_application_traffic_updated, 32);
301 if (memcmp(secrets->server_application_traffic.data,
302 expected_server_application_traffic_updated, 32) != 0)
303 FAIL("server_application_traffic does not match after update\n");
304
305
306 tls13_update_client_traffic_secret(secrets);
307 fprintf(stderr, "client_application_traffic after update:\n");
308 compare_data(secrets->client_application_traffic.data, 32,
309 expected_server_application_traffic_updated, 32);
310 if (memcmp(secrets->client_application_traffic.data,
311 expected_client_application_traffic_updated, 32) != 0)
312 FAIL("client_application_traffic does not match after update\n");
313
269 tls13_secrets_destroy(secrets); 314 tls13_secrets_destroy(secrets);
270 315
271 return failures; 316 return failures;