summaryrefslogtreecommitdiffstats
path: root/test/evp_test.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2017-10-07 00:04:17 +0100
committerDr. Stephen Henson <steve@openssl.org>2017-10-12 02:40:30 +0100
commit9b82c8b1c1823f2c1a0502a6f8eb1622714145f6 (patch)
treea6096eefc68ced4875420a73179f1f5d9195c247 /test/evp_test.c
parentd59d853a6f907c3449c9ad36d5814fb287e6ff05 (diff)
Don't assume shared key length matches expected length
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4485)
Diffstat (limited to 'test/evp_test.c')
-rw-r--r--test/evp_test.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index b08114e827..265a4c3dd4 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -1228,7 +1228,10 @@ static int pderive_test_run(EVP_TEST *t)
unsigned char *got = NULL;
size_t got_len;
- got_len = expected->output_len;
+ if (EVP_PKEY_derive(expected->ctx, NULL, &got_len) <= 0) {
+ t->err = "DERIVE_ERROR";
+ goto err;
+ }
if (!TEST_ptr(got = OPENSSL_malloc(got_len))) {
t->err = "DERIVE_ERROR";
goto err;