From: Dr. Stephen Henson Date: Fri, 6 Oct 2017 23:04:17 +0000 (+0100) Subject: Don't assume shared key length matches expected length X-Git-Tag: OpenSSL_1_1_1-pre1~561 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9b82c8b1c1823f2c1a0502a6f8eb1622714145f6;p=oweals%2Fopenssl.git Don't assume shared key length matches expected length Reviewed-by: Andy Polyakov (Merged from https://github.com/openssl/openssl/pull/4485) --- 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;