Merge pull request #7094 from dgarske/armasm_thumb_aes

Fixes for ARM ASM with Thumb
This commit is contained in:
Sean Parkinson
2024-01-07 15:10:16 +10:00
committed by GitHub
4 changed files with 57 additions and 87 deletions
+6 -6
View File
@@ -2889,7 +2889,7 @@ static WARN_UNUSED_RESULT WC_INLINE word32 PreFetchTd(void)
}
return x;
}
#endif
#endif /* !WOLFSSL_AES_SMALL_TABLES */
/* load Td Table4 into cache by cache line stride */
static WARN_UNUSED_RESULT WC_INLINE word32 PreFetchTd4(void)
@@ -2906,7 +2906,7 @@ static WARN_UNUSED_RESULT WC_INLINE word32 PreFetchTd4(void)
return 0;
#endif
}
#endif
#endif /* !WC_NO_CACHE_RESISTANT */
/* Decrypt a block using AES.
*
@@ -3161,7 +3161,7 @@ static void AesDecryptBlocks_C(Aes* aes, const byte* in, byte* out, word32 sz)
}
#endif
#else
#else /* WC_AES_BITSLICED */
/* http://cs-www.cs.yale.edu/homes/peralta/CircuitStuff/Sinv.txt */
static void bs_inv_sub_bytes(bs_word u[8])
@@ -3501,7 +3501,7 @@ static void AesDecryptBlocks_C(Aes* aes, const byte* in, byte* out, word32 sz)
}
#endif
#endif
#endif /* !WC_AES_BITSLICED */
#if !defined(WC_AES_BITSLICED) || defined(WOLFSSL_AES_DIRECT)
/* Software AES - ECB Decrypt */
@@ -11410,7 +11410,7 @@ static WARN_UNUSED_RESULT int _AesEcbEncrypt(
else
#endif
{
#ifndef WOLFSSL_ARMASM
#ifdef NEED_AES_TABLES
AesEncryptBlocks_C(aes, in, out, sz);
#else
word32 i;
@@ -11461,7 +11461,7 @@ static WARN_UNUSED_RESULT int _AesEcbDecrypt(
else
#endif
{
#ifndef WOLFSSL_ARMASM
#ifdef NEED_AES_TABLES
AesDecryptBlocks_C(aes, in, out, sz);
#else
word32 i;
+4 -4
View File
@@ -54,7 +54,7 @@
#include <wolfssl/wolfcrypt/aes.h>
#ifdef HAVE_AES_DECRYPT
static const uint32_t L_AES_Thumb2_td_data[] = {
XALIGNED(16) static const uint32_t L_AES_Thumb2_td_data[] = {
0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e,
0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303,
0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c,
@@ -123,7 +123,7 @@ static const uint32_t L_AES_Thumb2_td_data[] = {
#endif /* HAVE_AES_DECRYPT */
#if defined(HAVE_AES_DECRYPT) || defined(HAVE_AES_CBC) || defined(HAVE_AESCCM) || defined(HAVE_AESGCM) || defined(WOLFSSL_AES_DIRECT) || defined(WOLFSSL_AES_COUNTER)
static const uint32_t L_AES_Thumb2_te_data[] = {
XALIGNED(16) static const uint32_t L_AES_Thumb2_te_data[] = {
0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b,
0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5,
0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b,
@@ -319,7 +319,7 @@ void AES_invert_key(unsigned char* ks, word32 rounds)
}
#endif /* HAVE_AES_DECRYPT */
static const uint32_t L_AES_Thumb2_rcon[] = {
XALIGNED(16) static const uint32_t L_AES_Thumb2_rcon[] = {
0x01000000, 0x02000000, 0x04000000, 0x08000000,
0x10000000, 0x20000000, 0x40000000, 0x80000000,
0x1b000000, 0x36000000
@@ -2205,7 +2205,7 @@ void AES_CBC_decrypt(const unsigned char* in, unsigned char* out, unsigned long
#endif /* WOLFSSL_AES_DIRECT || WOLFSSL_AES_COUNTER || HAVE_AES_CBC */
#endif /* HAVE_AES_DECRYPT */
#ifdef HAVE_AESGCM
static const uint32_t L_GCM_gmult_len_r[] = {
XALIGNED(16) static const uint32_t L_GCM_gmult_len_r[] = {
0x00000000, 0x1c200000, 0x38400000, 0x24600000,
0x70800000, 0x6ca00000, 0x48c00000, 0x54e00000,
0xe1000000, 0xfd200000, 0xd9400000, 0xc5600000,
+1 -1
View File
@@ -54,7 +54,7 @@
#include <wolfssl/wolfcrypt/sha256.h>
#ifdef WOLFSSL_ARMASM_NO_NEON
static const uint32_t L_SHA256_transform_len_k[] = {
XALIGNED(16) static const uint32_t L_SHA256_transform_len_k[] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,