Hi,

wolfSSL contains an OpenSSL compatibility layer.  This layer currently contains roughly the 400 most commonly used OpenSSL functions, which are then mapped down to wolfSSL's native API internally.  As OpenSSL contains over 4,000 functions, this layer is not complete and meant to act as a starting place.  This layer slowly grows as we do more ports into applications that had previously used OpenSSL.  Some recent examples of these have been OpenSSH, stunnel, and lighttpd.

You can enable the OpenSSL compatibility layer when compiling wolfSSL by using the "--enable-opensslextra" ./configure option, or by defining OPENSSL_EXTRA.  To compile an existing OpenSSL-based application against the wolfSSL compatibility layer, you will need to switch the <openssl/ssl.h> header to <wolfssl/openssl/ssl.h> and link against "-lwolfssl" instead of "-lssl -lcrypto".

We haven't tried compiling wolfSSL with Qt yet, so I don't know at the moment what (if any) gaps there would be between our compatibility layer and Qt's usage of the OpenSSL API.  You could try the compilation yourself, or we could explore porting wolfSSL into Qt on a consulting basis if desired.

Let us know what you think and we can go from there.  You can reach us directly at info (at) wolfssl (dot) com.

Best Regards,
Chris

A possible disadvantage would be slightly higher stack use per thread, since you now have an ECC fixed point cache per thread, instead of one global cache.  The upside is that it may be more performant as you no longer have to lock/unlock mutexes on the cache.

Hi Ray,

Since your colleague tried the same test on Linux and wasn't able to see the performance delta that you did, my guess is that it is a difference in compilation options used by either OpenSSL and/or wolfSSL on those two different platforms.

The one that comes to mind is support for Intel AES-NI instructions.  Since you mentioned GHASH, you must be using an AES-GCM based cipher suite.  If OpenSSL had been compiled with AES-NI support on Windows but wolfSSL had not, that would explain the performance difference.  You can enable AES-NI support when compiling wolfSSL by defining WOLFSSL_AESNI.  This assumes that you are on an Intel processor with AES-NI support, and that your toolchain supports the AES-NI intrinsics.

Best Regards,
Chris

154

(1 replies, posted in wolfMQTT)

Hi gauravsh,

Did you encounter build errors with wolfMQTT or wolfSSL, or both?  If so, can you elaborate?

The wolfSSL porting guide is located here:
https://www.wolfssl.com/wolfSSL/Docs-wo … guide.html

We don't have a wolfMQTT porting guide yet, but will be able to answer questions that you have regarding porting wolfMQTT.

Thanks,
Chris

Hi LimeD,

Great!  Glad that helped clear things up.

Best Regards,
Chris

Hi raysatiro,

HAVE_THREAD_LS is not required for building wolfSSL for Visual Studio, but is optional.  What this does is use thread local storage for the ECC fixed point cache.  If HAVE_THREAD_LS is not defined, wolfSSL will instead use mutex locks around the ECC fixed point cache.

Best Regards,
Chris

The way the 3SHAKE attack used Secure Renegotiation and session resumption is a protocol (or feature) level vulnerability.  This means that it affects any implementation that supports Secure Renegotiation.

Hi raysatiro,

Secure renegotiation (RFC 5746) was indeed meant to fix the original or "insecure" renegotiation.

Our comments about attacks on Secure Renegotiation are instead directly related to the new "secure" version, specifically the 3SHAKE attack which takes advantage of an incorrect assumption made in the Secure Renegotiation spec:

3SHAKE Attack Webpage:
https://mitls.org/pages/attacks/3SHAKE

Blog post from cryptographyengineering.com that talks about this as well:
http://blog.cryptographyengineering.com … shake.html

Best Regards,
Chis

wolfSSL's I/O callbacks are prototyped by the following:

int (*CallbackIORecv)(WOLFSSL *ssl, char *buf, int sz, void *ctx);
int (*CallbackIOSend)(WOLFSSL *ssl, char *buf, int sz, void *ctx);

Whenever wolfSSL needs additional data to advance its internal state machine, it will call the RECEIVE callback. The job of the RECEIVE callback is to place data into the provided buffer “buf”. wolfSSL asks for “sz” bytes of data, but if the callback has less data than requested, it can copy the number of bytes it has available into “buf” and return the number of bytes that have been written.

Whenever wolfSSL needs to send data in order to advance its internal state machine, it will call the SEND callback. The job of the SEND callback is to send the data in the buffer “buf” to the peer. The number of bytes in “buf” is given to the callback through the “sz” parameter. If the callback is only able to send part of the data in “buf”, it should return the number of bytes that were sent. wolfSSL will internally loop back around and call the callback again to get the rest of the data.

The third thing that comes into play with the I/O callbacks is the associated context (void *ctx). This can be a pointer to anything the user would like handed back to them during the I/O callbacks. Oftentimes this is a custom structure that would hold a pointer to data buffers, data sizes, socket handles, or in your case information necessary to send/receive data over your UART connection.

These I/O callback “contexts” can be set by the application using:

void wolfSSL_SetIOReadCtx( WOLFSSL* ssl, void *ctx);
void wolfSSL_SetIOWriteCtx(WOLFSSL* ssl, void *ctx);

From your last post, it sounds like in your case, your UART might buffer data when received, then in the wolfSSL Receive callback, you would simply copy data from the buffered area to wolfSSL’s internal buffer in the callback.

Does this make sense?  Is there anything that needs clarifying?

Best Regards,
Chris

Hi LimeD,

Firstly, great questions.  The wolfSSL I/O callbacks can be tricky to understand at first, but once you get the hang of them, they get much easier.

I'm working on putting together a thorough response for your questions and will post them here soon.

Thanks,
Chris

This issue is being handled through the wolfSSL support channel instead.  Copying ECDSA signature size information here for reference:

ECDSA signatures are composed of a tuple (R,S) combined with an ECC header and some padding. R and S are between 0 and n (n being the curve order, which is 256-bits in your case, or 32-bytes). This means that R and S can have a maximum of 32 each, but can also be smaller than 32, given the 0-n range.

The maximum ECDSA signature size, as given by wc_ecc_sig_size(), is 74 bytes for a 256-bit ECDSA key, but the minimum size can vary.

Chris

162

(5 replies, posted in wolfSSL)

Hi elektro,

"-308" is a general socket error, which usually means something happened that caused the peer to shut down the connection.  Do you have any debug logs from the server side of the connection?  You can enable wolfSSL debug messages by compiling wolfSSL with DEBUG_WOLFSSL enabled, then calling wolfSSL_Debugging_ON() before any other wolfSSL function calls.

Thanks,
Chris

163

(1 replies, posted in wolfMQTT)

Welcome to the wolfMQTT forum.  Please submit any questions, comments, feature requests, or anything else related to the wolfMQTT library here.

Best Regards,
Chris

Hi NTMS,

wolfSSL and wolfCrypt support compilation with VS2015 for Windows.  We also support compiling and running in embedded linux environments.

Instructions on how to compile wolfSSL for Visual Studio can be found at the following link:
https://www.wolfssl.com/wolfSSL/Docs-wo … tudio.html

Best Regards,
Chris

165

(5 replies, posted in wolfCrypt)

Hi Sam,

Once you have a DSA key in PEM format, you can convert it to DER format using the OpenSSL command line utility:

openssl dsa -inform PEM -in dsa2048.pem -outform DER -out dsa2048.der

You could then use the gencertbuf.pl script we have in the root wolfSSL directory to convert the .der file to a C-style array.  You will need to modify the fileList_1024[] or fileList_2048[] array in gencertbuf.pl to add in your .der file, then run the script.  It will place a C array by the name specific in the file <wolfssl_root>/wolfssl/certs_test.h.

Best Regards,
Chris

166

(5 replies, posted in wolfCrypt)

Hi,

wc_DsaPrivateKeyDecode() is the correct function to import a DER-formatted DSA key into a DsaKey structure.  What error is being returned from the function?

Thanks,
Chris

Hi Semih,

Can you try enabling the "supported curves" extension when compiling wolfSSL?  We recently noticed that this is required to connect to some implementations using an ECC based cipher suite.

You can enable this using the "--enable-supportedcurves" ./configure option, ie:

./configure --enable-supportedcurves

Thanks,
Chris

168

(11 replies, posted in wolfSSL)

Hi Sam,

We don't have an example of using wolfSSL with the STMCube, but in general the link to Section 2.4 of the wolfSSL Manual above explains what files you need to compile/include from the wolfSSL package.  You can either compile the wolfSSL files together with your application code, or compile wolfSSL as a separate library project then link against. it.

Are you running into any errors at this point?

Best Regards,
Chris

169

(1 replies, posted in wolfSSL)

Hi windsp,

wolfSSL does certificate validation internally during an SSL/TLS connection.  If you need to validate certain peer certificates manually during the SSL/TLS handshake you can do so by registering your own verify callback as the third parameter when calling wolfSSL_CTX_set_verify().  By default the verify callback will only be called upon validation failure unless WOLFSSL_ALWAYS_VERIFY_CB is defined.

If you instead are looking to validate certificates standalone from an SSL/TLS connection, you can use the wolfSSL CertManager functionality.  These functions are found in <wolfssl/ssl.h>.  You can view the API docs at the following URL [1], as well as a simple example [2].

Best Regards,
Chris

[1] https://wolfssl.com/wolfSSL/Docs-wolfss … nager.html
[2] https://github.com/wolfSSL/wolfssl-exam … ertmanager

170

(7 replies, posted in wolfCrypt)

Great, glad to hear things are working!

171

(1 replies, posted in wolfCrypt)

Hi lwatcdr,

I just posted a response to your other thread related to this topic:
http://www.yassl.com/forums/topic761-der-to-rsakey.html

Best Regards,
Chris

172

(7 replies, posted in wolfCrypt)

Hi,

If you are importing an RSA key generated by OpenSSL, you will need to define RSA_DECODE_EXTRA when compiling wolfSSL and your application.  Can you give that a try?

Can you also verify that you are compiling your application with the same preprocessor flags as you have with wolfSSL?  If you compiled wolfSSL using the autoconf (./configure) system, you can simply include <wolfssl/options.h> in your application code.

Thanks,
Chris

Hi,

We don't place any restrictions on the format of the I/O read and write contexts.  Your application doesn't even need to register them if you don't need to use them.  The context is simply a pointer, which can be a pointer to anything you want. 

We don't currently have an example of using the I/O callbacks with memory buffers.  If you were using memory buffers, you might have your own custom structure which contains pointers to buffers and members to hold sizes of the buffers.  When your I/O callbacks were called by wolfSSL, your callback could then access the context to get information about your own buffers.

Does this help?  Can you share any details about your project?

Best Regards,
Chris

174

(7 replies, posted in wolfCrypt)

Hi,

In <wolfssl/wolfcrypt/rsa.h>, you can use the following functions to import a DER-formatted public or private RSA key into an RsaKey structure:

int  wc_RsaPrivateKeyDecode(const byte* input, word32* inOutIdx, RsaKey*, word32);
int  wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx, RsaKey*, word32);

Best Regards,
Chris

175

(1 replies, posted in wolfCrypt)

Hi,

It looks like you need a couple extra defines when compiling wolfSSL and your application, mainly:

FREERTOS - this enables wolfSSL's FreeRTOS port layer
HAVE_AESGCM - this enables AES-GCM in wolfSSL

You'll need to compile both your application code and the wolfSSL library with the same preprocessor defines.  To make this easier, if you define WOLFSSL_USER_SETTINGS when compiling wolfSSL, wolfSSL will expect to find a <user_settings.h> header file on the include path.  You can put all your custom defines there, and also include it in your application code.

Do you mind if I ask what type of project you are working on?

Best Regards,
Chris