Skip to content

lib: avoid macro collisions between wolfSSL and GnuTLS headers - #14511

Closed
vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:lib-3rd-party-macro-collision
Closed

vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:lib-3rd-party-macro-collision

Conversation

@vszakats

@vszakats vszakats commented Aug 12, 2024 •

Copy link
Copy Markdown
Member

Both of these projects define the same SHA* macros via headers
included by curl (in MultiSSL builds, possibly only in Unity builds),
causing redefinition compiler warnings.

Fix it by disabling compatibility macros in wolfSSL.

Building C object lib/CMakeFiles/libcurl_static.dir/Unity/unity_0_c.c.o
In file included from _bld/lib/CMakeFiles/libcurl_static.dir/Unity/unity_0_c.c:202:
In file included from lib/http_aws_sigv4.c:33:
In file included from lib/curl_sha256.h:40:
In file included from /usr/local/Cellar/wolfssl/5.7.2/include/wolfssl/openssl/sha.h:30:
/usr/local/Cellar/wolfssl/5.7.2/include/wolfssl/wolfcrypt/sha256.h:117:13: warning: 'SHA256_BLOCK_SIZE' macro redefined [-Wmacro-redefined]
    #define SHA256_BLOCK_SIZE  WC_SHA256_BLOCK_SIZE
            ^
/usr/local/Cellar/nettle/3.10/include/nettle/sha2.h:70:9: note: previous definition is here
#define SHA256_BLOCK_SIZE 64
        ^
In file included from _bld/lib/CMakeFiles/libcurl_static.dir/Unity/unity_0_c.c:202:
In file included from lib/http_aws_sigv4.c:33:
In file included from lib/curl_sha256.h:40:
In file included from /usr/local/Cellar/wolfssl/5.7.2/include/wolfssl/openssl/sha.h:30:
[...]
    #define SHA256_DIGEST_SIZE WC_SHA256_DIGEST_SIZE
    #define SHA224_BLOCK_SIZE  WC_SHA224_BLOCK_SIZE
    #define SHA224_DIGEST_SIZE WC_SHA224_DIGEST_SIZE
    #define SHA512_BLOCK_SIZE  WC_SHA512_BLOCK_SIZE
    #define SHA512_DIGEST_SIZE WC_SHA512_DIGEST_SIZE
    #define SHA384_BLOCK_SIZE  WC_SHA384_BLOCK_SIZE
    #define SHA384_DIGEST_SIZE WC_SHA384_DIGEST_SIZE

Cherry-picked from #14495
Closes #14511

Both of these projects define the same `SHA*` macros via headers
included by curl (in MultiSSL builds, possibly only in Unity builds),
causing redefinition compiler warnings.

Fix it by disabling compatibility headers in wolfSSL.

Cherry-picked from curl#14495
Closes #xxxxx
@vszakats vszakats closed this in d7e1a2d Aug 13, 2024
@vszakats
vszakats deleted the lib-3rd-party-macro-collision branch August 13, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant