Skip to content

Commit

Permalink
crypto: lib/mpi - delete unnecessary condition
Browse files Browse the repository at this point in the history
We checked that "nlimbs" is non-zero in the outside if statement so delete
the duplicate check here.

Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Tianjia Zhang <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Dan Carpenter authored and herbertx committed Jul 12, 2024
1 parent 101e99c commit fe69b77
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/crypto/mpi/mpi-bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,10 @@ void mpi_rshift(MPI x, MPI a, unsigned int n)
return;
}

if (nlimbs) {
for (i = 0; i < x->nlimbs - nlimbs; i++)
x->d[i] = x->d[i+nlimbs];
x->d[i] = 0;
x->nlimbs -= nlimbs;
}
for (i = 0; i < x->nlimbs - nlimbs; i++)
x->d[i] = x->d[i+nlimbs];
x->d[i] = 0;
x->nlimbs -= nlimbs;

if (x->nlimbs && nbits)
mpihelp_rshift(x->d, x->d, x->nlimbs, nbits);
Expand Down

0 comments on commit fe69b77

Please sign in to comment.