* macros.h (ROTL32): New macro, to replace (almost) all other
rotation macros.
+ * aes-set-encrypt-key.c: Include macros.h.
+ (aes_set_encrypt_key): Use ROTL32.
+ * aes-internal.h (ROTBYTE, ROTRBYTE): Deleted macros.
2012-03-30 Niels Möller <nisse@lysator.liu.se>
const uint8_t *src);
/* Macros */
-#define ROTBYTE(x) (((x) >> 8) | (((x) & 0xff) << 24))
-#define ROTRBYTE(x) (((x) << 8) | (((x) >> 24) & 0xff))
#define SUBBYTE(x, box) (((box)[((x) & 0xff)]) | \
((box)[(((x) >> 8) & 0xff)] << 8) | \
((box)[(((x) >> 16) & 0xff)] << 16) | \
#include <assert.h>
#include "aes-internal.h"
+#include "macros.h"
static unsigned
xtime(unsigned x)
temp = ctx->keys[i-1];
if (i % nk == 0)
{
- temp = SUBBYTE(ROTBYTE(temp), aes_sbox) ^ rcon;
+ temp = SUBBYTE(ROTL32(24, temp), aes_sbox) ^ rcon;
rcon = (uint32_t)xtime((uint8_t)rcon&0xff);
}
else if (nk > 6 && (i%nk) == 4)