From ed4a9b15d9cd1eea7493873d01949f075cea2b65 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Mon, 21 Dec 2020 08:16:30 +0100 Subject: replace all BIO_R_NULL_PARAMETER by ERR_R_PASSED_NULL_PARAMETER Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/13713) --- crypto/bio/bio_err.c | 1 - crypto/bio/bio_lib.c | 22 +++++++++++----------- crypto/bio/bss_mem.c | 4 ++-- crypto/err/openssl.txt | 1 - include/openssl/bioerr.h | 2 +- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c index 08bf8dc98a..0ea23b62cf 100644 --- a/crypto/bio/bio_err.c +++ b/crypto/bio/bio_err.c @@ -46,7 +46,6 @@ static const ERR_STRING_DATA BIO_str_reasons[] = { "no hostname or service specified"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_NO_PORT_DEFINED), "no port defined"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_NO_SUCH_FILE), "no such file"}, - {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_NULL_PARAMETER), "null parameter"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_TRANSFER_ERROR), "transfer error"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_TRANSFER_TIMEOUT), "transfer timeout"}, {ERR_PACK(ERR_LIB_BIO, 0, BIO_R_UNABLE_TO_BIND_SOCKET), diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index 3f86db41b1..17537de6d9 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -253,7 +253,7 @@ static int bio_read_intern(BIO *b, void *data, size_t dlen, size_t *readbytes) int ret; if (b == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return -1; } if (b->method == NULL || b->method->bread == NULL) { @@ -318,7 +318,7 @@ static int bio_write_intern(BIO *b, const void *data, size_t dlen, int ret; if (b == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return -1; } if (b->method == NULL || b->method->bwrite == NULL) { @@ -377,7 +377,7 @@ int BIO_puts(BIO *b, const char *buf) size_t written = 0; if (b == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return -1; } if (b->method == NULL || b->method->bputs == NULL) { @@ -426,7 +426,7 @@ int BIO_gets(BIO *b, char *buf, int size) size_t readbytes = 0; if (b == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return -1; } if (b->method == NULL || b->method->bgets == NULL) { @@ -507,7 +507,7 @@ long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) long ret; if (b == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return -1; } if (b->method == NULL || b->method->ctrl == NULL) { @@ -535,8 +535,8 @@ long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) long ret; if (b == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); - return -1; + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); + return -2; } if (b->method == NULL || b->method->callback_ctrl == NULL || cmd != BIO_CTRL_SET_CALLBACK) { @@ -599,7 +599,7 @@ BIO *BIO_pop(BIO *b) BIO *ret; if (b == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } ret = b->next_bio; @@ -649,7 +649,7 @@ BIO *BIO_find_type(BIO *bio, int type) int mt, mask; if (bio == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } mask = type & 0xff; @@ -672,7 +672,7 @@ BIO *BIO_find_type(BIO *bio, int type) BIO *BIO_next(BIO *b) { if (b == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } return b->next_bio; @@ -855,7 +855,7 @@ int BIO_do_connect_retry(BIO *bio, int timeout, int nap_milliseconds) int rv; if (bio == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return -1; } diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c index ad7e8a6106..3bdf457966 100644 --- a/crypto/bio/bss_mem.c +++ b/crypto/bio/bss_mem.c @@ -91,7 +91,7 @@ BIO *BIO_new_mem_buf(const void *buf, int len) size_t sz; if (buf == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); return NULL; } sz = (len < 0) ? strlen(buf) : (size_t)len; @@ -222,7 +222,7 @@ static int mem_write(BIO *b, const char *in, int inl) BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr; if (in == NULL) { - ERR_raise(ERR_LIB_BIO, BIO_R_NULL_PARAMETER); + ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER); goto end; } if (b->flags & BIO_FLAGS_MEM_RDONLY) { diff --git a/crypto/err/openssl.txt b/crypto/err/openssl.txt index 40f93ba0cd..a06e3ced39 100644 --- a/crypto/err/openssl.txt +++ b/crypto/err/openssl.txt @@ -2039,7 +2039,6 @@ BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED:143:\ BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED:144:no hostname or service specified BIO_R_NO_PORT_DEFINED:113:no port defined BIO_R_NO_SUCH_FILE:128:no such file -BIO_R_NULL_PARAMETER:115:null parameter BIO_R_TRANSFER_ERROR:104:transfer error BIO_R_TRANSFER_TIMEOUT:105:transfer timeout BIO_R_UNABLE_TO_BIND_SOCKET:117:unable to bind socket diff --git a/include/openssl/bioerr.h b/include/openssl/bioerr.h index 00a7df227e..e2d247ea65 100644 --- a/include/openssl/bioerr.h +++ b/include/openssl/bioerr.h @@ -106,7 +106,7 @@ # define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144 # define BIO_R_NO_PORT_DEFINED 113 # define BIO_R_NO_SUCH_FILE 128 -# define BIO_R_NULL_PARAMETER 115 +# define BIO_R_NULL_PARAMETER 115 /* unused */ # define BIO_R_TRANSFER_ERROR 104 # define BIO_R_TRANSFER_TIMEOUT 105 # define BIO_R_UNABLE_TO_BIND_SOCKET 117 -- cgit v1.2.3