Skip to content

Commit

Permalink
Merge pull request #6 from SmarterDM/bug-remove-progmem
Browse files Browse the repository at this point in the history
Removed the PROGMEM API as was incorrectly implemented
  • Loading branch information
AndrewCarterUK authored Feb 12, 2019
2 parents e99d474 + 88e73e9 commit 3ac7255
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@
#define MUL3(x) ((x) ^ MUL2(x))
#define SUB4(x) ((s_box[((x) & 0xFF000000) >> 24] << 24) | (s_box[((x) & 0xFF0000) >> 16] << 16) | (s_box[((x) & 0xFF00) >> 8] << 8) | s_box[((x) & 0xFF)])

#ifdef __AVR
#define TARGET_FLASH_MEMORY PROGMEM
#else
#define TARGET_FLASH_MEMORY
#endif

// AES Tables

uint8_t s_box[256] TARGET_FLASH_MEMORY = {
uint8_t s_box[256] = {
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
Expand All @@ -38,7 +32,7 @@ uint8_t s_box[256] TARGET_FLASH_MEMORY = {
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
};

uint8_t s_box_inverse[256] TARGET_FLASH_MEMORY = {
uint8_t s_box_inverse[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, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB,
0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E,
Expand All @@ -57,7 +51,7 @@ uint8_t s_box_inverse[256] TARGET_FLASH_MEMORY = {
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
};

uint8_t rcon[10] TARGET_FLASH_MEMORY = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36 };
uint8_t rcon[10] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36 };

// AES Operation Definitions

Expand Down

0 comments on commit 3ac7255

Please sign in to comment.