Topic: Can't get cURL with wolfSSL to work

Hi!

I have been using Curllib for regular ftp transfer but need to make it work for sftp as well. I wanted to use wolfSSL for this and I followed the build instructions on how to build ssl and ssh for Visual studio and that worked without any issue what I can see.

Now I need to build curllib and I selected "Lib wolfSSL" in the curl visual studion project (I have tried both release and debug, 32 and 64 bit with same result). I setup the include directories so it found the wolf .h files but it wont't build without errors.

I get a lot of errors but I think a lot of them depends on these:
Error    C2027    use of undefined type 'sha256_ctx'
Error    C2061    syntax error: identifier 'EVP_MD_CTX'

The error comes from these lines in sha256.c

#if defined(USE_OPENSSL_SHA256)

struct sha256_ctx {
  EVP_MD_CTX *openssl_ctx;
}; is not defined

I found EVP_MD_CTX in the file 'compat_types.h' but that file is not referenced anywere in the project.

so its is strange that USE_OPENSSL_SHA256 is defined since that will create errors.

#ifdef USE_WOLFSSL
#include <wolfssl/options.h>
#ifndef NO_SHA256
#define USE_OPENSSL_SHA256
#endif
#endif

USE_OPENSSL_SHA256 is defined since NO_SHA256 is NOT, but defining it created just a whole lot of other errors so defining it wasn't the solution.

So I'm stuck at the moment since I can't find any information regarding how to solve this.

Share

Re: Can't get cURL with wolfSSL to work

Hi Samuel,

It looks like you are not enabling our OpenSSL compatibility layer when building curl, this implements EVP_MD_CTX and many other OpenSSL types/functions.  Please share your build settings for wolfSSL and wolfSSL version.  You should be building wolfSSL with --enable-curl to use it with curl.

Thanks,
Kareem

Share

Re: Can't get cURL with wolfSSL to work

Hi

I used the 'wolfssl64.sln' file that is included to build SSL. So should I add something to the preprocessor directive?

Share

Re: Can't get cURL with wolfSSL to work

No answer on how to use wolfssl with curl?
I found in SSL the macro "HAVE_CURL", but when I added that to the preprocessor directive I just got new errors

Alot of:
Error    C2143    syntax error: missing '{' before '*'
on lines like:
int wolfSSL_MD5_Init(WOLFSSL_MD5_CTX* md5)

Share

Re: Can't get cURL with wolfSSL to work

Hi Samuel,

What version of wolfSSL are you using?  If you aren't using our latest release 5.7.0, please upgrade.

HAVE_CURL is not sufficient, you will need multiple other defines as follows:

#define HAVE_TLS_EXTENSIONS
#define HAVE_SNI
#define HAVE_SUPPORTED_CURVES
#define HAVE_FFDHE_2048
#define WOLFSSL_TLS13
#define HAVE_EXTENDED_MASTER
#define NO_RC4
#define HAVE_ENCRYPT_THEN_MAC
#define HAVE_CRL
#define HAVE_CERTIFICATE_STATUS_REQUEST
#define HAVE_CERTIFICATE_STATUS_REQUEST_V2
#define WOLFSSL_ALT_CERT_CHAINS
#define WOLFSSL_IP_ALT_NAME
#define HAVE_SESSION_TICKET
#define NO_SESSION_CACHE_REF
#define WOLFSSL_DES_ECB
#define WOLFSSL_TICKET_NONCE_MALLOC
#define NO_PSK
#define WOLFSSL_ENCRYPTED_KEYS
#define HAVE_DH_DEFAULT_PARAMS
#define WOLFSSL_SYS_CA_CERTS
#define HAVE_OCSP
#define OPENSSL_EXTRA
#define NO_DES3_TLS_SUITES
#define WOLFSSL_PUBLIC_MP
#define HAVE_SERVER_RENEGOTIATION_INFO

Thanks,
Kareem

Share

Re: Can't get cURL with wolfSSL to work

I have used the latest version, but haven't had time to check into this more but hope I can soon. So I need to add all these definitions to the preprocessor in Visual Studio?
Are there any document or something somethere describing on how to use it with cURL?

Share

Re: Can't get cURL with wolfSSL to work

The definitions go in your project's user_settings.h.
Yes, check out our blog post here: https://www.wolfssl.com/using-curl-with … d-tls-1-3/

Share

Re: Can't get cURL with wolfSSL to work

I included it to the user_settings but get a whole set of new errors when trying to build SSL and SSH. This is not working at all and the information on that blog doesn't say anything about using Visual studio.
I think I have to abandon WolfSSL and see if I can get some other library for cURL since the project is stucked here.

Share

Re: Can't get cURL with wolfSSL to work

Can you share your error log so I can assist further?
We don't have an example of using Visual Studio to build curl but it should work.

Share