forked from wolfSSL/wolfssl
aes.c cleaned. ti-has.c, ti-aes.c, ti-des3.c are included in each respective algorithm source file.
This commit is contained in:
@@ -174,6 +174,11 @@ void wc_AesFreeCavium(Aes* aes)
|
||||
}
|
||||
#endif
|
||||
#else /* HAVE_FIPS */
|
||||
|
||||
#ifdef WOLFSSL_TI_CRYPT
|
||||
#include <wolfcrypt/src/port/ti/ti-aes.c>
|
||||
#else
|
||||
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
#ifdef NO_INLINE
|
||||
@@ -230,10 +235,6 @@ void wc_AesFreeCavium(Aes* aes)
|
||||
word32 length);
|
||||
static int wc_AesCaviumCbcDecrypt(Aes* aes, byte* out, const byte* in,
|
||||
word32 length);
|
||||
#elif defined(WOLFSSL_TI_CRYPT)
|
||||
|
||||
/* defined in port/ti_aes.c */
|
||||
|
||||
#else
|
||||
/* using CTaoCrypt software AES implementation */
|
||||
#define NEED_AES_TABLES
|
||||
@@ -1509,11 +1510,6 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
||||
{
|
||||
return wc_AesSetKey(aes, userKey, keylen, iv, dir);
|
||||
}
|
||||
|
||||
#elif defined(WOLFSSL_TI_CRYPT)
|
||||
|
||||
/* defined in port/ti_md5.c */
|
||||
|
||||
#else
|
||||
static int wc_AesSetKeyLocal(Aes* aes, const byte* userKey, word32 keylen,
|
||||
const byte* iv, int dir)
|
||||
@@ -1784,10 +1780,6 @@ int wc_AesCbcDecryptWithKey(byte* out, const byte* in, word32 inSz,
|
||||
#elif defined(WOLFSSL_PIC32MZ_CRYPT)
|
||||
#error "PIC32MZ doesn't yet support AES direct"
|
||||
|
||||
#elif defined(WOLFSSL_TI_CRYPT)
|
||||
|
||||
/* defined in port/ti_aes.c */
|
||||
|
||||
#else
|
||||
/* Allow direct access to one block encrypt */
|
||||
void wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in)
|
||||
@@ -2322,10 +2314,6 @@ int wc_AesCbcDecryptWithKey(byte* out, const byte* in, word32 inSz,
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
#elif defined(WOLFSSL_TI_CRYPT)
|
||||
|
||||
/* defined in port/ti_aes.c */
|
||||
|
||||
#else
|
||||
int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
@@ -2606,10 +2594,7 @@ int wc_AesCbcDecryptWithKey(byte* out, const byte* in, word32 inSz,
|
||||
|
||||
#elif defined(FREESCALE_MMCAU)
|
||||
#error "Freescale mmCAU doesn't currently support AES-CTR mode"
|
||||
|
||||
#elif defined(WOLFSSL_TI_CRYPT)
|
||||
/* defined in port/ti/ti_aes.c */
|
||||
|
||||
|
||||
#else
|
||||
/* Increment AES counter */
|
||||
static INLINE void IncrementAesCounter(byte* inOutCtr)
|
||||
@@ -2691,7 +2676,7 @@ enum {
|
||||
CTR_SZ = 4
|
||||
};
|
||||
|
||||
#if !defined(WOLFSSL_TI_CRYPT)
|
||||
|
||||
static INLINE void InitGcmCounter(byte* inOutCtr)
|
||||
{
|
||||
inOutCtr[AES_BLOCK_SIZE - 4] = 0;
|
||||
@@ -2796,10 +2781,6 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len)
|
||||
if (ret == 0) {
|
||||
#ifdef FREESCALE_MMCAU
|
||||
cau_aes_encrypt(iv, rk, aes->rounds, aes->H);
|
||||
|
||||
#elif defined(WOLFSSL_TI_CRYPT)
|
||||
/* defined in port/ti/ti_aes.c */
|
||||
|
||||
#else
|
||||
wc_AesEncrypt(aes, iv, aes->H);
|
||||
#endif
|
||||
@@ -3313,7 +3294,8 @@ static void GHASH(Aes* aes, const byte* a, word32 aSz,
|
||||
}
|
||||
|
||||
#endif /* end GCM_WORD32 */
|
||||
|
||||
|
||||
|
||||
int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
|
||||
const byte* iv, word32 ivSz,
|
||||
byte* authTag, word32 authTagSz,
|
||||
@@ -3468,7 +3450,8 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
WOLFSSL_API int wc_GmacSetKey(Gmac* gmac, const byte* key, word32 len)
|
||||
{
|
||||
@@ -3500,7 +3483,6 @@ WOLFSSL_API int wc_GmacUpdate(Gmac* gmac, const byte* iv, word32 ivSz,
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(WOLFSSL_TI_CRYPT)
|
||||
void wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz)
|
||||
{
|
||||
byte nonce[AES_BLOCK_SIZE];
|
||||
@@ -3781,7 +3763,6 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* WOLFCRYPT_TI_CRYPT */
|
||||
|
||||
#endif /* HAVE_AESCCM */
|
||||
|
||||
@@ -3909,6 +3890,8 @@ static int AesCaviumCbcDecrypt(Aes* aes, byte* out, const byte* in,
|
||||
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
#endif /* WOLFSSL_TI_CRYPT */
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
#endif /* NO_AES */
|
||||
|
||||
Reference in New Issue
Block a user