cast result of bitwise not back to original type to prevent compiler warnings

pull/1669/head
Chris Conlon 2018-07-12 13:46:55 -06:00
parent 0f2b5ca181
commit cadd556b3a
4 changed files with 5 additions and 5 deletions

View File

@ -12145,7 +12145,7 @@ int TimingPadVerify(WOLFSSL* ssl, const byte* input, int padLen, int macSz,
good |= MaskMac(input, pLen, ssl->specs.hash_size, verify);
/* Non-zero on failure. */
good = ~(word32)good;
good = (byte)~(word32)good;
good &= good >> 4;
good &= good >> 2;
good &= good >> 1;

View File

@ -1129,8 +1129,8 @@ static int Hmac_UpdateFinal_CT(Hmac* hmac, byte* digest, const byte* in,
b = in[k - WOLFSSL_TLS_HMAC_INNER_SZ];
b = ctMaskSel(atEoc, b, 0x80);
b &= ~(word32)pastEoc;
b &= ~(word32)isOutBlock | isEocBlock;
b &= (unsigned char)~(word32)pastEoc;
b &= ((unsigned char)~(word32)isOutBlock) | isEocBlock;
if (j >= blockSz - 8) {
b = ctMaskSel(isOutBlock, b, lenBytes[j - (blockSz - 8)]);

View File

@ -1353,7 +1353,7 @@ static int wc_ecc_curve_load(const ecc_set_type* dp, ecc_curve_spec** pCurve,
curve->dp = dp; /* set dp info */
/* determine items to load */
load_items = (~(word32)curve->load_mask & load_mask);
load_items = (((byte)~(word32)curve->load_mask) & load_mask);
curve->load_mask |= load_items;
/* load items */

View File

@ -344,7 +344,7 @@ STATIC WC_INLINE byte ctMaskEq(int a, int b)
/* Constant time - select b when mask is set and a otherwise. */
STATIC WC_INLINE byte ctMaskSel(byte m, byte a, byte b)
{
return (a & ~(word32)m) | (b & m);
return (a & ((byte)~(word32)m)) | (b & m);
}
/* Constant time - bit set when a <= b. */