Commit e1bfee62c6e9244afa8ff9f6a3cfcd1d26bfd7ac

Steffen Jaeckel 2019-03-05T08:29:29

Merge pull request #166 from fperrad/20190228_coverity explicit logical XOR

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/bn_mp_tc_xor.c b/bn_mp_tc_xor.c
index 79a02cb..9f3b6f1 100644
--- a/bn_mp_tc_xor.c
+++ b/bn_mp_tc_xor.c
@@ -64,7 +64,7 @@ int mp_tc_xor(const mp_int *a, const mp_int *b, mp_int *c)
 
    res = mp_xor(a, b, c);
 
-   if ((sa != sb) && (res == MP_OKAY)) {
+   if ((((sa == MP_NEG) && (sb != MP_NEG)) || ((sa != MP_NEG) && (sb == MP_NEG))) && (res == MP_OKAY)) {
       res = mp_sub(c, mx, c);
    }