summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2017-03-18 12:59:07 +0000
committerjsing <>2017-03-18 12:59:07 +0000
commitb2dded4872634b618503be0a392c7b7da7ae4a2c (patch)
tree352d9f67afccc0161389b411f0835645b741c4c9
parent6c55a7efb3abec4388f94455e4f9a2ddd3bc326a (diff)
downloadopenbsd-b2dded4872634b618503be0a392c7b7da7ae4a2c.tar.gz
openbsd-b2dded4872634b618503be0a392c7b7da7ae4a2c.tar.bz2
openbsd-b2dded4872634b618503be0a392c7b7da7ae4a2c.zip
Update regress and remove temporary buffer to match changes in tls_PRF().
-rw-r--r--src/regress/lib/libssl/unit/tls_prf.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/regress/lib/libssl/unit/tls_prf.c b/src/regress/lib/libssl/unit/tls_prf.c
index c6891eeea8..ab92547ad5 100644
--- a/src/regress/lib/libssl/unit/tls_prf.c
+++ b/src/regress/lib/libssl/unit/tls_prf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_prf.c,v 1.1 2017/03/10 15:06:15 jsing Exp $ */ 1/* $OpenBSD: tls_prf.c,v 1.2 2017/03/18 12:59:07 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -22,7 +22,7 @@
22int tls1_PRF(SSL *s, const void *seed1, int seed1_len, const void *seed2, 22int tls1_PRF(SSL *s, const void *seed1, int seed1_len, const void *seed2,
23 int seed2_len, const void *seed3, int seed3_len, const void *seed4, 23 int seed2_len, const void *seed3, int seed3_len, const void *seed4,
24 int seed4_len, const void *seed5, int seed5_len, const unsigned char *sec, 24 int seed4_len, const void *seed5, int seed5_len, const unsigned char *sec,
25 int slen, unsigned char *out1, unsigned char *out2, int olen); 25 int slen, unsigned char *out, int olen);
26 26
27#define TLS_PRF_OUT_LEN 128 27#define TLS_PRF_OUT_LEN 128
28 28
@@ -175,7 +175,7 @@ hexdump(const unsigned char *buf, size_t len)
175static int 175static int
176do_tls_prf_test(int test_no, struct tls_prf_test *tpt) 176do_tls_prf_test(int test_no, struct tls_prf_test *tpt)
177{ 177{
178 unsigned char *out = NULL, *tmp = NULL; 178 unsigned char *out = NULL;
179 const SSL_CIPHER *cipher; 179 const SSL_CIPHER *cipher;
180 SSL_CTX *ssl_ctx = NULL; 180 SSL_CTX *ssl_ctx = NULL;
181 SSL *ssl = NULL; 181 SSL *ssl = NULL;
@@ -186,8 +186,6 @@ do_tls_prf_test(int test_no, struct tls_prf_test *tpt)
186 186
187 if ((out = malloc(TLS_PRF_OUT_LEN)) == NULL) 187 if ((out = malloc(TLS_PRF_OUT_LEN)) == NULL)
188 errx(1, "failed to allocate out"); 188 errx(1, "failed to allocate out");
189 if ((tmp = malloc(TLS_PRF_OUT_LEN)) == NULL)
190 errx(1, "failed to allocate tmp");
191 189
192 if ((ssl_ctx = SSL_CTX_new(tpt->ssl_method())) == NULL) 190 if ((ssl_ctx = SSL_CTX_new(tpt->ssl_method())) == NULL)
193 errx(1, "failed to create SSL context"); 191 errx(1, "failed to create SSL context");
@@ -203,13 +201,12 @@ do_tls_prf_test(int test_no, struct tls_prf_test *tpt)
203 201
204 for (len = 1; len <= TLS_PRF_OUT_LEN; len++) { 202 for (len = 1; len <= TLS_PRF_OUT_LEN; len++) {
205 memset(out, 'A', TLS_PRF_OUT_LEN); 203 memset(out, 'A', TLS_PRF_OUT_LEN);
206 memset(tmp, 'B', TLS_PRF_OUT_LEN);
207 204
208 if (tls1_PRF(ssl, TLS_PRF_SEED1, sizeof(TLS_PRF_SEED1), 205 if (tls1_PRF(ssl, TLS_PRF_SEED1, sizeof(TLS_PRF_SEED1),
209 TLS_PRF_SEED2, sizeof(TLS_PRF_SEED2), TLS_PRF_SEED3, 206 TLS_PRF_SEED2, sizeof(TLS_PRF_SEED2), TLS_PRF_SEED3,
210 sizeof(TLS_PRF_SEED3), TLS_PRF_SEED4, sizeof(TLS_PRF_SEED4), 207 sizeof(TLS_PRF_SEED3), TLS_PRF_SEED4, sizeof(TLS_PRF_SEED4),
211 TLS_PRF_SEED5, sizeof(TLS_PRF_SEED5), TLS_PRF_SECRET, 208 TLS_PRF_SEED5, sizeof(TLS_PRF_SEED5), TLS_PRF_SECRET,
212 sizeof(TLS_PRF_SECRET), out, tmp, len) != 1) { 209 sizeof(TLS_PRF_SECRET), out, len) != 1) {
213 fprintf(stderr, "FAIL: tls_PRF failed for len %i\n", 210 fprintf(stderr, "FAIL: tls_PRF failed for len %i\n",
214 len); 211 len);
215 goto failure; 212 goto failure;
@@ -234,7 +231,6 @@ do_tls_prf_test(int test_no, struct tls_prf_test *tpt)
234 SSL_CTX_free(ssl_ctx); 231 SSL_CTX_free(ssl_ctx);
235 232
236 free(out); 233 free(out);
237 free(tmp);
238 234
239 return failure; 235 return failure;
240} 236}