Reorder AES data
This commit is contained in:
@@ -12,9 +12,9 @@ struct event
|
|||||||
struct aes_constants
|
struct aes_constants
|
||||||
{
|
{
|
||||||
unsigned char sbox[16][16];
|
unsigned char sbox[16][16];
|
||||||
unsigned char rc_lookup[11];
|
|
||||||
unsigned char mul2[256];
|
unsigned char mul2[256];
|
||||||
unsigned char mul3[256];
|
unsigned char mul3[256];
|
||||||
|
unsigned char rc_lookup[11];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct bern_data
|
struct bern_data
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ static const unsigned char sbox[256] =
|
|||||||
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
|
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned char rc_lookup[11] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c};
|
|
||||||
|
|
||||||
static const unsigned char mul2_lookup[256] =
|
static const unsigned char mul2_lookup[256] =
|
||||||
{
|
{
|
||||||
0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
|
0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
|
||||||
@@ -65,14 +63,16 @@ static const unsigned char mul3_lookup[256] =
|
|||||||
0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a
|
0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const unsigned char rc_lookup[11] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c};
|
||||||
|
|
||||||
struct aes_constants *get_constants()
|
struct aes_constants *get_constants()
|
||||||
{
|
{
|
||||||
struct aes_constants *res = malloc(sizeof(struct aes_constants));
|
struct aes_constants *res = malloc(sizeof(struct aes_constants));
|
||||||
|
|
||||||
memcpy(res->sbox, sbox, sizeof(sbox));
|
memcpy(res->sbox, sbox, sizeof(sbox));
|
||||||
memcpy(res->rc_lookup, rc_lookup, sizeof(rc_lookup));
|
|
||||||
memcpy(res->mul2, mul2_lookup, sizeof(mul2_lookup));
|
memcpy(res->mul2, mul2_lookup, sizeof(mul2_lookup));
|
||||||
memcpy(res->mul3, mul3_lookup, sizeof(mul3_lookup));
|
memcpy(res->mul3, mul3_lookup, sizeof(mul3_lookup));
|
||||||
|
memcpy(res->rc_lookup, rc_lookup, sizeof(rc_lookup));
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user