Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wolfssl: fix unused variable warning #16608

Closed
wants to merge 1 commit into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Mar 7, 2025

E.g. when building against msys2-mingw wolfssl:
https://packages.msys2.org/base/mingw-w64-wolfssl

lib/vtls/wolfssl.c: In function 'wssl_verify_pinned':
lib/vtls/wolfssl.c:1534:20: error: unused variable 'wssl' [-Werror=unused-variable]
   struct wssl_ctx *wssl = (struct wssl_ctx *)connssl->backend;
                    ^~~~

Ref: https://github.com/curl/curl/actions/runs/13713131802/job/38353245932#step:10:78

Building with the MSYS2 wolfssl is broken due to further issues.

E.g. when building against msys2-mingw wolfssl:
https://packages.msys2.org/base/mingw-w64-wolfssl

```
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'wssl_verify_pinned':
D:/a/curl/curl/lib/vtls/wolfssl.c:1534:20: error: unused variable 'wssl' [-Werror=unused-variable]
   struct wssl_ctx *wssl = (struct wssl_ctx *)connssl->backend;
                    ^~~~
```
Ref: https://github.com/curl/curl/actions/runs/13713131802/job/38353245932#step:10:78

The build is broken in many other ways.
@vszakats
Copy link
Member Author

vszakats commented Mar 7, 2025

MSYS2 wolfssl fails with curl:

D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'wssl_vtls_new_session_cb':
D:/a/curl/curl/lib/vtls/wolfssl.c:483:30: error: implicit declaration of function 'wolfSSL_get_app_data'; did you mean 'wolfSSL_get_ex_data'? [-Wimplicit-function-declaration]
   cf = (struct Curl_cfilter*)wolfSSL_get_app_data(ssl);
                              ^~~~~~~~~~~~~~~~~~~~
                              wolfSSL_get_ex_data
D:/a/curl/curl/lib/vtls/wolfssl.c:483:30: error: nested extern declaration of 'wolfSSL_get_app_data' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:483:8: error: cast from function call of type 'int' to non-matching type 'struct Curl_cfilter *' [-Werror=bad-function-cast]
   cf = (struct Curl_cfilter*)wolfSSL_get_app_data(ssl);
        ^
D:/a/curl/curl/lib/vtls/wolfssl.c:483:8: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'wssl_x509_share_free':
D:/a/curl/curl/lib/vtls/wolfssl.c:706:5: error: implicit declaration of function 'wolfSSL_X509_STORE_free'; did you mean 'wolfSSL_X509_STORE_CTX_free'? [-Wimplicit-function-declaration]
     wolfSSL_X509_STORE_free(share->store);
     ^~~~~~~~~~~~~~~~~~~~~~~
     wolfSSL_X509_STORE_CTX_free
D:/a/curl/curl/lib/vtls/wolfssl.c:706:5: error: nested extern declaration of 'wolfSSL_X509_STORE_free' [-Werror=nested-externs]
[ 33%] Generating CURLOPT_XFERINFOFUNCTION.3, CURLOPT_XOAUTH2_BEARER.3, CURLSHOPT_LOCKFUNC.3, CURLSHOPT_SHARE.3, CURLSHOPT_UNLOCKFUNC.3, CURLSHOPT_UNSHARE.3, CURLSHOPT_USERDATA.3
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'wssl_set_cached_x509_store':
D:/a/curl/curl/lib/vtls/wolfssl.c:786:6: error: implicit declaration of function 'wolfSSL_X509_STORE_up_ref'; did you mean 'wolfSSL_X509_STORE_CTX_free'? [-Wimplicit-function-declaration]
   if(wolfSSL_X509_STORE_up_ref(store)) {
      ^~~~~~~~~~~~~~~~~~~~~~~~~
      wolfSSL_X509_STORE_CTX_free
D:/a/curl/curl/lib/vtls/wolfssl.c:786:6: error: nested extern declaration of 'wolfSSL_X509_STORE_up_ref' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'Curl_wssl_setup_x509_store':
D:/a/curl/curl/lib/vtls/wolfssl.c:831:6: error: implicit declaration of function 'wolfSSL_CTX_get_cert_store'; did you mean 'wolfSSL_CTX_get_mode'? [-Wimplicit-function-declaration]
      wolfSSL_CTX_get_cert_store(wssl->ssl_ctx) == cached_store) {
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      wolfSSL_CTX_get_mode
D:/a/curl/curl/lib/vtls/wolfssl.c:831:6: error: nested extern declaration of 'wolfSSL_CTX_get_cert_store' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:831:48: error: comparison between pointer and integer
      wolfSSL_CTX_get_cert_store(wssl->ssl_ctx) == cached_store) {
                                                ^~
D:/a/curl/curl/lib/vtls/wolfssl.c:835:5: error: implicit declaration of function 'wolfSSL_CTX_set_cert_store'; did you mean 'wolfSSL_CTX_save_cert_cache'? [-Wimplicit-function-declaration]
     wolfSSL_CTX_set_cert_store(wssl->ssl_ctx, cached_store);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
     wolfSSL_CTX_save_cert_cache
D:/a/curl/curl/lib/vtls/wolfssl.c:835:5: error: nested extern declaration of 'wolfSSL_CTX_set_cert_store' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:840:33: error: implicit declaration of function 'wolfSSL_X509_STORE_new'; did you mean 'wolfSSL_X509_STORE_CTX_new'? [-Wimplicit-function-declaration]
     WOLFSSL_X509_STORE *store = wolfSSL_X509_STORE_new();
                                 ^~~~~~~~~~~~~~~~~~~~~~
                                 wolfSSL_X509_STORE_CTX_new
D:/a/curl/curl/lib/vtls/wolfssl.c:840:33: error: nested extern declaration of 'wolfSSL_X509_STORE_new' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:840:33: error: initialization makes pointer from integer without a cast [-Wint-conversion]
[ 33%] Built target generate-curl.1
D:/a/curl/curl/lib/vtls/wolfssl.c:854:32: error: initialization makes pointer from integer without a cast [-Wint-conversion]
    WOLFSSL_X509_STORE *store = wolfSSL_CTX_get_cert_store(wssl->ssl_ctx);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
D:/a/curl/curl/lib/vtls/wolfssl.c: In function 'Curl_wssl_ctx_init':
D:/a/curl/curl/lib/vtls/wolfssl.c:1117:11: error: implicit declaration of function 'wolfSSL_CTX_set1_curves_list'; did you mean 'wolfSSL_CTX_set_cipher_list'? [-Wimplicit-function-declaration]
       if(!wolfSSL_CTX_set1_curves_list(wctx->ssl_ctx, curves)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
           wolfSSL_CTX_set_cipher_list
D:/a/curl/curl/lib/vtls/wolfssl.c:1117:11: error: nested extern declaration of 'wolfSSL_CTX_set1_curves_list' [-Werror=nested-externs]
D:/a/curl/curl/lib/vtls/wolfssl.c:1288:3: error: implicit declaration of function 'wolfSSL_set_app_data'; did you mean 'wolfSSL_set_ex_data'? [-Wimplicit-function-declaration]
   wolfSSL_set_app_data(wctx->ssl, ssl_user_data);
   ^~~~~~~~~~~~~~~~~~~~
   wolfSSL_set_ex_data
D:/a/curl/curl/lib/vtls/wolfssl.c:1288:3: error: nested extern declaration of 'wolfSSL_set_app_data' [-Werror=nested-externs]

https://github.com/curl/curl/actions/runs/13713131802/job/38353245932#step:10:20

@vszakats vszakats closed this in 07f99b7 Mar 7, 2025
@vszakats vszakats deleted the b-wolfssl-1 branch March 7, 2025 12:49
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