Refactor signing backend (#690)

Cleaned up the AES driver and removed some cppcheck isues
in the process.
This commit is contained in:
Patrick Fallberg
2016-12-25 16:12:40 +01:00
committed by Henrik Ekblad
parent 61e6cecb3f
commit 1040fbebc5
27 changed files with 398 additions and 14004 deletions
+6 -1
View File
@@ -104,7 +104,7 @@ const static byte s_inv [0x100] PROGMEM = {
} ;
// times 2 in the GF(2^8)
#define f2(x) ((x) & 0x80 ? (x << 1) ^ WPOLY : x << 1)
#define f2(x) (((x) & 0x80) ? (x << 1) ^ WPOLY : x << 1)
#define d2(x) (((x) >> 1) ^ ((x) & 1 ? DPOLY : 0))
static byte s_box (byte x)
@@ -248,6 +248,11 @@ static void inv_mix_sub_columns (byte dt[N_BLOCK], byte st[N_BLOCK])
AES::AES()
{
byte ar_iv[8] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01 };
IVC = 0x01;
round = 0;
pad = 0;
size = 0;
memset(key_sched, 0, KEY_SCHEDULE_BYTES);
memcpy(iv,ar_iv,8);
memcpy(iv+8,ar_iv,8);
arr_pad[0] = 0x01;