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)
This commit is contained in:
parent
d59d853a6f
commit
9b82c8b1c1
1 changed files with 4 additions and 1 deletions
|
@ -1228,7 +1228,10 @@ static int pderive_test_run(EVP_TEST *t)
|
||||||
unsigned char *got = NULL;
|
unsigned char *got = NULL;
|
||||||
size_t got_len;
|
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))) {
|
if (!TEST_ptr(got = OPENSSL_malloc(got_len))) {
|
||||||
t->err = "DERIVE_ERROR";
|
t->err = "DERIVE_ERROR";
|
||||||
goto err;
|
goto err;
|
||||||
|
|
Loading…
Reference in a new issue