Topic: wolfSSL with wolfIP

I'm experimenting with using wolfSSL and wolfIP. When calling wolfSSL_connect() I get a failure with the log message "Your IO Send callback is null, please set".

I can see this is something to do with wolfSSL_SetIOWriteCTX(), but I'm not entirely sure what value to use - I'm a novice with wolfSSL.

Are there specific values I should set to link the two components together?

Share

Re: wolfSSL with wolfIP

Hi ah346743,

To better help you, can you let me know what platform you building on?  For example, is this an STM32CubeIDE project?

Warm regards, Anthony

Share

Re: wolfSSL with wolfIP

Hi

Yes, it's an STM32CubeIDE project on the Nucleo F429ZI development board. I've configured wolfSSL and wolfIP via CubeMX.

Share

4

Re: wolfSSL with wolfIP

Hi ah346743!
 
I am one of the developers that work on the wolfIP project. This isn't a bug, just a wiring step that's easy to miss.

The message "Your IO Send callback is null, please set" means wolfSSL doesn't yet know how to send/receive bytes. On STM32 + wolfIP there are no BSD sockets, so wolfSSL's built-in I/O is compiled out and you have to point it at wolfIP. Note that wolfSSL_SetIOWriteCtx() only sets the context pointer; it does not install the send callback, which is why it's still null.

You don't need that function at all. wolfIP ships a helper pair that does the whole job:

```
  ctx = wolfSSL_CTX_new(wolfTLSv1_3_client_method());
  wolfSSL_SetIO_wolfIP_CTX(ctx, ipstack);          /* installs send/recv callbacks */

  fd = wolfIP_sock_socket(ipstack, AF_INET, IPSTACK_SOCK_STREAM, 0);
  wolfIP_sock_connect(ipstack, fd, &remote, sizeof(remote));   /* TCP connect first */

  ssl = wolfSSL_new(ctx);
  wolfSSL_SetIO_wolfIP(ssl, fd);                    /* bind this session to the fd */

  ret = wolfSSL_connect(ssl);
```


Two things I would look out for:

1. Call wolfSSL_SetIO_wolfIP_CTX before wolfSSL_new. The callback is copied into the session at creation time.
2. wolfSSL_connect() won't finish in one call; it returns WANT_READ/WANT_WRITE until data moves. Keep wolfIP_poll(ipstack, HAL_GetTick()); running in your main loop and call wolfSSL_connect() again until it succeeds.

A full bare-metal example is here: src/port/stm32h563/tls_client.c

Could you try that and let me know? Two quick questions I have that may help you:

- Were you wiring the I/O manually, or calling the wolfSSL_SetIO_wolfIP* helpers?
- In CubeMX under Software Packs → Select Components, is the wolfSSL-IO component checked? If you get a linker error on wolfSSL_SetIO_wolfIP_CTX instead of the runtime message, that component isn't enabled.

Most of our Cube-pack TLS testing has been on the H5 a full working example lives here that may help you https://github.com/wolfSSL/wolfssl-exam … 2/pull/10.

Thanks
Aidan - wolfSSL

Share