From 9b82c8b1c1823f2c1a0502a6f8eb1622714145f6 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sat, 7 Oct 2017 00:04:17 +0100 Subject: [PATCH] Don't assume shared key length matches expected length Reviewed-by: Andy Polyakov (Merged from https://github.com/openssl/openssl/pull/4485) --- test/evp_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- 2.25.1