Commit f0da7a23 authored by Jiapeng Chong's avatar Jiapeng Chong Committed by Herbert Xu

crypto: lib/mpi - Use swap() in mpi_ec_mul_point()

Use existing swap() function rather than duplicating its implementation.

./lib/crypto/mpi/ec.c:1291:20-21: WARNING opportunity for swap().
./lib/crypto/mpi/ec.c:1292:20-21: WARNING opportunity for swap().
Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9328Signed-off-by: default avatarJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 5ca95a90
...@@ -1285,14 +1285,12 @@ void mpi_ec_mul_point(MPI_POINT result, ...@@ -1285,14 +1285,12 @@ void mpi_ec_mul_point(MPI_POINT result,
sum = &p2_; sum = &p2_;
for (j = nbits-1; j >= 0; j--) { for (j = nbits-1; j >= 0; j--) {
MPI_POINT t;
sw = mpi_test_bit(scalar, j); sw = mpi_test_bit(scalar, j);
point_swap_cond(q1, q2, sw, ctx); point_swap_cond(q1, q2, sw, ctx);
montgomery_ladder(prd, sum, q1, q2, point->x, ctx); montgomery_ladder(prd, sum, q1, q2, point->x, ctx);
point_swap_cond(prd, sum, sw, ctx); point_swap_cond(prd, sum, sw, ctx);
t = q1; q1 = prd; prd = t; swap(q1, prd);
t = q2; q2 = sum; sum = t; swap(q2, sum);
} }
mpi_clear(result->y); mpi_clear(result->y);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment