Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1300,9 +1300,15 @@ size_t wolfSSL_BIO_ctrl_pending(WOLFSSL_BIO *bio)
#endif

if (bio == NULL) {
return 0;
return WOLFSSL_FATAL_ERROR;
}

if (bio->method != NULL && bio->method->ctrlCb != NULL)
{
WOLFSSL_MSG("Calling custom BIO ctrl pending callback");
return (int)bio->method->ctrlCb(bio, WOLFSSL_BIO_CTRL_PENDING, 0, NULL);
}

if (bio->type == WOLFSSL_BIO_MD ||
bio->type == WOLFSSL_BIO_BASE64) {
/* these are wrappers only, get next bio */
Expand Down Expand Up @@ -1713,6 +1719,12 @@ int wolfSSL_BIO_reset(WOLFSSL_BIO *bio)
return WOLFSSL_BIO_ERROR;
}

if (bio->method != NULL && bio->method->ctrlCb != NULL)
{
WOLFSSL_MSG("Calling custom BIO reset callback");
return (int)bio->method->ctrlCb(bio, WOLFSSL_BIO_CTRL_RESET, 0, NULL);
}

switch (bio->type) {
#ifndef NO_FILESYSTEM
case WOLFSSL_BIO_FILE:
Expand Down Expand Up @@ -2184,7 +2196,11 @@ int wolfSSL_BIO_get_mem_data(WOLFSSL_BIO* bio, void* p)

if (bio == NULL)
return WOLFSSL_FATAL_ERROR;

if (bio->method != NULL && bio->method->ctrlCb != NULL)
{
WOLFSSL_MSG("Calling custom BIO get mem data callback");
return (int)bio->method->ctrlCb(bio, WOLFSSL_BIO_CTRL_INFO, 0, p);
}
mem_bio = bio;
/* Return pointer from last memory BIO in chain */
while (bio->next) {
Expand Down