Tweaks based on review feedback of BIO size_t work
Rename some parameters. Also change handling of buffer sizes >INT_MAX in length. Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
parent
bb5310bed5
commit
f42fd819d6
3 changed files with 17 additions and 17 deletions
|
@ -66,7 +66,7 @@ int bwrite_conv(BIO *bio, const char *in, size_t inl, size_t *written)
|
|||
int ret;
|
||||
|
||||
if (inl > INT_MAX)
|
||||
return 0;
|
||||
inl = INT_MAX;
|
||||
|
||||
ret = bio->method->bwrite_old(bio, in, (int)inl);
|
||||
|
||||
|
|
|
@ -552,10 +552,10 @@ int BIO_get_shutdown(BIO *a);
|
|||
void BIO_vfree(BIO *a);
|
||||
int BIO_up_ref(BIO *a);
|
||||
int BIO_read(BIO *b, void *data, int len);
|
||||
int BIO_read_ex(BIO *b, void *out, size_t outl, size_t *read);
|
||||
int BIO_read_ex(BIO *b, void *data, size_t datal, size_t *read);
|
||||
int BIO_gets(BIO *bp, char *buf, int size);
|
||||
int BIO_write(BIO *b, const void *data, int len);
|
||||
int BIO_write_ex(BIO *b, const void *in, size_t inl, size_t *written);
|
||||
int BIO_write_ex(BIO *b, const void *data, size_t datal, size_t *written);
|
||||
int BIO_puts(BIO *bp, const char *buf);
|
||||
int BIO_indent(BIO *b, int indent, int max);
|
||||
long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include <openssl/err.h>
|
||||
#include "ssl_locl.h"
|
||||
|
||||
static int ssl_write(BIO *h, const char *buf, size_t num, size_t *written);
|
||||
static int ssl_read(BIO *b, char *out, size_t outl, size_t *read);
|
||||
static int ssl_write(BIO *h, const char *buf, size_t size, size_t *written);
|
||||
static int ssl_read(BIO *b, char *buf, size_t size, size_t *readbytes);
|
||||
static int ssl_puts(BIO *h, const char *str);
|
||||
static long ssl_ctrl(BIO *h, int cmd, long arg1, void *arg2);
|
||||
static int ssl_new(BIO *h);
|
||||
|
@ -88,7 +88,7 @@ static int ssl_free(BIO *a)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int ssl_read(BIO *b, char *out, size_t outl, size_t *readbytes)
|
||||
static int ssl_read(BIO *b, char *buf, size_t size, size_t *readbytes)
|
||||
{
|
||||
int ret = 1;
|
||||
BIO_SSL *sb;
|
||||
|
@ -96,17 +96,17 @@ static int ssl_read(BIO *b, char *out, size_t outl, size_t *readbytes)
|
|||
int retry_reason = 0;
|
||||
int r = 0;
|
||||
|
||||
if (out == NULL)
|
||||
return (0);
|
||||
if (buf == NULL)
|
||||
return 0;
|
||||
sb = BIO_get_data(b);
|
||||
ssl = sb->ssl;
|
||||
|
||||
BIO_clear_retry_flags(b);
|
||||
|
||||
if (outl > INT_MAX)
|
||||
return -1;
|
||||
if (size > INT_MAX)
|
||||
size = INT_MAX;
|
||||
|
||||
ret = SSL_read(ssl, out, outl);
|
||||
ret = SSL_read(ssl, buf, size);
|
||||
if (ret > 0)
|
||||
*readbytes = ret;
|
||||
|
||||
|
@ -165,24 +165,24 @@ static int ssl_read(BIO *b, char *out, size_t outl, size_t *readbytes)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ssl_write(BIO *b, const char *out, size_t outl, size_t *written)
|
||||
static int ssl_write(BIO *b, const char *buf, size_t size, size_t *written)
|
||||
{
|
||||
int ret, r = 0;
|
||||
int retry_reason = 0;
|
||||
SSL *ssl;
|
||||
BIO_SSL *bs;
|
||||
|
||||
if (out == NULL)
|
||||
return (0);
|
||||
if (buf == NULL)
|
||||
return 0;
|
||||
bs = BIO_get_data(b);
|
||||
ssl = bs->ssl;
|
||||
|
||||
BIO_clear_retry_flags(b);
|
||||
|
||||
if (outl > INT_MAX)
|
||||
return 0;
|
||||
if (size > INT_MAX)
|
||||
size = INT_MAX;
|
||||
|
||||
ret = SSL_write(ssl, out, outl);
|
||||
ret = SSL_write(ssl, buf, size);
|
||||
|
||||
switch (SSL_get_error(ssl, ret)) {
|
||||
case SSL_ERROR_NONE:
|
||||
|
|
Loading…
Reference in a new issue