mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Merge pull request #2328 from kaleb-himes/ZD-5373-TIRTOS
Updating for TI hardware offload with latest version of wolfSSL
This commit is contained in:
@@ -11798,9 +11798,10 @@ static int DoDtlsHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
|
||||
#ifdef HAVE_AEAD
|
||||
|
||||
#if ((defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) && \
|
||||
#if !defined(NO_PUBLIC_GCM_SET_IV) && \
|
||||
(((defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) && \
|
||||
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))) || \
|
||||
(defined(HAVE_POLY1305) && defined(HAVE_CHACHA))
|
||||
(defined(HAVE_POLY1305) && defined(HAVE_CHACHA)))
|
||||
static WC_INLINE void AeadIncrementExpIV(WOLFSSL* ssl)
|
||||
{
|
||||
int i;
|
||||
@@ -12160,8 +12161,9 @@ static int ChachaAEADDecrypt(WOLFSSL* ssl, byte* plain, const byte* input,
|
||||
|
||||
#if defined(BUILD_AESGCM) || defined(HAVE_AESCCM)
|
||||
|
||||
#if (!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
|
||||
#if !defined(NO_GCM_ENCRYPT_EXTRA) && \
|
||||
((!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)))
|
||||
/* The following type is used to share code between AES-GCM and AES-CCM. */
|
||||
typedef int (*AesAuthEncryptFunc)(Aes* aes, byte* out,
|
||||
const byte* in, word32 sz,
|
||||
@@ -12284,8 +12286,9 @@ static WC_INLINE int EncryptDo(WOLFSSL* ssl, byte* out, const byte* input,
|
||||
* IV length minus the authentication tag size. */
|
||||
c16toa(sz - AESGCM_EXP_IV_SZ - ssl->specs.aead_mac_size,
|
||||
ssl->encrypt.additional + AEAD_LEN_OFFSET);
|
||||
#if (defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) && \
|
||||
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
|
||||
#if !defined(NO_PUBLIC_GCM_SET_IV) && \
|
||||
((defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) && \
|
||||
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2)))
|
||||
XMEMCPY(ssl->encrypt.nonce,
|
||||
ssl->keys.aead_enc_imp_IV, AESGCM_IMP_IV_SZ);
|
||||
XMEMCPY(ssl->encrypt.nonce + AESGCM_IMP_IV_SZ,
|
||||
@@ -12303,8 +12306,9 @@ static WC_INLINE int EncryptDo(WOLFSSL* ssl, byte* out, const byte* input,
|
||||
ret = wolfSSL_AsyncPush(ssl, asyncDev);
|
||||
}
|
||||
#endif
|
||||
#if (!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
|
||||
#if !defined(NO_PUBLIC_GCM_SET_IV) && \
|
||||
((!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)))
|
||||
XMEMCPY(out,
|
||||
ssl->encrypt.nonce + AESGCM_IMP_IV_SZ, AESGCM_EXP_IV_SZ);
|
||||
#endif
|
||||
@@ -12436,8 +12440,9 @@ static WC_INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16
|
||||
ssl->specs.bulk_cipher_algorithm == wolfssl_aes_gcm)
|
||||
{
|
||||
/* finalize authentication cipher */
|
||||
#if (defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) && \
|
||||
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
|
||||
#if !defined(NO_PUBLIC_GCM_SET_IV) && \
|
||||
((defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) && \
|
||||
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2)))
|
||||
AeadIncrementExpIV(ssl);
|
||||
#endif
|
||||
if (ssl->encrypt.nonce)
|
||||
@@ -14428,9 +14433,10 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input,
|
||||
goto exit_buildmsg;
|
||||
|
||||
}
|
||||
#if (defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) && \
|
||||
#if !defined(NO_PUBLIC_GCM_SET_IV) && \
|
||||
((defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) && \
|
||||
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2)) && \
|
||||
defined(HAVE_AEAD)
|
||||
defined(HAVE_AEAD))
|
||||
if (ssl->specs.cipher_type == aead) {
|
||||
if (ssl->specs.bulk_cipher_algorithm != wolfssl_chacha)
|
||||
XMEMCPY(args->iv, ssl->keys.aead_exp_IV, AESGCM_EXP_IV_SZ);
|
||||
|
20
src/keys.c
20
src/keys.c
@@ -2628,8 +2628,9 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->client_write_IV,
|
||||
AEAD_MAX_IMP_SZ);
|
||||
#if (!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
|
||||
#if !defined(NO_PUBLIC_GCM_SET_IV) && \
|
||||
((!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)))
|
||||
if (!skipIv) {
|
||||
gcmRet = wc_AesGcmSetIV(enc->aes, AESGCM_NONCE_SZ,
|
||||
keys->client_write_IV, AESGCM_IMP_IV_SZ, rng);
|
||||
@@ -2652,8 +2653,9 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
if (gcmRet != 0) return gcmRet;
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->server_write_IV,
|
||||
AEAD_MAX_IMP_SZ);
|
||||
#if (!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
|
||||
#if !defined(NO_PUBLIC_GCM_SET_IV) && \
|
||||
((!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)))
|
||||
if (!skipIv) {
|
||||
gcmRet = wc_AesGcmSetIV(enc->aes, AESGCM_NONCE_SZ,
|
||||
keys->server_write_IV, AESGCM_IMP_IV_SZ, rng);
|
||||
@@ -2728,8 +2730,9 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
}
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->client_write_IV,
|
||||
AEAD_MAX_IMP_SZ);
|
||||
#if (!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
|
||||
#if !defined(NO_PUBLIC_CCM_SET_NONCE) && \
|
||||
((!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)))
|
||||
if (!skipIv) {
|
||||
CcmRet = wc_AesCcmSetNonce(enc->aes, keys->client_write_IV,
|
||||
AEAD_MAX_IMP_SZ);
|
||||
@@ -2756,8 +2759,9 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
||||
}
|
||||
XMEMCPY(keys->aead_enc_imp_IV, keys->server_write_IV,
|
||||
AEAD_MAX_IMP_SZ);
|
||||
#if (!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
|
||||
#if !defined(NO_PUBLIC_CCM_SET_NONCE) && \
|
||||
((!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
|
||||
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)))
|
||||
if (!skipIv) {
|
||||
CcmRet = wc_AesCcmSetNonce(enc->aes, keys->server_write_IV,
|
||||
AEAD_MAX_IMP_SZ);
|
||||
|
@@ -116,7 +116,7 @@ int wc_AesCbcEncryptWithKey(byte* out, const byte* in, word32 inSz,
|
||||
#endif /* !NO_AES && HAVE_AES_CBC */
|
||||
|
||||
|
||||
#ifndef NO_DES3
|
||||
#if !defined(NO_DES3) && !defined(WOLFSSL_TI_CRYPT)
|
||||
int wc_Des_CbcEncryptWithKey(byte* out, const byte* in, word32 sz,
|
||||
const byte* key, const byte* iv)
|
||||
{
|
||||
|
@@ -722,6 +722,11 @@ extern void uITRON4_free(void *p) ;
|
||||
#define USE_WOLF_STRTOK /* use with HAVE_ALPN */
|
||||
#define HAVE_TLS_EXTENSIONS
|
||||
#define HAVE_AESGCM
|
||||
#ifdef WOLFSSL_TI_CRYPT
|
||||
#define NO_GCM_ENCRYPT_EXTRA
|
||||
#define NO_PUBLIC_GCM_SET_IV
|
||||
#define NO_PUBLIC_CCM_SET_NONCE
|
||||
#endif
|
||||
#define HAVE_SUPPORTED_CURVES
|
||||
#define ALT_ECC_SIZE
|
||||
|
||||
|
Reference in New Issue
Block a user