Skip to content

Commit a939063

Browse files
committed
Fix test_ct.c build failures on gcc-9 and FIPS configs
1 parent bf535c8 commit a939063

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

test/test_ct.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
* along with wolfProvider. If not, see <http://www.gnu.org/licenses/>.
1919
*/
2020

21-
#include "unit.h"
2221
#include <wolfprovider/internal.h>
22+
#include "unit.h"
2323

2424
int test_ct_masks(void *data)
2525
{
@@ -39,6 +39,7 @@ int test_ct_masks(void *data)
3939
byte neRes = wp_ct_byte_mask_ne((byte)a, (byte)b);
4040
byte expEq = (a == b) ? 0xFF : 0x00;
4141
byte expNe = (a != b) ? 0xFF : 0x00;
42+
byte eqNeg;
4243

4344
if (eqRes != expEq) {
4445
PRINT_ERR_MSG("ct_byte_mask_eq(%d, %d) = 0x%02x, expected "
@@ -50,10 +51,11 @@ int test_ct_masks(void *data)
5051
"0x%02x", a, b, neRes, expNe);
5152
err = 1;
5253
}
53-
if ((byte)(eqRes ^ 0xFFU) != neRes) {
54+
eqNeg = (byte)(eqRes ^ (byte)0xFF);
55+
if (eqNeg != neRes) {
5456
PRINT_ERR_MSG("ct_byte_mask ne/eq mismatch at (%d, %d): "
5557
"~eq=0x%02x ne=0x%02x", a, b,
56-
(byte)~eqRes, neRes);
58+
eqNeg, neRes);
5759
err = 1;
5860
}
5961
}

0 commit comments

Comments
 (0)