Mailing List Archive

[PATCH] mpih_mod: avoid unintentional conditional branch
* mpi/mpih-const-time.c (_gcry_mpih_mod): Avoid conditional branch
on the_bit extraction.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
---
mpi/mpih-const-time.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mpi/mpih-const-time.c b/mpi/mpih-const-time.c
index 7246d548..74939400 100644
--- a/mpi/mpih-const-time.c
+++ b/mpi/mpih-const-time.c
@@ -204,7 +204,7 @@ _gcry_mpih_mod (mpi_ptr_t vp, mpi_size_t vsize,
unsigned int limbno = j / BITS_PER_MPI_LIMB;
unsigned int bitno = j % BITS_PER_MPI_LIMB;
mpi_limb_t limb = vp[limbno];
- unsigned int the_bit = ((limb & (A_LIMB_1 << bitno)) ? 1 : 0);
+ unsigned int the_bit = (limb >> bitno) & 1;
mpi_limb_t underflow;
mpi_limb_t overflow;

--
2.40.1


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel