Skip to content

Commit

Permalink
Bug 1309159 - Fix alignment warnings in rijndael.c r=franziskus
Browse files Browse the repository at this point in the history
Differential Revision: https://nss-dev.phacility.com/D81

--HG--
extra : amend_source : 140aaa5585837f59a35542ea4a3578385e87d739
  • Loading branch information
Tim Taubert committed Oct 12, 2016
1 parent 03788a2 commit 6132751
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lib/freebl/rijndael.c
Expand Up @@ -96,10 +96,16 @@ static PRBool use_hw_gcm = PR_FALSE;

#ifdef IS_LITTLE_ENDIAN
#define WORD4(b0, b1, b2, b3) \
(((b3) << 24) | ((b2) << 16) | ((b1) << 8) | (b0))
((((PRUint32)b3) << 24) | \
(((PRUint32)b2) << 16) | \
(((PRUint32)b1) << 8) | \
((PRUint32)b0))
#else
#define WORD4(b0, b1, b2, b3) \
(((b0) << 24) | ((b1) << 16) | ((b2) << 8) | (b3))
((((PRUint32)b0) << 24) | \
(((PRUint32)b1) << 16) | \
(((PRUint32)b2) << 8) | \
((PRUint32)b3))
#endif

/*
Expand Down Expand Up @@ -349,11 +355,11 @@ init_rijndael_tables(void)
*
*************************************************************************/

#define SUBBYTE(w) \
((SBOX((w >> 24) & 0xff) << 24) | \
(SBOX((w >> 16) & 0xff) << 16) | \
(SBOX((w >> 8) & 0xff) << 8) | \
(SBOX((w)&0xff)))
#define SUBBYTE(w) \
((((PRUint32)SBOX((w >> 24) & 0xff)) << 24) | \
(((PRUint32)SBOX((w >> 16) & 0xff)) << 16) | \
(((PRUint32)SBOX((w >> 8) & 0xff)) << 8) | \
(((PRUint32)SBOX((w) & 0xff))))

#ifdef IS_LITTLE_ENDIAN
#define ROTBYTE(b) \
Expand Down Expand Up @@ -561,7 +567,7 @@ typedef union {

#define STATE_BYTE(i) state.b[i]

static SECStatus
static SECStatus NO_SANITIZE_ALIGNMENT
rijndael_encryptBlock128(AESContext *cx,
unsigned char *output,
const unsigned char *input)
Expand Down Expand Up @@ -657,7 +663,7 @@ rijndael_encryptBlock128(AESContext *cx,
return SECSuccess;
}

static SECStatus
static SECStatus NO_SANITIZE_ALIGNMENT
rijndael_decryptBlock128(AESContext *cx,
unsigned char *output,
const unsigned char *input)
Expand Down

0 comments on commit 6132751

Please sign in to comment.