diff options
author | jsing <> | 2018-11-09 23:57:19 +0000 |
---|---|---|
committer | jsing <> | 2018-11-09 23:57:19 +0000 |
commit | 59eceb87bc0b74974218876bf02f6119305d9af6 (patch) | |
tree | 6694506fead4473d228a2fd9960fadbc580f813a /src/regress | |
parent | 3262ad497d2c29e5159b225d7e8ff30b7d137582 (diff) | |
download | openbsd-59eceb87bc0b74974218876bf02f6119305d9af6.tar.gz openbsd-59eceb87bc0b74974218876bf02f6119305d9af6.tar.bz2 openbsd-59eceb87bc0b74974218876bf02f6119305d9af6.zip |
Update key schedule regress to match API changes.
Diffstat (limited to 'src/regress')
-rw-r--r-- | src/regress/lib/libssl/key_schedule/key_schedule.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/regress/lib/libssl/key_schedule/key_schedule.c b/src/regress/lib/libssl/key_schedule/key_schedule.c index c6d420ae56..36211644fc 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.1 2018/11/07 19:43:12 beck Exp $ */ | 1 | /* $OpenBSD: key_schedule.c,v 1.2 2018/11/09 23:57:19 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> |
4 | * | 4 | * |
@@ -137,45 +137,36 @@ uint8_t expected_extracted_master[] = { | |||
137 | int main () { | 137 | int main () { |
138 | struct tls13_secrets *secrets; | 138 | struct tls13_secrets *secrets; |
139 | 139 | ||
140 | secrets = tls13_secrets_new(32); | 140 | if ((secrets = tls13_secrets_create(EVP_sha256(), 0)) == NULL) |
141 | FAIL("failed to create secrets\n"); | ||
141 | 142 | ||
142 | if (tls13_derive_early_secrets(secrets, EVP_sha256(), | ||
143 | secrets->zeros.data, secrets->zeros.len, &chello_hash)) | ||
144 | FAIL("derive_early_secrets worked when it shouldn't\n"); | ||
145 | |||
146 | tls13_secrets_init(secrets, 0); | ||
147 | secrets->insecure = 1; /* don't explicit_bzero when done */ | 143 | secrets->insecure = 1; /* don't explicit_bzero when done */ |
148 | 144 | ||
149 | if (tls13_derive_handshake_secrets(secrets, EVP_sha256(), ecdhe, | 145 | if (tls13_derive_handshake_secrets(secrets, ecdhe, 32, &cshello_hash)) |
150 | 32, &cshello_hash)) | ||
151 | FAIL("derive_handshake_secrets worked when it shouldn't\n"); | 146 | FAIL("derive_handshake_secrets worked when it shouldn't\n"); |
152 | if (tls13_derive_application_secrets(secrets, EVP_sha256(), | 147 | if (tls13_derive_application_secrets(secrets, |
153 | &chello_hash)) | 148 | &chello_hash)) |
154 | FAIL("derive_application_secrets worked when it shouldn't\n"); | 149 | FAIL("derive_application_secrets worked when it shouldn't\n"); |
155 | 150 | ||
156 | if (!tls13_derive_early_secrets(secrets, EVP_sha256(), | 151 | if (!tls13_derive_early_secrets(secrets, |
157 | secrets->zeros.data, secrets->zeros.len, &chello_hash)) | 152 | secrets->zeros.data, secrets->zeros.len, &chello_hash)) |
158 | FAIL("derive_early_secrets failed\n"); | 153 | FAIL("derive_early_secrets failed\n"); |
159 | if (tls13_derive_early_secrets(secrets, EVP_sha256(), | 154 | if (tls13_derive_early_secrets(secrets, |
160 | secrets->zeros.data, secrets->zeros.len, &chello_hash)) | 155 | secrets->zeros.data, secrets->zeros.len, &chello_hash)) |
161 | FAIL("derive_early_secrets worked when it shouldn't(2)\n"); | 156 | FAIL("derive_early_secrets worked when it shouldn't(2)\n"); |
162 | 157 | ||
163 | if (!tls13_derive_handshake_secrets(secrets, EVP_sha256(), ecdhe, | 158 | if (!tls13_derive_handshake_secrets(secrets, ecdhe, 32, &cshello_hash)) |
164 | 32, &cshello_hash)) | ||
165 | FAIL("derive_handshake_secrets failed\n"); | 159 | FAIL("derive_handshake_secrets failed\n"); |
166 | if (tls13_derive_handshake_secrets(secrets, EVP_sha256(), ecdhe, | 160 | if (tls13_derive_handshake_secrets(secrets, ecdhe, 32, &cshello_hash)) |
167 | 32, &cshello_hash)) | ||
168 | FAIL("derive_handshake_secrets worked when it shouldn't(2)\n"); | 161 | FAIL("derive_handshake_secrets worked when it shouldn't(2)\n"); |
169 | 162 | ||
170 | /* XXX XXX this should get fixed when test vectors clarified */ | 163 | /* XXX XXX this should get fixed when test vectors clarified */ |
171 | memcpy(secrets->derived_handshake.data, expected_derived_handshake, | 164 | memcpy(secrets->derived_handshake.data, expected_derived_handshake, |
172 | 32); | 165 | 32); |
173 | /* XXX fix hash here once test vector sorted */ | 166 | /* XXX fix hash here once test vector sorted */ |
174 | if (!tls13_derive_application_secrets(secrets, EVP_sha256(), | 167 | if (!tls13_derive_application_secrets(secrets, &chello_hash)) |
175 | &chello_hash)) | ||
176 | FAIL("derive_application_secrets failed\n"); | 168 | FAIL("derive_application_secrets failed\n"); |
177 | if (tls13_derive_application_secrets(secrets, EVP_sha256(), | 169 | if (tls13_derive_application_secrets(secrets, &chello_hash)) |
178 | &chello_hash)) | ||
179 | FAIL("derive_application_secrets worked when it " | 170 | FAIL("derive_application_secrets worked when it " |
180 | "shouldn't(2)\n"); | 171 | "shouldn't(2)\n"); |
181 | 172 | ||
@@ -236,5 +227,5 @@ int main () { | |||
236 | expected_extracted_master, 32) != 0) | 227 | expected_extracted_master, 32) != 0) |
237 | FAIL("extracted_master does not match\n"); | 228 | FAIL("extracted_master does not match\n"); |
238 | 229 | ||
239 | return(failures); | 230 | return failures; |
240 | } | 231 | } |