Fix for BIO_wpending
to work correctly.
This commit is contained in:
parent
17e102d914
commit
eca64717be
33
src/bio.c
33
src/bio.c
@ -499,7 +499,6 @@ int wolfSSL_BIO_write(WOLFSSL_BIO* bio, const void* data, int len)
|
||||
}
|
||||
|
||||
|
||||
/*** TBD ***/
|
||||
WOLFSSL_API long wolfSSL_BIO_ctrl(WOLFSSL_BIO *bio, int cmd, long larg, void *parg)
|
||||
{
|
||||
(void)bio;
|
||||
@ -507,8 +506,8 @@ WOLFSSL_API long wolfSSL_BIO_ctrl(WOLFSSL_BIO *bio, int cmd, long larg, void *pa
|
||||
(void)larg;
|
||||
(void)parg;
|
||||
|
||||
WOLFSSL_ENTER("BIO_ctrl");
|
||||
return 1;
|
||||
WOLFSSL_STUB("BIO_ctrl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -688,6 +687,31 @@ WOLFSSL_BIO* wolfSSL_BIO_next(WOLFSSL_BIO* bio)
|
||||
return bio->next;
|
||||
}
|
||||
|
||||
/* BIO_wpending returns the number of bytes pending to be written. */
|
||||
size_t wolfSSL_BIO_wpending(const WOLFSSL_BIO *bio)
|
||||
{
|
||||
WOLFSSL_ENTER("BIO_wpending");
|
||||
|
||||
if (bio == NULL)
|
||||
return 0;
|
||||
|
||||
if (bio->ssl != NULL) {
|
||||
return (long)wolfSSL_pending(bio->ssl);
|
||||
}
|
||||
|
||||
if (bio->type == WOLFSSL_BIO_MEMORY) {
|
||||
return bio->wrSz;
|
||||
}
|
||||
|
||||
/* type BIO_BIO then check paired buffer */
|
||||
if (bio->type == WOLFSSL_BIO_BIO && bio->pair != NULL) {
|
||||
WOLFSSL_BIO* pair = bio->pair;
|
||||
return pair->wrIdx;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/* Return the number of pending bytes in read and write buffers */
|
||||
size_t wolfSSL_BIO_ctrl_pending(WOLFSSL_BIO *bio)
|
||||
@ -741,14 +765,13 @@ long wolfSSL_BIO_get_mem_ptr(WOLFSSL_BIO *bio, WOLFSSL_BUF_MEM **ptr)
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
/*** TBD ***/
|
||||
WOLFSSL_API long wolfSSL_BIO_int_ctrl(WOLFSSL_BIO *bp, int cmd, long larg, int iarg)
|
||||
{
|
||||
(void) bp;
|
||||
(void) cmd;
|
||||
(void) larg;
|
||||
(void) iarg;
|
||||
WOLFSSL_ENTER("BIO_int_ctrl");
|
||||
WOLFSSL_STUB("BIO_int_ctrl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -649,7 +649,7 @@ typedef STACK_OF(WOLFSSL_ASN1_OBJECT) GENERAL_NAMES;
|
||||
#define GENERAL_NAMES_free(GENERAL_NAMES)NULL
|
||||
|
||||
#define SSL_set_mode(ssl,op) wolfSSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
|
||||
#define BIO_wpending(b) wolfSSL_BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)
|
||||
|
||||
#define SSL_CTX_use_certificate_ASN1 wolfSSL_CTX_use_certificate_ASN1
|
||||
#define SSL_CTX_set0_chain(ctx,sk) \
|
||||
wolfSSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk))
|
||||
@ -663,6 +663,7 @@ typedef STACK_OF(WOLFSSL_ASN1_OBJECT) GENERAL_NAMES;
|
||||
#define BIO_new_file wolfSSL_BIO_new_file
|
||||
#define BIO_ctrl wolfSSL_BIO_ctrl
|
||||
#define BIO_ctrl_pending wolfSSL_BIO_ctrl_pending
|
||||
#define BIO_wpending wolfSSL_BIO_wpending
|
||||
#define BIO_get_mem_ptr wolfSSL_BIO_get_mem_ptr
|
||||
#define BIO_int_ctrl wolfSSL_BIO_int_ctrl
|
||||
#define BIO_reset wolfSSL_BIO_reset
|
||||
|
@ -2599,6 +2599,7 @@ WOLFSSL_API WOLFSSL_X509* wolfSSL_d2i_X509_bio(WOLFSSL_BIO* bio,
|
||||
WOLFSSL_X509** x509);
|
||||
WOLFSSL_API WOLFSSL_X509_STORE* wolfSSL_CTX_get_cert_store(WOLFSSL_CTX* ctx);
|
||||
|
||||
WOLFSSL_API size_t wolfSSL_BIO_wpending(const WOLFSSL_BIO *bio);
|
||||
WOLFSSL_API size_t wolfSSL_BIO_ctrl_pending(WOLFSSL_BIO *b);
|
||||
WOLFSSL_API size_t wolfSSL_get_server_random(const WOLFSSL *ssl,
|
||||
unsigned char *out, size_t outlen);
|
||||
|
Loading…
x
Reference in New Issue
Block a user