Skip to content

Commit 6495e8e

Browse files
committed
Fix ARIA build issue and FIPS guard
1 parent b36a9ca commit 6495e8e

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

src/internal.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19714,7 +19714,9 @@ static int DoDtlsHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
1971419714
#if (!defined(NO_PUBLIC_GCM_SET_IV) && \
1971519715
((defined(HAVE_FIPS) || defined(HAVE_SELFTEST)) && \
1971619716
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2)))) || \
19717-
(defined(HAVE_POLY1305) && defined(HAVE_CHACHA))
19717+
(defined(HAVE_POLY1305) && defined(HAVE_CHACHA)) || \
19718+
defined(HAVE_ARIA) || \
19719+
defined(WOLFSSL_SM4_GCM) || defined(WOLFSSL_SM4_CCM)
1971819720
static WC_INLINE void AeadIncrementExpIV(WOLFSSL* ssl)
1971919721
{
1972019722
int i;
@@ -20701,10 +20703,9 @@ static WC_INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input,
2070120703
sizeof(ssl->encrypt.sanityCheck));
2070220704
#endif
2070320705

20704-
#if defined(BUILD_AESGCM) || defined(HAVE_AESCCM) || defined(HAVE_ARIA)
20706+
#if defined(BUILD_AESGCM) || defined(HAVE_AESCCM)
2070520707
if (ssl->specs.bulk_cipher_algorithm == wolfssl_aes_ccm ||
20706-
ssl->specs.bulk_cipher_algorithm == wolfssl_aes_gcm ||
20707-
ssl->specs.bulk_cipher_algorithm == wolfssl_aria_gcm)
20708+
ssl->specs.bulk_cipher_algorithm == wolfssl_aes_gcm)
2070820709
{
2070920710
/* finalize authentication cipher */
2071020711
#if !defined(NO_PUBLIC_GCM_SET_IV) && \
@@ -20715,7 +20716,17 @@ static WC_INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input,
2071520716
if (ssl->encrypt.nonce)
2071620717
ForceZero(ssl->encrypt.nonce, AESGCM_NONCE_SZ);
2071720718
}
20718-
#endif /* BUILD_AESGCM || HAVE_AESCCM || HAVE_ARIA */
20719+
#endif /* BUILD_AESGCM || HAVE_AESCCM */
20720+
#ifdef HAVE_ARIA
20721+
if (ssl->specs.bulk_cipher_algorithm == wolfssl_aria_gcm)
20722+
{
20723+
/* finalize authentication cipher — wc_AriaEncrypt is
20724+
* stateless, so the explicit IV must always advance */
20725+
AeadIncrementExpIV(ssl);
20726+
if (ssl->encrypt.nonce)
20727+
ForceZero(ssl->encrypt.nonce, AESGCM_NONCE_SZ);
20728+
}
20729+
#endif /* HAVE_ARIA */
2071920730
#if defined(WOLFSSL_SM4_GCM) || defined(WOLFSSL_SM4_CCM)
2072020731
if (ssl->specs.bulk_cipher_algorithm == wolfssl_sm4_ccm ||
2072120732
ssl->specs.bulk_cipher_algorithm == wolfssl_sm4_gcm)

0 commit comments

Comments
 (0)