Skip to content

Commit

Permalink
crypto: dh - Check mpi_rshift errors
Browse files Browse the repository at this point in the history
Now that mpi_rshift can return errors, check them.

Fixes: 35d2bf2 ("crypto: dh - calculate Q from P for the full public key verification")
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Aug 17, 2024
1 parent 8e3a67f commit 560efa7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ static int dh_is_pubkey_valid(struct dh_ctx *ctx, MPI y)
* ->p is odd, so no need to explicitly subtract one
* from it before shifting to the right.
*/
mpi_rshift(q, ctx->p, 1);
ret = mpi_rshift(q, ctx->p, 1) ?:
mpi_powm(val, y, q, ctx->p);

ret = mpi_powm(val, y, q, ctx->p);
mpi_free(q);
if (ret) {
mpi_free(val);
Expand Down

0 comments on commit 560efa7

Please sign in to comment.