mirror of
https://github.com/openssl/openssl.git
synced 2024-11-24 02:23:51 +08:00
speed: Always reset the outlen when calling EVP_PKEY_derive
Fixes #18768 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18777)
This commit is contained in:
parent
9574842e90
commit
ab8d56d05b
@ -880,11 +880,14 @@ static int FFDH_derive_key_loop(void *args)
|
|||||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||||
EVP_PKEY_CTX *ffdh_ctx = tempargs->ffdh_ctx[testnum];
|
EVP_PKEY_CTX *ffdh_ctx = tempargs->ffdh_ctx[testnum];
|
||||||
unsigned char *derived_secret = tempargs->secret_ff_a;
|
unsigned char *derived_secret = tempargs->secret_ff_a;
|
||||||
size_t outlen = MAX_FFDH_SIZE;
|
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
for (count = 0; COND(ffdh_c[testnum][0]); count++)
|
for (count = 0; COND(ffdh_c[testnum][0]); count++) {
|
||||||
|
/* outlen can be overwritten with a too small value (no padding used) */
|
||||||
|
size_t outlen = MAX_FFDH_SIZE;
|
||||||
|
|
||||||
EVP_PKEY_derive(ffdh_ctx, derived_secret, &outlen);
|
EVP_PKEY_derive(ffdh_ctx, derived_secret, &outlen);
|
||||||
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
#endif /* OPENSSL_NO_DH */
|
#endif /* OPENSSL_NO_DH */
|
||||||
|
Loading…
Reference in New Issue
Block a user