lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211028003345.6970-1-yang.guang5@zte.com.cn>
Date:   Thu, 28 Oct 2021 00:33:45 +0000
From:   Yang Guang <cgel.zte@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Yang Guang <yang.guang5@....com.cn>,
        Zeal Robot <zealci@....com.cn>, linux-kernel@...r.kernel.org
Subject: [PATCH] lib/mpi: use swap() to make code cleaner

Using swap() make it more readable.

Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Yang Guang <yang.guang5@....com.cn>
---
 lib/mpi/ec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/mpi/ec.c b/lib/mpi/ec.c
index 40f5908e57a4..a2f5694425ee 100644
--- a/lib/mpi/ec.c
+++ b/lib/mpi/ec.c
@@ -1282,14 +1282,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);
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ