Topic: Linking error while migrating from openssl to wolfssl

I have started migrating one of my project from openssl to wolfssl, but I am facing linking error for WOLFSSL_CTX_ctrl and WOLFSSL_CTX_callback_ctrl. I have include the wolfssl.lib as well.

Share

Re: Linking error while migrating from openssl to wolfssl

Hello Ashwini,

Could you please confirm that the application is including the same options.h header (or settings.h, if using the user_settings.h method)?

Also please share your configuration and the actual error as printed from the linker.

Thanks,
Eric @ wolfSSL Support

Re: Linking error while migrating from openssl to wolfssl

Thanks Eric for your response.

Initially I was including using "options.h" in my application, after initial failure I tried with "user_settings.h" as well but still observed the same error.

I compiled wolfssl solution "wolfssl64.sln" in visual studio 2019 with c++17. I am compiling DLL Release and DLL Debug configuration. I have also compiled libcurl with same configuration.

Some macros which my application is using was not added in openssl/ssl.h, so I added those macros in openssl/ssl.h like
# define DTLS1_MT_HELLO_VERIFY_REQUEST    3
# define SSL_CTRL_SET_MSG_CALLBACK           15
# define SSL_CTRL_SET_MSG_CALLBACK_ARG   16

I am getting below error while building my application
1>****.obj : error LNK2001: unresolved external symbol wolfSSL_CTX_callback_ctrl
1>****.obj : error LNK2001: unresolved external symbol wolfSSL_CTX_ctrl
1>****.dll : fatal error LNK1120: 2 unresolved externals


Thanks,
Ashwini

Post's attachments

error.PNG
error.PNG 11.11 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share

Re: Linking error while migrating from openssl to wolfssl

Hello Ashwini,

The VS project uses the user_settings.h from the IDE/WIN folder by default:
https://github.com/wolfSSL/wolfssl/blob … settings.h

Your application should be including the following headers

#include <wolfssl/wolfcrypt/settings.h>

#include <wolfssl/ssl.h>

Please share the user_settings.h file that is being used.

Re: Linking error while migrating from openssl to wolfssl

I tried by including wolfssl/wolfcrypt/settings.h in my application but still getting same error.
I am using default user_settings header present at IDE/WIN folder.

Thanks,
Ashwini

Share

Re: Linking error while migrating from openssl to wolfssl

Does the wolfssl DLL get created? Do the wolfSSL examples build correctly?

Re: Linking error while migrating from openssl to wolfssl

Yes WolfSSL DLL created along with all the examples present in solution.

Share

Re: Linking error while migrating from openssl to wolfssl

Great, can you please double check that the wolfssl.dll that is being linked with the application was generated using the same configuration headers that you are including with the application?

Re: Linking error while migrating from openssl to wolfssl

I found the root cause of that linker issue, these api's are guarded by OPENSSL_ALL. I need to use OPENSSL_ALL preprocessor to resolve this error.
Thanks for your support.

Share