mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-30 07:52:12 +01:00
Address code review
- Use functions instead of accessing `BIO` members - Add `wolfSSL_BIO_method_type`
This commit is contained in:
@@ -134,6 +134,11 @@ static int wolfSSL_BIO_MEMORY_read(WOLFSSL_BIO* bio, void* buf, int len)
|
||||
return sz;
|
||||
}
|
||||
|
||||
int wolfSSL_BIO_method_type(const WOLFSSL_BIO *b)
|
||||
{
|
||||
return b != NULL ? b->type : (int)WOLFSSL_BIO_UNDEF;
|
||||
}
|
||||
|
||||
#ifndef WOLFCRYPT_ONLY
|
||||
/* Helper function to read from WOLFSSL_BIO_SSL type
|
||||
*
|
||||
@@ -1739,8 +1744,6 @@ long wolfSSL_BIO_set_nbio(WOLFSSL_BIO* bio, long on)
|
||||
return WOLFSSL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* creates a new custom WOLFSSL_BIO_METHOD */
|
||||
WOLFSSL_BIO_METHOD *wolfSSL_BIO_meth_new(int type, const char *name)
|
||||
{
|
||||
|
||||
@@ -30759,7 +30759,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
||||
}
|
||||
if (ret == WOLFSSL_TICKET_RET_FATAL)
|
||||
ret = WOLFSSL_TICKET_RET_REJECT;
|
||||
if (ret < 0) return ret;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (outLen > (int)inLen || outLen < (int)sizeof(InternalTicket)) {
|
||||
WOLFSSL_MSG("Bad user ticket decrypt len");
|
||||
return BAD_TICKET_KEY_CB_SZ;
|
||||
|
||||
@@ -170,8 +170,8 @@ int BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx)
|
||||
recvd = wolfSSL_BIO_read(ssl->biord, buf, sz);
|
||||
if (recvd <= 0) {
|
||||
if (/* ssl->biowr->wrIdx is checked for Bind9 */
|
||||
ssl->biowr != NULL && ssl->biowr->type == WOLFSSL_BIO_BIO &&
|
||||
ssl->biowr->wrIdx != 0 &&
|
||||
wolfSSL_BIO_method_type(ssl->biowr) == WOLFSSL_BIO_BIO &&
|
||||
wolfSSL_BIO_wpending(ssl->biowr) != 0 &&
|
||||
/* Not sure this pending check is necessary but let's double
|
||||
* check that the read BIO is empty before we signal a write
|
||||
* need */
|
||||
|
||||
Reference in New Issue
Block a user