From ebfde75d91345c926b7738f03764241ad60ca252 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Fri, 15 Nov 2024 15:33:51 -0600 Subject: [PATCH] fixes for misspelled/malformed macro names, and add missing BUILD_AESCCM setup in wolfssl/internal.h --- .../simple_client_example.h | 6 +++--- .../wolfssl_test_driver.h | 6 +++--- src/internal.c | 2 +- src/ssl.c | 2 +- wolfcrypt/src/asn.c | 4 ++-- wolfcrypt/test/test.c | 6 ------ wolfssl/internal.h | 19 +++++++++++++++++++ wolfssl/wolfcrypt/types.h | 1 + 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/simple_client_example.h b/IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/simple_client_example.h index 915f7cc2e..ebce3eee6 100644 --- a/IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/simple_client_example.h +++ b/IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/simple_client_example.h @@ -19,9 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ -#ifndef simple_client_example_h -#define simple_client_example_h +#ifndef SIMPLE_CLIENT_EXAMPLE_H +#define SIMPLE_CLIENT_EXAMPLE_H int simple_client_example(void); -#endif /* simple_client_example_h */ +#endif /* SIMPLE_CLIENT_EXAMPLE_H */ diff --git a/IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/wolfssl_test_driver.h b/IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/wolfssl_test_driver.h index 768518554..9d9c09d7a 100644 --- a/IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/wolfssl_test_driver.h +++ b/IDE/apple-universal/wolfssl-multiplatform/wolfssl-multiplatform/wolfssl_test_driver.h @@ -19,9 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ -#ifndef wolfssl_test_driver_h -#define wolfssl_test_driver_h +#ifndef WOLFSSL_TEST_DRIVER_H +#define WOLFSSL_TEST_DRIVER_H void wolfssl_test(void); -#endif /* wolfssl_test_driver_h */ +#endif /* WOLFSSL_TEST_DRIVER_H */ diff --git a/src/internal.c b/src/internal.c index 7fde8dcc7..39925fc44 100644 --- a/src/internal.c +++ b/src/internal.c @@ -36291,7 +36291,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx, goto exit_sske; } } - #if defined(HAVE_E25519) || defined(HAVE_ED448) + #if defined(HAVE_ED25519) || defined(HAVE_ED448) FALL_THROUGH; #endif #endif /* WOLFSSL_CHECK_SIG_FAULTS */ diff --git a/src/ssl.c b/src/ssl.c index 6471f0291..daa794014 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -17528,7 +17528,7 @@ const WOLFSSL_ObjectInfo wolfssl_object_info[] = { #ifdef WOLFSSL_MD2 { WC_NID_md2, MD2h, oidHashType, "MD2", "md2"}, #endif - #ifdef WOLFSSL_MD5 + #ifndef NO_MD5 { WC_NID_md5, MD5h, oidHashType, "MD5", "md5"}, #endif #ifndef NO_SHA diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 3ba86e5be..ec31b9ab6 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -34332,7 +34332,7 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key, byte version = 0; int ret = 0; int curve_id = ECC_CURVE_DEF; -#if defined(HAVE_PKCS8) || defined(HAVE_PKCS12) || defined(SM2) +#if defined(HAVE_PKCS8) || defined(HAVE_PKCS12) || defined(WOLFSSL_SM2) word32 algId = 0; word32 eccOid = 0; #endif @@ -34342,7 +34342,7 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key, ret = BAD_FUNC_ARG; } -#if defined(HAVE_PKCS8) || defined(HAVE_PKCS12) || defined(SM2) +#if defined(HAVE_PKCS8) || defined(HAVE_PKCS12) || defined(WOLFSSL_SM2) /* if has pkcs8 header skip it */ if (ToTraditionalInline_ex2(input, inOutIdx, inSz, &algId, &eccOid) < 0) { /* ignore error, did not have pkcs8 header */ diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 0afb0422e..3dc8ffa3d 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -21930,9 +21930,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void) #endif #ifdef WOLFSSL_TEST_CERT -#if defined(WOLFSSL_MDK_ARM) - #define sizeof(s) XSTRLEN((char *)(s)) -#endif #ifdef USE_CERT_BUFFERS_1024 XMEMCPY(tmp, client_cert_der_1024, (size_t)sizeof_client_cert_der_1024); @@ -21961,9 +21958,6 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_test(void) ERROR_OUT(WC_TEST_RET_ENC_NC, exit_rsa); #endif -#ifdef sizeof - #undef sizeof -#endif InitDecodedCert(cert, tmp, (word32)bytes, NULL); ret = ParseCert(cert, CERT_TYPE, NO_VERIFY, NULL); diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 7fef72423..a2fddea54 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -973,6 +973,25 @@ #define NO_AESGCM_AEAD #endif +#if defined(BUILD_TLS_RSA_WITH_AES_128_CCM_8) || \ + defined(BUILD_TLS_RSA_WITH_AES_256_CCM_8) || \ + defined(BUILD_TLS_PSK_WITH_AES_128_CCM_8) || \ + defined(BUILD_TLS_PSK_WITH_AES_128_CCM) || \ + defined(BUILD_TLS_PSK_WITH_AES_256_CCM_8) || \ + defined(BUILD_TLS_PSK_WITH_AES_256_CCM) || \ + defined(BUILD_TLS_DHE_PSK_WITH_AES_128_CCM) || \ + defined(BUILD_TLS_DHE_PSK_WITH_AES_256_CCM) || \ + defined(BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_CCM) || \ + defined(BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8) || \ + defined(BUILD_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8) || \ + defined(BUILD_TLS_AES_128_CCM_SHA256) || \ + defined(BUILD_TLS_AES_128_CCM_8_SHA256) + #define BUILD_AESCCM +#else + /* No AES-CCM cipher suites available with build */ + #define NO_AESCCM_AEAD +#endif + #if defined(BUILD_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256) || \ defined(BUILD_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384) #define BUILD_ARIA diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index a980873f9..bc2edcc6d 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -77,6 +77,7 @@ decouple library dependencies with standard string, memory and so on. #endif #ifndef WOLFSSL_TYPES + #define WOLFSSL_TYPES #ifndef byte /* If using C++ C17 or later and getting: * "error: reference to 'byte' is ambiguous", this is caused by