Skip to content
This repository was archived by the owner on Mar 5, 2024. It is now read-only.

Commit 731a8e7

Browse files
author
Constanza Heath
committed
Change macro of ROTWORD to inline function
Signed-off-by: Constanza Heath <[email protected]>
1 parent d4a326a commit 731a8e7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/aes_decrypt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <utils.h>
3939

4040
#define ZERO_BYTE 0x00
41+
4142
static const uint8_t inv_sbox[256] = {
4243
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
4344
0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,

lib/aes_encrypt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ static const uint8_t sbox[256] = {
6262
0xb0, 0x54, 0xbb, 0x16
6363
};
6464

65-
#define rotword(a) (((a)>>24)|((a)<<8))
65+
static inline uint32_t rotword (uint32_t a) {
66+
return (((a)>>24)|((a)<<8));
67+
}
68+
6669
#define subbyte(a,o) (sbox[((a)>>(o))&0xff]<<(o))
6770
#define subword(a) (subbyte(a,24)|subbyte(a,16)|subbyte(a,8)|subbyte(a,0))
6871

0 commit comments

Comments
 (0)