crypto: lib/mpi - Use swap() in mpi_ec_mul_point()
Subsystems (2)
PATCH 1/1 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().
--- lib/crypto/mpi/ec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
lib/crypto/mpi/ec.c +2 -4
@@ -1285,14 +1285,12 @@ void mpi_ec_mul_point(MPI_POINT result, sum = &p2_;for (j = nbits-1 ; j >=0 ; j--) { -MPI_POINT t; - sw =mpi_test_bit (scalar, j);point_swap_cond (q1, q2, sw, ctx);montgomery_ladder (prd, sum, q1, q2, point->x, ctx);point_swap_cond (prd, sum, sw, ctx); - t = q1; q1 = prd; prd = t; - t = q2; q2 = sum; sum = t; +swap (q1, prd); +swap (q2, sum); }mpi_clear (result->y);
Signature · 1 line
2.20.1.7.g153144c
PATCH 1/1 crypto: lib - Use swap() in mpi_powm()
Use existing swap() function rather than duplicating its implementation.
./lib/crypto/mpi/mpi-pow.c:211:11-12: WARNING opportunity for swap(). ./lib/crypto/mpi/mpi-pow.c:239:12-13: WARNING opportunity for swap().
--- lib/crypto/mpi/mpi-pow.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
lib/crypto/mpi/mpi-pow.c +2 -7
@@ -176,7 +176,6 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod)for (;;) {while (c) { -mpi_ptr_t tp;mpi_size_t xsize;/*if (mpihelp_mul_n(xp, rp, rp, rsize) < 0) goto enomem */
@@ -207,9 +206,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) xsize = msize; } - tp = rp; - rp = xp; - xp = tp; +swap (rp, xp); rsize = xsize;if ((mpi_limb_signed_t ) e <0 ) {
@@ -235,9 +232,7 @@ int mpi_powm(MPI res, MPI base, MPI exp, MPI mod) xsize = msize; } - tp = rp; - rp = xp; - xp = tp; +swap (rp, xp); rsize = xsize; } e <<=1 ;
Signature · 1 line
2.20.1.7.g153144c
Herbert Xu
maintainerRe: [PATCH] crypto: lib - Use swap() in mpi_powm()
Quoted 11 lines · Jiapeng Chong
Use existing
swap()function rather than duplicating its implementation../lib/crypto/mpi/mpi-pow.c:211:11-12: WARNING opportunity for
swap(). ./lib/crypto/mpi/mpi-pow.c:239:12-13: WARNING opportunity forswap().Reported-by Abaci Robot <[email protected]>Signed-off-by Jiapeng Chong <[email protected]>--- lib/crypto/mpi/mpi-pow.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Herbert Xu
maintainerQuoted 11 lines · Jiapeng Chong
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 forswap().Reported-by Abaci Robot <[email protected]>Signed-off-by Jiapeng Chong <[email protected]>--- lib/crypto/mpi/ec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt