From 3531419db4fd268631d981395e9674205c8fac2d Mon Sep 17 00:00:00 2001 From: snow flurry Date: Fri, 1 Mar 2024 20:07:01 -0800 Subject: [PATCH] fix vc2003 build issues --- IDE/WIN/user_settings.h | 24 +++++++++++++++++++++++- wolfssl/openssl/ec.h | 2 +- wolfssl/openssl/evp.h | 2 +- wolfssl/openssl/pem.h | 2 +- wolfssl/openssl/ssl.h | 16 ++++++++-------- wolfssl/openssl/x509v3.h | 6 +++--- wolfssl/wolfcrypt/logging.h | 4 ++-- wolfssl/wolfcrypt/types.h | 6 +++--- wolfssl/wolfcrypt/wc_port.h | 2 +- 9 files changed, 43 insertions(+), 21 deletions(-) diff --git a/IDE/WIN/user_settings.h b/IDE/WIN/user_settings.h index 2251089..cf325d3 100644 --- a/IDE/WIN/user_settings.h +++ b/IDE/WIN/user_settings.h @@ -17,6 +17,9 @@ #define WOLFSSL_SEND_HRR_COOKIE #define WOLFSSL_DTLS_CID +#define WOLF_C89 +#define NO_WOLF_C99 + /* Configurations */ #if defined(HAVE_FIPS) /* FIPS */ @@ -49,6 +52,9 @@ #define WOLFSSL_SNIFFER #define HAVE_SECURE_RENEGOTIATION + /* for NTLM */ + #define WOLFSSL_DES_ECB + #define HAVE_AESGCM #define WOLFSSL_AESGCM_STREAM #define WOLFSSL_SHA384 @@ -61,9 +67,25 @@ #define ECC_SHAMIR #define ECC_TIMING_RESISTANT - #define WOLFSSL_SP_X86_64 #define SP_INT_BITS 4096 + /* For VC7.1: define strcpy_s to StringCchCopy */ + #ifndef StringCchCopy + #define STRSAFE_NO_DEPRECATE + #define STRSAFE_NO_CB_FUNCTIONS + #include + #include + #endif /* !StringCchCopy */ + + #define strcpy_s StringCchCopyA + + #define USE_WOLF_STRTOK + #define XVSNPRINTF _vsnprintf + + #ifndef InetPton + int __stdcall InetPton(int Family, const char *pszAddrString, void *pAddrBuf); + #endif /* !InetPton */ + /* Optional Performance Speedups */ #if 0 /* AESNI on x64 */ diff --git a/wolfssl/openssl/ec.h b/wolfssl/openssl/ec.h index 23ef5e9..9ce1f39 100644 --- a/wolfssl/openssl/ec.h +++ b/wolfssl/openssl/ec.h @@ -356,7 +356,7 @@ typedef WOLFSSL_EC_BUILTIN_CURVE EC_builtin_curve; #define EC_GROUP_order_bits wolfSSL_EC_GROUP_order_bits #define EC_GROUP_method_of wolfSSL_EC_GROUP_method_of #ifndef NO_WOLFSSL_STUB -#define EC_GROUP_set_point_conversion_form(...) WC_DO_NOTHING +#define EC_GROUP_set_point_conversion_form(x, y) WC_DO_NOTHING #endif #define EC_METHOD_get_field_type wolfSSL_EC_METHOD_get_field_type diff --git a/wolfssl/openssl/evp.h b/wolfssl/openssl/evp.h index bdeabf2..e66f938 100644 --- a/wolfssl/openssl/evp.h +++ b/wolfssl/openssl/evp.h @@ -1019,7 +1019,7 @@ WOLFSSL_API int wolfSSL_EVP_SignInit_ex(WOLFSSL_EVP_MD_CTX* ctx, #define EVP_MD_block_size wolfSSL_EVP_MD_block_size #define EVP_MD_type wolfSSL_EVP_MD_type #ifndef NO_WOLFSSL_STUB -#define EVP_MD_CTX_set_flags(...) WC_DO_NOTHING +#define EVP_MD_CTX_set_flags(x, y) WC_DO_NOTHING #endif #define EVP_Digest wolfSSL_EVP_Digest diff --git a/wolfssl/openssl/pem.h b/wolfssl/openssl/pem.h index 221e8d6..fc24cd9 100644 --- a/wolfssl/openssl/pem.h +++ b/wolfssl/openssl/pem.h @@ -264,7 +264,7 @@ int wolfSSL_PEM_write_DHparams(XFILE fp, WOLFSSL_DH* dh); #define PEM_read_bio_ECPrivateKey wolfSSL_PEM_read_bio_ECPrivateKey #define PEM_read_bio_EC_PUBKEY wolfSSL_PEM_read_bio_EC_PUBKEY #ifndef NO_WOLFSSL_STUB -#define PEM_write_bio_ECPKParameters(...) 0 +#define PEM_write_bio_ECPKParameters(x) 0 #endif /* EVP_KEY */ #define PEM_read_bio_PrivateKey wolfSSL_PEM_read_bio_PrivateKey diff --git a/wolfssl/openssl/ssl.h b/wolfssl/openssl/ssl.h index 77874c7..e1ec8f3 100644 --- a/wolfssl/openssl/ssl.h +++ b/wolfssl/openssl/ssl.h @@ -745,7 +745,7 @@ wolfSSL_X509_STORE_set_verify_cb((WOLFSSL_X509_STORE *)(s), (WOLFSSL_X509_STORE_ #define X509_REVOKED_get0_serialNumber wolfSSL_X509_REVOKED_get0_serial_number #define X509_REVOKED_get0_revocationDate wolfSSL_X509_REVOKED_get0_revocation_date -#define X509_check_purpose(...) 0 +#define X509_check_purpose(x, y, z) 0 #define OCSP_parse_url wolfSSL_OCSP_parse_url @@ -876,7 +876,7 @@ wolfSSL_X509_STORE_set_verify_cb((WOLFSSL_X509_STORE *)(s), (WOLFSSL_X509_STORE_ #define ASN1_STRING_print(x, y) wolfSSL_ASN1_STRING_print ((WOLFSSL_BIO*)(x), (WOLFSSL_ASN1_STRING*)(y)) #define d2i_DISPLAYTEXT wolfSSL_d2i_DISPLAYTEXT #ifndef NO_WOLFSSL_STUB -#define ASN1_STRING_set_default_mask_asc(...) 1 +#define ASN1_STRING_set_default_mask_asc(x) 1 #endif #define ASN1_OCTET_STRING WOLFSSL_ASN1_STRING @@ -894,7 +894,7 @@ wolfSSL_X509_STORE_set_verify_cb((WOLFSSL_X509_STORE *)(s), (WOLFSSL_X509_STORE_ #define ASN1_IA5STRING_free wolfSSL_ASN1_STRING_free #define ASN1_IA5STRING_set wolfSSL_ASN1_STRING_set -#define ASN1_PRINTABLE_type(...) V_ASN1_PRINTABLESTRING +#define ASN1_PRINTABLE_type(x) V_ASN1_PRINTABLESTRING #define ASN1_UTCTIME_pr wolfSSL_ASN1_UTCTIME_pr @@ -1447,7 +1447,7 @@ typedef WOLFSSL_SRTP_PROTECTION_PROFILE SRTP_PROTECTION_PROFILE; #define PSK_MAX_IDENTITY_LEN 128 #define SSL_CTX_clear_options wolfSSL_CTX_clear_options -#define SSL_CTX_add_server_custom_ext(...) 0 +__inline int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, ...) { (void)(ctx); return 0; } #define SSL_get0_verified_chain wolfSSL_get0_verified_chain #define X509_chain_up_ref wolfSSL_X509_chain_up_ref @@ -1455,8 +1455,8 @@ typedef WOLFSSL_SRTP_PROTECTION_PROFILE SRTP_PROTECTION_PROFILE; #endif /* HAVE_STUNNEL || WOLFSSL_NGINX */ #ifndef NO_WOLFSSL_STUB -#define b2i_PrivateKey_bio(...) NULL -#define b2i_PVK_bio(...) NULL +#define b2i_PrivateKey_bio(x) NULL +#define b2i_PVK_bio(x) NULL #endif #define SSL_CTX_get_default_passwd_cb wolfSSL_CTX_get_default_passwd_cb @@ -1663,8 +1663,8 @@ typedef WOLFSSL_SRTP_PROTECTION_PROFILE SRTP_PROTECTION_PROFILE; #endif #ifndef NO_WOLFSSL_STUB -#define OBJ_create_objects(...) WC_DO_NOTHING -#define sk_SSL_COMP_free(...) WC_DO_NOTHING +#define OBJ_create_objects(x) WC_DO_NOTHING +#define sk_SSL_COMP_free(x) WC_DO_NOTHING #endif #define OBJ_dup wolfSSL_ASN1_OBJECT_dup diff --git a/wolfssl/openssl/x509v3.h b/wolfssl/openssl/x509v3.h index c9c9ad8..d54edb1 100644 --- a/wolfssl/openssl/x509v3.h +++ b/wolfssl/openssl/x509v3.h @@ -152,7 +152,7 @@ WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_a2i_IPADDRESS(const char* ipa); #define X509V3_EXT_d2i wolfSSL_X509V3_EXT_d2i #define X509V3_EXT_add_nconf wolfSSL_X509V3_EXT_add_nconf #ifndef NO_WOLFSSL_STUB -#define X509V3_parse_list(...) NULL +#define X509V3_parse_list(x) NULL #endif #define i2s_ASN1_OCTET_STRING wolfSSL_i2s_ASN1_STRING #define a2i_IPADDRESS wolfSSL_a2i_IPADDRESS @@ -160,8 +160,8 @@ WOLFSSL_API WOLFSSL_ASN1_STRING* wolfSSL_a2i_IPADDRESS(const char* ipa); #define X509V3_EXT_conf_nid wolfSSL_X509V3_EXT_conf_nid #define X509V3_set_ctx wolfSSL_X509V3_set_ctx #ifndef NO_WOLFSSL_STUB -#define X509V3_set_nconf(...) WC_DO_NOTHING -#define X509V3_EXT_cleanup(...) WC_DO_NOTHING +#define X509V3_set_nconf(x) WC_DO_NOTHING +#define X509V3_EXT_cleanup(x) WC_DO_NOTHING #endif #define X509V3_set_ctx_test(ctx) wolfSSL_X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) #define X509V3_set_ctx_nodb wolfSSL_X509V3_set_ctx_nodb diff --git a/wolfssl/wolfcrypt/logging.h b/wolfssl/wolfcrypt/logging.h index 498b605..73f9306 100644 --- a/wolfssl/wolfcrypt/logging.h +++ b/wolfssl/wolfcrypt/logging.h @@ -173,7 +173,7 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix); WOLFSSL_API void WOLFSSL_MSG_EX(const char* fmt, ...); #define HAVE_WOLFSSL_MSG_EX #else - #define WOLFSSL_MSG_EX(...) WC_DO_NOTHING + __inline void WOLFSSL_MSG_EX(const char *fmt, ...) { (void)(fmt); return; } #endif WOLFSSL_API void WOLFSSL_MSG(const char* msg); WOLFSSL_API void WOLFSSL_BUFFER(const byte* buffer, word32 length); @@ -185,7 +185,7 @@ WOLFSSL_API void wolfSSL_SetLoggingPrefix(const char* prefix); #define WOLFSSL_STUB(m) WC_DO_NOTHING #define WOLFSSL_IS_DEBUG_ON() 0 - #define WOLFSSL_MSG_EX(...) WC_DO_NOTHING + __inline void WOLFSSL_MSG_EX(const char *fmt, ...) { (void)(fmt); return; } #define WOLFSSL_MSG(m) WC_DO_NOTHING #define WOLFSSL_BUFFER(b, l) WC_DO_NOTHING diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 0d41354..bf2e7e2 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -1570,7 +1570,7 @@ typedef struct w64wrapper { #endif #ifndef SAVE_VECTOR_REGISTERS - #define SAVE_VECTOR_REGISTERS(...) WC_DO_NOTHING + #define SAVE_VECTOR_REGISTERS(x) WC_DO_NOTHING #endif #ifndef SAVE_VECTOR_REGISTERS2 #define SAVE_VECTOR_REGISTERS2() 0 @@ -1579,10 +1579,10 @@ typedef struct w64wrapper { #define WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(x) WC_DO_NOTHING #endif #ifndef ASSERT_SAVED_VECTOR_REGISTERS - #define ASSERT_SAVED_VECTOR_REGISTERS(...) WC_DO_NOTHING + #define ASSERT_SAVED_VECTOR_REGISTERS(x) WC_DO_NOTHING #endif #ifndef ASSERT_RESTORED_VECTOR_REGISTERS - #define ASSERT_RESTORED_VECTOR_REGISTERS(...) WC_DO_NOTHING + #define ASSERT_RESTORED_VECTOR_REGISTERS(x) WC_DO_NOTHING #endif #ifndef RESTORE_VECTOR_REGISTERS #define RESTORE_VECTOR_REGISTERS() WC_DO_NOTHING diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 5240eff..d892864 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -325,7 +325,7 @@ #define WOLFSSL_ATOMIC_OPS #endif /* WOLFSSL_HAVE_ATOMIC_H */ #endif -#elif defined(_MSC_VER) +#elif _MSC_VER >= 1400 /* Use MSVC compiler intrinsics for atomic ops */ #include typedef volatile long wolfSSL_Atomic_Int;