diff options
Diffstat (limited to '')
| -rw-r--r-- | src/regress/lib/libssl/key_schedule/key_schedule.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/src/regress/lib/libssl/key_schedule/key_schedule.c b/src/regress/lib/libssl/key_schedule/key_schedule.c index 1db9214939..96d5ed3be7 100644 --- a/src/regress/lib/libssl/key_schedule/key_schedule.c +++ b/src/regress/lib/libssl/key_schedule/key_schedule.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: key_schedule.c,v 1.3 2018/11/10 00:18:25 beck Exp $ */ | 1 | /* $OpenBSD: key_schedule.c,v 1.4 2018/11/10 00:48:33 beck Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> |
| 4 | * | 4 | * |
| @@ -86,6 +86,19 @@ const uint8_t ecdhe [] = { | |||
| 86 | 0xd4, 0x62, 0x72, 0x90, 0x0f, 0x89, 0x49, 0x2d | 86 | 0xd4, 0x62, 0x72, 0x90, 0x0f, 0x89, 0x49, 0x2d |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | uint8_t csfhello [] = { | ||
| 90 | 0x96, 0x08, 0x10, 0x2a, 0x0f, 0x1c, 0xcc, 0x6d, | ||
| 91 | 0xb6, 0x25, 0x0b, 0x7b, 0x7e, 0x41, 0x7b, 0x1a, | ||
| 92 | 0x00, 0x0e, 0xaa, 0xda, 0x3d, 0xaa, 0xe4, 0x77, | ||
| 93 | 0x7a, 0x76, 0x86, 0xc9, 0xff, 0x83, 0xdf, 0x13 | ||
| 94 | }; | ||
| 95 | |||
| 96 | const struct tls13_secret csfhello_hash = { | ||
| 97 | .data = csfhello, | ||
| 98 | .len = 32, | ||
| 99 | }; | ||
| 100 | |||
| 101 | |||
| 89 | /* Expected Values */ | 102 | /* Expected Values */ |
| 90 | 103 | ||
| 91 | uint8_t expected_extracted_early[] = { | 104 | uint8_t expected_extracted_early[] = { |
| @@ -134,6 +147,20 @@ uint8_t expected_extracted_master[] = { | |||
| 134 | 0xd5, 0xa4, 0x1d, 0xa8, 0xd0, 0x40, 0x29, 0x19 | 147 | 0xd5, 0xa4, 0x1d, 0xa8, 0xd0, 0x40, 0x29, 0x19 |
| 135 | }; | 148 | }; |
| 136 | 149 | ||
| 150 | uint8_t expected_server_application_traffic[] = { | ||
| 151 | 0xa1, 0x1a, 0xf9, 0xf0, 0x55, 0x31, 0xf8, 0x56, | ||
| 152 | 0xad, 0x47, 0x11, 0x6b, 0x45, 0xa9, 0x50, 0x32, | ||
| 153 | 0x82, 0x04, 0xb4, 0xf4, 0x4b, 0xfb, 0x6b, 0x3a, | ||
| 154 | 0x4b, 0x4f, 0x1f, 0x3f, 0xcb, 0x63, 0x16, 0x43 | ||
| 155 | }; | ||
| 156 | |||
| 157 | uint8_t expected_exporter_master[] = { | ||
| 158 | 0xfe, 0x22, 0xf8, 0x81, 0x17, 0x6e, 0xda, 0x18, | ||
| 159 | 0xeb, 0x8f, 0x44, 0x52, 0x9e, 0x67, 0x92, 0xc5, | ||
| 160 | 0x0c, 0x9a, 0x3f, 0x89, 0x45, 0x2f, 0x68, 0xd8, | ||
| 161 | 0xae, 0x31, 0x1b, 0x43, 0x09, 0xd3, 0xcf, 0x50 | ||
| 162 | }; | ||
| 163 | |||
| 137 | int main () { | 164 | int main () { |
| 138 | struct tls13_secrets *secrets; | 165 | struct tls13_secrets *secrets; |
| 139 | 166 | ||
| @@ -161,9 +188,9 @@ int main () { | |||
| 161 | FAIL("derive_handshake_secrets worked when it shouldn't(2)\n"); | 188 | FAIL("derive_handshake_secrets worked when it shouldn't(2)\n"); |
| 162 | 189 | ||
| 163 | /* XXX fix hash here once test vector sorted */ | 190 | /* XXX fix hash here once test vector sorted */ |
| 164 | if (!tls13_derive_application_secrets(secrets, &cshello_hash)) | 191 | if (!tls13_derive_application_secrets(secrets, &csfhello_hash)) |
| 165 | FAIL("derive_application_secrets failed\n"); | 192 | FAIL("derive_application_secrets failed\n"); |
| 166 | if (tls13_derive_application_secrets(secrets, &cshello_hash)) | 193 | if (tls13_derive_application_secrets(secrets, &csfhello_hash)) |
| 167 | FAIL("derive_application_secrets worked when it " | 194 | FAIL("derive_application_secrets worked when it " |
| 168 | "shouldn't(2)\n"); | 195 | "shouldn't(2)\n"); |
| 169 | 196 | ||
| @@ -209,7 +236,6 @@ int main () { | |||
| 209 | expected_derived_early, 32) != 0) | 236 | expected_derived_early, 32) != 0) |
| 210 | FAIL("derived_early does not match\n"); | 237 | FAIL("derived_early does not match\n"); |
| 211 | 238 | ||
| 212 | /* XXX this is currently totally volkswagened from above */ | ||
| 213 | fprintf(stderr, "derived_handshake:\n"); | 239 | fprintf(stderr, "derived_handshake:\n"); |
| 214 | compare_data(secrets->derived_handshake.data, 32, | 240 | compare_data(secrets->derived_handshake.data, 32, |
| 215 | expected_derived_handshake, 32); | 241 | expected_derived_handshake, 32); |
| @@ -224,5 +250,19 @@ int main () { | |||
| 224 | expected_extracted_master, 32) != 0) | 250 | expected_extracted_master, 32) != 0) |
| 225 | FAIL("extracted_master does not match\n"); | 251 | FAIL("extracted_master does not match\n"); |
| 226 | 252 | ||
| 253 | fprintf(stderr, "server_application_traffic:\n"); | ||
| 254 | compare_data(secrets->server_application_traffic.data, 32, | ||
| 255 | expected_server_application_traffic, 32); | ||
| 256 | if (memcmp(secrets->server_application_traffic.data, | ||
| 257 | expected_server_application_traffic, 32) != 0) | ||
| 258 | FAIL("server_application_traffic does not match\n"); | ||
| 259 | |||
| 260 | fprintf(stderr, "exporter_master:\n"); | ||
| 261 | compare_data(secrets->exporter_master.data, 32, | ||
| 262 | expected_exporter_master, 32); | ||
| 263 | if (memcmp(secrets->exporter_master.data, | ||
| 264 | expected_exporter_master, 32) != 0) | ||
| 265 | FAIL("exporter_master does not match\n"); | ||
| 266 | |||
| 227 | return failures; | 267 | return failures; |
| 228 | } | 268 | } |
