Topic: Integrating wolfSSL to Embedded OS

Hi,

I am very new to wolfSSL and security in general. Currently I am trying to integrate version 5.5.4 of wolfSSL into proprietary 32 Bit Embedded OS. This is more of a feasibility check of wolfSSL compatibility with our OS before we move on to adopting it. I have tried integrating root wolfSSL directory and did all the basic configurations as needed. I have also enabled WOLFSSL_LWIP. Looks like there is no issue with the compilation but I am facing some linker errors. I do see the file inclusions happening as expected and not sure why this is happening. Can you help me undertstand what is going wrong over here? I will share the build log.

1>ssl.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function _wolfSSL_BIO_free
1>ssl.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function _wolfSSL_dtls_create_peer
1>ssl.obj : error LNK2019: unresolved external symbol __imp__inet_pton@12 referenced in function _wolfSSL_dtls_create_peer
1>wolfio.obj : error LNK2019: unresolved external symbol __imp__getpeername@12 referenced in function _EmbedGenerateCookie
1>wolfio.obj : error LNK2019: unresolved external symbol __imp__getsockopt@20 referenced in function _isDGramSock
1>wolfio.obj : error LNK2019: unresolved external symbol __imp__recvfrom@24 referenced in function _EmbedReceiveFrom
1>wolfio.obj : error LNK2019: unresolved external symbol __imp__sendto@24 referenced in function _EmbedSendTo
1>wolfio.obj : error LNK2019: unresolved external symbol __imp__setsockopt@20 referenced in function _EmbedReceiveFrom
1>wolfio.obj : error LNK2019: unresolved external symbol __imp__WSAGetLastError@0 referenced in function _wolfSSL_LastError
1>.\Builds\tc27x_Win32\TinyOs_Win32.exe : fatal error LNK1120: 9 unresolved externals


Also will I be able to use your client /server example projects directly? What kind of modifications are expected to make it work with my proprietary OS? Any documents or guidance will be appreciated.

Share

Re: Integrating wolfSSL to Embedded OS

Hi singhshikha,

We do rely on some system calls such as closesocket, htons etc.  Please confirm you are linking in your standard library.  If so, you will need to provide wolfSSL with your OS' equivalent to these functions.  We check if our function aliases such as CloseSocket have been defined, which allows you to override them by defining them in your user_settings.h:

#define CloseSocket(s) YourCloseSocketFn(s)
#define XHTONS(a) YourHtoNsFn((a))
#define XINET_PTON(a,b,c)   YourInet_PtonFn((a),(b),(c))
#define DTLS_RECVFROM_FUNCTION YourRecvFromFn
#define DTLS_SENDTO_FUNCTION YourSendToFn

If you don't have any of these functions, you'll need to define a wrapper function instead which provides equivalent functionality.
setsockopt, getpeername and getsockopt are currently called directly in our code and can't be overridden.
WSAGetLastError is coming from USE_WINDOWS_API, don't define this if you don't have Windows API support.

If you continue to run into issues, please reach out to us at support AT wolfssl DOT com with your user_settings.h.  It would also be helpful to know what kind of system calls your OS has available.

I recommend upgrading to our latest release 5.6.0 when feasible for the best support and performance.

Thanks,
Kareem

Share