aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorConstanza Heath <[email protected]>2015-08-28 18:14:01 -0700
committerConstanza Heath <[email protected]>2015-08-28 18:14:01 -0700
commit731a8e749b9114097dbb9b86117f5f8c1bb109a1 (patch)
tree82cf606ffc4ec95e908974a9d42c6ae3ce0679f9 /lib
parentd4a326a167f0fef3bef8b2771297b0cc4ea2f3dc (diff)
Change macro of ROTWORD to inline function
Signed-off-by: Constanza Heath <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/aes_decrypt.c1
-rw-r--r--lib/aes_encrypt.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/aes_decrypt.c b/lib/aes_decrypt.c
index a1b5272..d32b491 100644
--- a/lib/aes_decrypt.c
+++ b/lib/aes_decrypt.c
@@ -38,6 +38,7 @@
#include <utils.h>
#define ZERO_BYTE 0x00
+
static const uint8_t inv_sbox[256] = {
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
diff --git a/lib/aes_encrypt.c b/lib/aes_encrypt.c
index 3011394..909314a 100644
--- a/lib/aes_encrypt.c
+++ b/lib/aes_encrypt.c
@@ -62,7 +62,10 @@ static const uint8_t sbox[256] = {
0xb0, 0x54, 0xbb, 0x16
};
-#define rotword(a) (((a)>>24)|((a)<<8))
+static inline uint32_t rotword (uint32_t a) {
+ return (((a)>>24)|((a)<<8));
+}
+
#define subbyte(a,o) (sbox[((a)>>(o))&0xff]<<(o))
#define subword(a) (subbyte(a,24)|subbyte(a,16)|subbyte(a,8)|subbyte(a,0))