Skip to content

Commit

Permalink
speed: Always reset the outlen when calling EVP_PKEY_derive
Browse files Browse the repository at this point in the history
Fixes openssl#18768

Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Shane Lontis <[email protected]>
Reviewed-by: Hugo Landau <[email protected]>
(Merged from openssl#18777)
  • Loading branch information
t8m authored and hlandau committed Jul 13, 2022
1 parent 9574842 commit ab8d56d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/speed.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,14 @@ static int FFDH_derive_key_loop(void *args)
loopargs_t *tempargs = *(loopargs_t **) args;
EVP_PKEY_CTX *ffdh_ctx = tempargs->ffdh_ctx[testnum];
unsigned char *derived_secret = tempargs->secret_ff_a;
size_t outlen = MAX_FFDH_SIZE;
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);
}
return count;
}
#endif /* OPENSSL_NO_DH */
Expand Down

0 comments on commit ab8d56d

Please sign in to comment.