More dependency fixes
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
34152a48d4
commit
ad4e76be57
1 changed files with 19 additions and 1 deletions
|
@ -55,6 +55,7 @@ static int aes_padlock_ace = -1;
|
||||||
/*
|
/*
|
||||||
* Forward S-box
|
* Forward S-box
|
||||||
*/
|
*/
|
||||||
|
#if !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
|
||||||
static const unsigned char FSb[256] =
|
static const unsigned char FSb[256] =
|
||||||
{
|
{
|
||||||
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5,
|
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5,
|
||||||
|
@ -90,6 +91,7 @@ static const unsigned char FSb[256] =
|
||||||
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68,
|
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68,
|
||||||
0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
|
0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
|
||||||
};
|
};
|
||||||
|
#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Forward tables
|
* Forward tables
|
||||||
|
@ -161,6 +163,7 @@ static const unsigned char FSb[256] =
|
||||||
V(C3, 41, 41, 82), V(B0, 99, 99, 29), V(77, 2D, 2D, 5A), V(11, 0F, 0F, 1E), \
|
V(C3, 41, 41, 82), V(B0, 99, 99, 29), V(77, 2D, 2D, 5A), V(11, 0F, 0F, 1E), \
|
||||||
V(CB, B0, B0, 7B), V(FC, 54, 54, A8), V(D6, BB, BB, 6D), V(3A, 16, 16, 2C)
|
V(CB, B0, B0, 7B), V(FC, 54, 54, A8), V(D6, BB, BB, 6D), V(3A, 16, 16, 2C)
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_AES_ENCRYPT_ALT)
|
||||||
#define V(a, b, c, d) 0x##a##b##c##d
|
#define V(a, b, c, d) 0x##a##b##c##d
|
||||||
static const uint32_t FT0[256] = { FT };
|
static const uint32_t FT0[256] = { FT };
|
||||||
#undef V
|
#undef V
|
||||||
|
@ -179,11 +182,13 @@ static const uint32_t FT2[256] = { FT };
|
||||||
static const uint32_t FT3[256] = { FT };
|
static const uint32_t FT3[256] = { FT };
|
||||||
#undef V
|
#undef V
|
||||||
|
|
||||||
|
#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) */
|
||||||
|
|
||||||
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
||||||
|
|
||||||
#undef FT
|
#undef FT
|
||||||
|
|
||||||
#if !(defined(MBEDTLS_AES_SETKEY_ENC_ALT) && defined(MBEDTLS_AES_DECRYPT_ALT))
|
#if !defined(MBEDTLS_AES_DECRYPT_ALT)
|
||||||
/*
|
/*
|
||||||
* Reverse S-box
|
* Reverse S-box
|
||||||
*/
|
*/
|
||||||
|
@ -294,6 +299,8 @@ static const unsigned char RSb[256] =
|
||||||
V(71, 01, A8, 39), V(DE, B3, 0C, 08), V(9C, E4, B4, D8), V(90, C1, 56, 64), \
|
V(71, 01, A8, 39), V(DE, B3, 0C, 08), V(9C, E4, B4, D8), V(90, C1, 56, 64), \
|
||||||
V(61, 84, CB, 7B), V(70, B6, 32, D5), V(74, 5C, 6C, 48), V(42, 57, B8, D0)
|
V(61, 84, CB, 7B), V(70, B6, 32, D5), V(74, 5C, 6C, 48), V(42, 57, B8, D0)
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
|
||||||
|
|
||||||
#define V(a, b, c, d) 0x##a##b##c##d
|
#define V(a, b, c, d) 0x##a##b##c##d
|
||||||
static const uint32_t RT0[256] = { RT };
|
static const uint32_t RT0[256] = { RT };
|
||||||
#undef V
|
#undef V
|
||||||
|
@ -312,6 +319,8 @@ static const uint32_t RT2[256] = { RT };
|
||||||
static const uint32_t RT3[256] = { RT };
|
static const uint32_t RT3[256] = { RT };
|
||||||
#undef V
|
#undef V
|
||||||
|
|
||||||
|
#endif /* !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC) */
|
||||||
|
|
||||||
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
||||||
|
|
||||||
#undef RT
|
#undef RT
|
||||||
|
@ -333,13 +342,17 @@ static const uint32_t RCON[10] =
|
||||||
/*
|
/*
|
||||||
* Forward S-box & tables
|
* Forward S-box & tables
|
||||||
*/
|
*/
|
||||||
|
#if !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
|
||||||
static unsigned char FSb[256];
|
static unsigned char FSb[256];
|
||||||
|
#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */
|
||||||
|
#if !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
|
||||||
static uint32_t FT0[256];
|
static uint32_t FT0[256];
|
||||||
#if !defined(MBEDTLS_AES_FEWER_TABLES)
|
#if !defined(MBEDTLS_AES_FEWER_TABLES)
|
||||||
static uint32_t FT1[256];
|
static uint32_t FT1[256];
|
||||||
static uint32_t FT2[256];
|
static uint32_t FT2[256];
|
||||||
static uint32_t FT3[256];
|
static uint32_t FT3[256];
|
||||||
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
||||||
|
#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reverse S-box & tables
|
* Reverse S-box & tables
|
||||||
|
@ -347,11 +360,14 @@ static uint32_t FT3[256];
|
||||||
#if !(defined(MBEDTLS_AES_SETKEY_ENC_ALT) && defined(MBEDTLS_AES_DECRYPT_ALT))
|
#if !(defined(MBEDTLS_AES_SETKEY_ENC_ALT) && defined(MBEDTLS_AES_DECRYPT_ALT))
|
||||||
static unsigned char RSb[256];
|
static unsigned char RSb[256];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
|
||||||
static uint32_t RT0[256];
|
static uint32_t RT0[256];
|
||||||
#if !defined(MBEDTLS_AES_FEWER_TABLES)
|
#if !defined(MBEDTLS_AES_FEWER_TABLES)
|
||||||
static uint32_t RT1[256];
|
static uint32_t RT1[256];
|
||||||
static uint32_t RT2[256];
|
static uint32_t RT2[256];
|
||||||
static uint32_t RT3[256];
|
static uint32_t RT3[256];
|
||||||
|
#endif /* !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */
|
||||||
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
||||||
|
|
||||||
#if !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
|
#if !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
|
||||||
|
@ -432,6 +448,7 @@ static void aes_gen_tables(void)
|
||||||
|
|
||||||
x = RSb[i];
|
x = RSb[i];
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
|
||||||
RT0[i] = ((uint32_t) MUL(0x0E, x)) ^
|
RT0[i] = ((uint32_t) MUL(0x0E, x)) ^
|
||||||
((uint32_t) MUL(0x09, x) << 8) ^
|
((uint32_t) MUL(0x09, x) << 8) ^
|
||||||
((uint32_t) MUL(0x0D, x) << 16) ^
|
((uint32_t) MUL(0x0D, x) << 16) ^
|
||||||
|
@ -442,6 +459,7 @@ static void aes_gen_tables(void)
|
||||||
RT2[i] = ROTL8(RT1[i]);
|
RT2[i] = ROTL8(RT1[i]);
|
||||||
RT3[i] = ROTL8(RT2[i]);
|
RT3[i] = ROTL8(RT2[i]);
|
||||||
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
#endif /* !MBEDTLS_AES_FEWER_TABLES */
|
||||||
|
#endif /* !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue