diff options
author | ftrvxmtrx <ftrvxmtrx@gmail.com> | 2016-11-17 02:02:32 +0100 |
---|---|---|
committer | ftrvxmtrx <ftrvxmtrx@gmail.com> | 2016-11-17 02:02:32 +0100 |
commit | 8f221cfec126daa8d29bbcced20dbbe0bce0ae98 (patch) | |
tree | 5f20bc0133b1b35a3dfa7c35847d5ec26696d55b | |
parent | 1a782fda3e0fcc3205dc4b2a9b6ef3a75f68efb7 (diff) |
libsec: remove unused aes_setupDec
-rw-r--r-- | sys/src/libsec/port/aes.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/sys/src/libsec/port/aes.c b/sys/src/libsec/port/aes.c index 4a9e6dd4e..417920354 100644 --- a/sys/src/libsec/port/aes.c +++ b/sys/src/libsec/port/aes.c @@ -59,8 +59,6 @@ static uchar basekey[3][16] = { static int aes_setupEnc(ulong rk[/*4*(Nr + 1)*/], const uchar cipherKey[], int keyBits); -static int aes_setupDec(ulong rk[/*4*(Nr + 1)*/], const uchar cipherKey[], - int keyBits); static int aes_setup(ulong erk[/*4*(Nr + 1)*/], ulong drk[/*4*(Nr + 1)*/], const uchar cipherKey[], int keyBits); @@ -1049,56 +1047,6 @@ aes_setupEnc(ulong rk[/*4*(Nr + 1)*/], const uchar cipherKey[], int keyBits) return 0; } -/** - * Expand the cipher key into the decryption key schedule. - * - * @return the number of rounds for the given cipher key size. - */ -static int -aes_setupDec(ulong rk[/* 4*(Nr + 1) */], const uchar cipherKey[], int keyBits) -{ - int Nr, i, j; - ulong temp; - - /* expand the cipher key: */ - Nr = aes_setupEnc(rk, cipherKey, keyBits); - /* invert the order of the round keys: */ - for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) { - temp = rk[i ]; rk[i ] = rk[j ]; rk[j ] = temp; - temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp; - temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp; - temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp; - } - /* - * apply the inverse MixColumn transform to all round keys - * but the first and the last: - */ - for (i = 1; i < Nr; i++) { - rk += 4; - rk[0] = - Td0[Te4[(rk[0] >> 24) ]] ^ - Td1[Te4[(rk[0] >> 16) & 0xff]] ^ - Td2[Te4[(rk[0] >> 8) & 0xff]] ^ - Td3[Te4[(rk[0] ) & 0xff]]; - rk[1] = - Td0[Te4[(rk[1] >> 24) ]] ^ - Td1[Te4[(rk[1] >> 16) & 0xff]] ^ - Td2[Te4[(rk[1] >> 8) & 0xff]] ^ - Td3[Te4[(rk[1] ) & 0xff]]; - rk[2] = - Td0[Te4[(rk[2] >> 24) ]] ^ - Td1[Te4[(rk[2] >> 16) & 0xff]] ^ - Td2[Te4[(rk[2] >> 8) & 0xff]] ^ - Td3[Te4[(rk[2] ) & 0xff]]; - rk[3] = - Td0[Te4[(rk[3] >> 24) ]] ^ - Td1[Te4[(rk[3] >> 16) & 0xff]] ^ - Td2[Te4[(rk[3] >> 8) & 0xff]] ^ - Td3[Te4[(rk[3] ) & 0xff]]; - } - return Nr; -} - /* using round keys in rk, perform Nr rounds of encrypting pt into ct */ void aes_encrypt(const ulong rk[/* 4*(Nr + 1) */], int Nr, const uchar pt[16], |