FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/src/bio.c
/* Return the number of pending bytes in read and write buffers */
Return the number of pending bytes in read and write buffers
Return the number of pending bytes in read and write buffers
size_t wolfSSL_BIO_ctrl_pending(WOLFSSL_BIO *bio)
{
    WOLFSSL_ENTER("wolfSSL_BIO_ctrl_pending");
    if (bio == NULL) {
        return 0;
    }
    if (bio->type == WOLFSSL_BIO_MD) {
        while (bio->next != NULL) {
            bio = bio->next;
            if (bio->type != WOLFSSL_BIO_MD) {
                break;
            }
        }
    }
#ifndef WOLFCRYPT_ONLY
    if (bio->type == WOLFSSL_BIO_SSL && bio->ptr != NULL) {
        return (long)wolfSSL_pending((WOLFSSL*)bio->ptr);
    }
#endif
    if (bio->type == WOLFSSL_BIO_MEMORY) {
        return bio->wrSz;
    }
    if (bio->type == WOLFSSL_BIO_BIO && bio->pair != NULL) {
        WOLFSSL_BIO* pair = bio->pair;
        if (pair->wrIdx > 0 && pair->wrIdx <= pair->rdIdx) {
            return pair->wrSz - pair->rdIdx + pair->wrIdx;
        }
        else {
            return pair->wrIdx - pair->rdIdx;
        }
    }
    return 0;
}
size_t wolfSSL_BIO_ctrl_pending ( WOLFSSL_BIO * bio ) { WOLFSSL_ENTER ( " " ) ; if ( bio == NULL ) { return 0 ; } if ( bio -> type == WOLFSSL_BIO_MD ) { while ( bio -> next != NULL ) { bio = bio -> next ; if ( bio -> type != WOLFSSL_BIO_MD ) { break ; } } } #ifndef WOLFCRYPT_ONLY if ( bio -> type == WOLFSSL_BIO_SSL && bio -> ptr != NULL ) { return ( long ) wolfSSL_pending ( ( WOLFSSL * ) bio -> ptr ) ; } #endif if ( bio -> type == WOLFSSL_BIO_MEMORY ) { return bio -> wrSz ; } if ( bio -> type == WOLFSSL_BIO_BIO && bio -> pair != NULL ) { WOLFSSL_BIO * pair = bio -> pair ; if ( pair -> wrIdx > 0 && pair -> wrIdx <= pair -> rdIdx ) { return pair -> wrSz - pair -> rdIdx + pair -> wrIdx ; } else { return pair -> wrIdx - pair -> rdIdx ; } } return 0 ; }
Return the number of pending bytes in read and write buffers
Return the number of pending bytes in read and write buffers
/* MD is a wrapper only get next bio */ /* type BIO_BIO then check paired buffer */ /* in wrap around state where beginning of buffer is being
             * overwritten */ /* simple case where has not wrapped around */