Topic: [SOLVED] Ultra low power system

Hello,

we want to integrate the wolfSSL into an ultra low power device where the CPU is held in sleep mode as much as possible. For this reason, everything is interrupt-driven; all threads are blocked by semaphores for an indefinite time otherwise the OS does not permit the CPU to enter into sleep mode. When the connectivity layer receives a data packet, it wakes up the CPU and then the CPU reads the data from the connectivity layer and then wakes a receiving thread that consumes the received data.
I was thinking to register the receive function with the wolfSSL_CTX_SetIORecv(). When needed, WolfSSL will call the ctx->CBIORecv() function and block indefinitely until data is pushed by the connectivity layer.

Is this the right approach to take? Or it is possible to push data into WolfSSL instead of polling for data?
Does wolfSSL_connect() have any means to timeout?

Regards, Peter

Share

Re: [SOLVED] Ultra low power system

Hi pm_vnct,

You are on the right track. If you register IO callbacks using `wolfSSL_CTX_SetIORecv` and `wolfSSL_CTX_SetIOSend`, then return `WOLFSSL_CBIO_ERR_WANT_READ` or `WOLFSSL_CBIO_ERR_WANT_WRITE` it will go up to the original caller wolfSSL_connect, wolfSSL_read or wolfSSL_write. This allows you to check for the return code, do other work and call again.

Here is an example for using the callbacks with want read/write:
https://github.com/wolfSSL/wolfssl-exam … callback.c

Here is an example for non-blocking:
https://github.com/wolfSSL/wolfssl-exam … ing.c#L136

Thanks,
David Garske, wolfSSL

Share

Re: [SOLVED] Ultra low power system

Thanks for the support. We successfully integrated the wolfssl library.

Share