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

152

(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

160

(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

161

(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

163

(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

164

(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

166

(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

167

(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

168

(7 replies, posted in wolfCrypt)

Great, glad to hear things are working!

169

(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

170

(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

172

(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

173

(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

174

(1 replies, posted in wolfSSL)

Hi sanny,

We don't currently have a version of SSH for MQX, but we are working on a few SSH projects internally. 

The first is a port of wolfSSL into OpenSSH.  We're in the process of getting our patches accepted by the OpenSSH project.  This has been tested on a Linux/Unix environment, but not an embedded OS.

In addition to our OpenSSH port, we're working on writing our own SSH implementation for embedded devices.  This will be called wolfSSH.  We don't yet have a release date scheduled for this, but it's on our roadmap for 2016:

https://wolfssl.com/wolfSSL/Blog/Entrie … _2016.html

What kind of project are you working on?

Best Regards,
Chris

175

(2 replies, posted in wolfSSL)

Hi,

wolfSSL currently only provides the functionality to load keys and certificates from files or memory buffers in either PEM or DER format.  We haven't yet ported wolfSSL into a smart card API, but could explore doing so on a consulting basis if desired.

Is this something that you would like to explore?

Best Regards,
Chris