FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/src/bio.c
/* Helper function to read from WOLFSSL_BIO_SSL type
 *
 * returns the number of bytes read on success
 */
Helper function to read from WOLFSSL_BIO_SSL type
returns the number of bytes read on success
Helper function to read from WOLFSSL_BIO_SSL type returns the number of bytes read on success
static int wolfSSL_BIO_SSL_read(WOLFSSL_BIO* bio, void* buf,
        int len, WOLFSSL_BIO* front)
{
    int ret;
    WOLFSSL_ENTER("wolfSSL_BIO_SSL_read");
    if ((front == NULL) || front->eof)
        return WOLFSSL_FATAL_ERROR;
    bio->flags &= ~(WOLFSSL_BIO_FLAG_RETRY); 
    ret = wolfSSL_read((WOLFSSL*)bio->ptr, buf, len);
    if (ret == 0)
        front->eof = 1;
    else if (ret < 0) {
        int err = wolfSSL_get_error((WOLFSSL*)bio->ptr, 0);
        if ( !(err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) ) {
            front->eof = 1;
        }
        else {
            bio->flags |= WOLFSSL_BIO_FLAG_RETRY; 
        }
    }
    return ret;
}
static int wolfSSL_BIO_SSL_read ( WOLFSSL_BIO * bio , void * buf , int len , WOLFSSL_BIO * front ) { int ret ; WOLFSSL_ENTER ( " " ) ; if ( ( front == NULL ) || front -> eof ) return WOLFSSL_FATAL_ERROR ; bio -> flags &= ~ ( WOLFSSL_BIO_FLAG_RETRY ) ; ret = wolfSSL_read ( ( WOLFSSL * ) bio -> ptr , buf , len ) ; if ( ret == 0 ) front -> eof = 1 ; else if ( ret < 0 ) { int err = wolfSSL_get_error ( ( WOLFSSL * ) bio -> ptr , 0 ) ; if ( ! ( err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE ) ) { front -> eof = 1 ; } else { bio -> flags |= WOLFSSL_BIO_FLAG_RETRY ; } } return ret ; }
Helper function to read from WOLFSSL_BIO_SSL type
 returns the number of bytes read on success
Helper function to read from WOLFSSL_BIO_SSL type returns the number of bytes read on success
/* already got eof, again is error */ /* default no retry */ /* should retry */