Commit ea3afecc675d6329cd1bd15bfaa044bd979204d1

Francois Perrad 2019-05-14T18:40:10

avoid shift note: redmode becomes a good candidate for a new enum

diff --git a/bn_mp_exptmod.c b/bn_mp_exptmod.c
index 9bf3d8c..95a1dcb 100644
--- a/bn_mp_exptmod.c
+++ b/bn_mp_exptmod.c
@@ -61,7 +61,7 @@ mp_err mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
 
 #ifdef BN_MP_DR_IS_MODULUS_C
    /* is it a DR modulus? */
-   dr = mp_dr_is_modulus(P) == MP_YES;
+   dr = (mp_dr_is_modulus(P) == MP_YES) ? 1 : 0;
 #else
    /* default to no */
    dr = 0;
@@ -70,7 +70,7 @@ mp_err mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y)
 #ifdef BN_MP_REDUCE_IS_2K_C
    /* if not, is it a unrestricted DR modulus? */
    if (dr == 0) {
-      dr = (mp_reduce_is_2k(P) == MP_YES) << 1;
+      dr = (mp_reduce_is_2k(P) == MP_YES) ? 2 : 0;
    }
 #endif