Topic: WolfSSL over lwIP netcon API

Hi,
Just want to ask if WolfSSL can run over lwIP netcon API and not BSD Socket API ?

Thanks.

Share

Re: WolfSSL over lwIP netcon API

Hello dimax.main,

Thank you for contacting us here on the forums. Yes wolfSSL is set up to be able to use lwIP. In wolfssl/wolfcrypt/settings.h there is a macro flag for using it called "WOLFSSL_LWIP", it's currently around line 70. For some more reading on it there is a previous case where Chris was helping port to an embedded device using lwIP here https://www.wolfssl.com/forums/topic275 … tack.html.

Can you tell us some about the project being worked on?

Regards,
Jacob

Share

Re: WolfSSL over lwIP netcon API

Thanks.
But I afraid you have not fully understand my question. I did see that wolfSSL can run over lwIP stack. But lwIP provides two different APIs. One is Berkley socket like API and another is proprietary lwIP netcon API.  My question was if netcon API is supported and if not where should I look at in wolfSSL to add a port for it.

Share

Re: WolfSSL over lwIP netcon API

Hi dimax.main,

Missed the netcon part in the first post. No we do not have a default mapping to this API that is as easy as defining the WOLFSSL_LWIP macro, porting to the API would be as follows.

For porting to a system without making any changes to wolfSSL code I would recommend using the IO callbacks and defining WOLFSSL_USER_IO. The macro WOLFSSL_USER_IO removes header files and assumptions on IO calls, allowing the user to set their own IO operations. After creating a WOLFSSL_CTX structure in a users application the following functions would be needed to set what IO should be used.

//user application code defining the functions user-io-recv-callback and user-io-send-callback

//user application created ctx with wolfSSL_CTX_new();

wolfSSL_SetIORecv(ctx, user-io-recv-callback);
wolfSSL_SetIOSend(ctx, user-io-send-callback);

wolfSSL at this point is effectively encrypting/decrypting buffers and not worrying about how it is physically being sent or received. An example use of the IO callbacks can be found at https://github.com/wolfSSL/wolfssl-examples in the file tls/server-callback.c.

Regards,
Jacob

Share

Re: WolfSSL over lwIP netcon API

Oh there is also additional callbacks for setting a user defined ctx that wolfSSL passes around with the WOLFSSL struct when calling the user defined IO callbacks. This can be helpful if needing to keep a state attached to a connection. These functions can be found in wolfssl-root/src/io.c.

wolfSSL_SetIOReadCtx(ssl, users-void-ptr);
wolfSSL_SetIOWriteCtx(ssl, users-void-ptr);

"users-void-ptr" would then be passed from wolfSSL as the 4th argument to a user created IO callback function.

Regards,
Jacob

Share