Skip to content

Commit 5c52734

Browse files
cheri: Use macro for cache line masking
This caused problems on CHERI with bounds violations. The code assumes WC_CACHE_LINE_SZ == 64 and perhaps this is not the case. Signed-off-by: William Beasley (The Capable Hub) <wbeasley@thegoodpenguin.co.uk>
1 parent 353a379 commit 5c52734

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

wolfcrypt/src/aes.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,14 +2151,14 @@ static void XorTable_Multi(const word32* t, word32* t0, byte o0,
21512151
word32 e1 = 0;
21522152
word32 e2 = 0;
21532153
word32 e3 = 0;
2154-
byte hi0 = o0 & 0xf0;
2155-
byte lo0 = o0 & 0x0f;
2156-
byte hi1 = o1 & 0xf0;
2157-
byte lo1 = o1 & 0x0f;
2158-
byte hi2 = o2 & 0xf0;
2159-
byte lo2 = o2 & 0x0f;
2160-
byte hi3 = o3 & 0xf0;
2161-
byte lo3 = o3 & 0x0f;
2154+
byte hi0 = o0 & WC_CACHE_LINE_MASK_HI;
2155+
byte lo0 = o0 & WC_CACHE_LINE_MASK_LO;
2156+
byte hi1 = o1 & WC_CACHE_LINE_MASK_HI;
2157+
byte lo1 = o1 & WC_CACHE_LINE_MASK_LO;
2158+
byte hi2 = o2 & WC_CACHE_LINE_MASK_HI;
2159+
byte lo2 = o2 & WC_CACHE_LINE_MASK_LO;
2160+
byte hi3 = o3 & WC_CACHE_LINE_MASK_HI;
2161+
byte lo3 = o3 & WC_CACHE_LINE_MASK_LO;
21622162
int i;
21632163

21642164
for (i = 0; i < 256; i += (1 << WC_CACHE_LINE_BITS)) {

0 commit comments

Comments
 (0)