1

(6 replies, posted in wolfSSL)

Hi embhorn,

Does the library supports non blocking I/O? I set non blocking option for a SSL object but wolfSS_read still does not return. As I wrote above it can be solved by using additional checking but the question remains.

Thanks,
Kamil

2

(6 replies, posted in wolfSSL)

Thanks for reply embhorn,

I managed that problem. I call some FreeRTOS api function that checks if there is data to be read on a socket. If there is some data then I call wolfSSL_read. The program do not get stuck now. I thought that wolfSSL_read do not block as underlying I/O function does. I use non-blocking option for a SSL object but probably I do something wrong becouse wolfSSL_read still blocks.

Thanks,
Kamil

3

(6 replies, posted in wolfSSL)

Dear support team,

I am using WolfSSL 3.15.3 library. I am trying to send e-mail via smpt.gmail.com on port 587. After sending "starttls" command I start tls with wolfSSL_read. This function does not return control to the program. Logs from the WolfSSL library are attached and defined as LOG 1 in logs.txt.

When I pause the program I get the following stack:

    MyCallbackIORecv() at main.c:135 0xc524   
    Receive() at internal.c:2 616 0x1e4ac   
    GetInputData() at internal.c:6 225 0x216fa   
    ProcessReply() at internal.c:6 354 0x2199e   
    ReceiveData() at internal.c:7 593 0x22c04   
    wolfSSL_read_internal() at ssl.c:571 0xdb76   
    wolfSSL_read() at ssl.c:595 0xdbba   
    TLSInit() at main.c:767 0xd112   
    pxPortInitialiseStack() at port.c:233 0x262c

The program does not get below GetInputData. MyCallbackIORecv code:

int MyCallbackIORecv(WOLFSSL *ssl, char *buf, int sz, void *ctx)
{
    int recvd, ret;
    int sd = *(int*)ctx;

    recvd = (int)FreeRTOS_recv((void *)sd, buf, sz, 0);

    if(recvd == -pdFREERTOS_ERRNO_ENOTCONN)
        ret=WOLFSSL_CBIO_ERR_CONN_CLOSE;
    else if(recvd == -pdFREERTOS_ERRNO_ENOMEM)
        ret=WOLFSSL_CBIO_ERR_GENERAL;
    else if(recvd == -pdFREERTOS_ERRNO_EINVAL)
        ret=WOLFSSL_CBIO_ERR_GENERAL;
    else if(recvd < 0)
        ret=WOLFSSL_CBIO_ERR_GENERAL;
    else
        ret=recvd;

    return ret;
}

I see that FreeRTOS_recv returns 0, so MyCallbackIORecv do the same. FreeRTOS_recv does not block. When I add the following lines

    else if(recvd == 0)
        ret=WOLFSSL_CBIO_ERR_WANT_READ;

or

    else if(recvd == 0)
        ret=WOLFSSL_CBIO_ERR_WANT_READ;

to MyCallbackIORecv I get the log defined as LOG 2 in the attached file.

I dont know why wolfSSL_read function does not return. Could anyone help me with this?

Regards,
Kamil