diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2024-08-10 08:20:59 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2024-08-17 07:55:50 +0200 |
commit | 560efa7fca4f4f5bd390e54d43cd2cd1831c60cd (patch) | |
tree | c43b63927176754a74c8631b5192d6c3cb46c0e7 | |
parent | crypto: lib/mpi - Add error checks to extension (diff) | |
download | linux-560efa7fca4f4f5bd390e54d43cd2cd1831c60cd.tar.xz linux-560efa7fca4f4f5bd390e54d43cd2cd1831c60cd.zip |
crypto: dh - Check mpi_rshift errors
Now that mpi_rshift can return errors, check them.
Fixes: 35d2bf20683f ("crypto: dh - calculate Q from P for the full public key verification")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/dh.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/dh.c b/crypto/dh.c index 68d11d66c0b5..afc0fd847761 100644 --- a/crypto/dh.c +++ b/crypto/dh.c @@ -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); |