1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

More regress all the way to exporter_master

This commit is contained in:
beck 2018-11-10 00:48:33 +00:00
parent 588da57767
commit d3914aee58

View File

@ -1,4 +1,4 @@
/* $OpenBSD: key_schedule.c,v 1.3 2018/11/10 00:18:25 beck Exp $ */
/* $OpenBSD: key_schedule.c,v 1.4 2018/11/10 00:48:33 beck Exp $ */
/*
* Copyright (c) 2018 Bob Beck <beck@openbsd.org>
*
@ -86,6 +86,19 @@ const uint8_t ecdhe [] = {
0xd4, 0x62, 0x72, 0x90, 0x0f, 0x89, 0x49, 0x2d
};
uint8_t csfhello [] = {
0x96, 0x08, 0x10, 0x2a, 0x0f, 0x1c, 0xcc, 0x6d,
0xb6, 0x25, 0x0b, 0x7b, 0x7e, 0x41, 0x7b, 0x1a,
0x00, 0x0e, 0xaa, 0xda, 0x3d, 0xaa, 0xe4, 0x77,
0x7a, 0x76, 0x86, 0xc9, 0xff, 0x83, 0xdf, 0x13
};
const struct tls13_secret csfhello_hash = {
.data = csfhello,
.len = 32,
};
/* Expected Values */
uint8_t expected_extracted_early[] = {
@ -134,6 +147,20 @@ uint8_t expected_extracted_master[] = {
0xd5, 0xa4, 0x1d, 0xa8, 0xd0, 0x40, 0x29, 0x19
};
uint8_t expected_server_application_traffic[] = {
0xa1, 0x1a, 0xf9, 0xf0, 0x55, 0x31, 0xf8, 0x56,
0xad, 0x47, 0x11, 0x6b, 0x45, 0xa9, 0x50, 0x32,
0x82, 0x04, 0xb4, 0xf4, 0x4b, 0xfb, 0x6b, 0x3a,
0x4b, 0x4f, 0x1f, 0x3f, 0xcb, 0x63, 0x16, 0x43
};
uint8_t expected_exporter_master[] = {
0xfe, 0x22, 0xf8, 0x81, 0x17, 0x6e, 0xda, 0x18,
0xeb, 0x8f, 0x44, 0x52, 0x9e, 0x67, 0x92, 0xc5,
0x0c, 0x9a, 0x3f, 0x89, 0x45, 0x2f, 0x68, 0xd8,
0xae, 0x31, 0x1b, 0x43, 0x09, 0xd3, 0xcf, 0x50
};
int main () {
struct tls13_secrets *secrets;
@ -161,9 +188,9 @@ int main () {
FAIL("derive_handshake_secrets worked when it shouldn't(2)\n");
/* XXX fix hash here once test vector sorted */
if (!tls13_derive_application_secrets(secrets, &cshello_hash))
if (!tls13_derive_application_secrets(secrets, &csfhello_hash))
FAIL("derive_application_secrets failed\n");
if (tls13_derive_application_secrets(secrets, &cshello_hash))
if (tls13_derive_application_secrets(secrets, &csfhello_hash))
FAIL("derive_application_secrets worked when it "
"shouldn't(2)\n");
@ -209,7 +236,6 @@ int main () {
expected_derived_early, 32) != 0)
FAIL("derived_early does not match\n");
/* XXX this is currently totally volkswagened from above */
fprintf(stderr, "derived_handshake:\n");
compare_data(secrets->derived_handshake.data, 32,
expected_derived_handshake, 32);
@ -224,5 +250,19 @@ int main () {
expected_extracted_master, 32) != 0)
FAIL("extracted_master does not match\n");
fprintf(stderr, "server_application_traffic:\n");
compare_data(secrets->server_application_traffic.data, 32,
expected_server_application_traffic, 32);
if (memcmp(secrets->server_application_traffic.data,
expected_server_application_traffic, 32) != 0)
FAIL("server_application_traffic does not match\n");
fprintf(stderr, "exporter_master:\n");
compare_data(secrets->exporter_master.data, 32,
expected_exporter_master, 32);
if (memcmp(secrets->exporter_master.data,
expected_exporter_master, 32) != 0)
FAIL("exporter_master does not match\n");
return failures;
}