From 83be2778fe11ede4cd065a136c686fe664c212a2 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 2 Feb 2016 16:25:42 +0100 Subject: [PATCH] Refactoring BIO: add error macros & text, and make update Reviewed-by: Kurt Roeckx --- crypto/bio/bio_err.c | 10 +++++++++- crypto/err/err.c | 2 ++ include/openssl/bio.h | 6 ++++++ include/openssl/err.h | 2 ++ util/libeay.num | 17 +++++++++++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c index 308bc3b5f3..e30c96a2d4 100644 --- a/crypto/bio/bio_err.c +++ b/crypto/bio/bio_err.c @@ -1,5 +1,6 @@ +/* crypto/bio/bio_err.c */ /* ==================================================================== - * Copyright (c) 1999-2015 The OpenSSL Project. All rights reserved. + * Copyright (c) 1999-2016 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -70,6 +71,7 @@ static ERR_STRING_DATA BIO_str_functs[] = { {ERR_FUNC(BIO_F_ACPT_STATE), "acpt_state"}, + {ERR_FUNC(BIO_F_ADDR_STRINGS), "addr_strings"}, {ERR_FUNC(BIO_F_BIO_ACCEPT), "BIO_accept"}, {ERR_FUNC(BIO_F_BIO_BER_GET_HEADER), "BIO_BER_GET_HEADER"}, {ERR_FUNC(BIO_F_BIO_CALLBACK_CTRL), "BIO_callback_ctrl"}, @@ -79,6 +81,7 @@ static ERR_STRING_DATA BIO_str_functs[] = { {ERR_FUNC(BIO_F_BIO_GET_ACCEPT_SOCKET), "BIO_get_accept_socket"}, {ERR_FUNC(BIO_F_BIO_GET_HOST_IP), "BIO_get_host_ip"}, {ERR_FUNC(BIO_F_BIO_GET_PORT), "BIO_get_port"}, + {ERR_FUNC(BIO_F_BIO_LOOKUP), "BIO_lookup"}, {ERR_FUNC(BIO_F_BIO_MAKE_PAIR), "bio_make_pair"}, {ERR_FUNC(BIO_F_BIO_NEW), "BIO_new"}, {ERR_FUNC(BIO_F_BIO_NEW_FILE), "BIO_new_file"}, @@ -87,6 +90,7 @@ static ERR_STRING_DATA BIO_str_functs[] = { {ERR_FUNC(BIO_F_BIO_NREAD0), "BIO_nread0"}, {ERR_FUNC(BIO_F_BIO_NWRITE), "BIO_nwrite"}, {ERR_FUNC(BIO_F_BIO_NWRITE0), "BIO_nwrite0"}, + {ERR_FUNC(BIO_F_BIO_PARSE_HOSTSERV), "BIO_parse_hostserv"}, {ERR_FUNC(BIO_F_BIO_PUTS), "BIO_puts"}, {ERR_FUNC(BIO_F_BIO_READ), "BIO_read"}, {ERR_FUNC(BIO_F_BIO_SOCK_INIT), "BIO_sock_init"}, @@ -108,6 +112,7 @@ static ERR_STRING_DATA BIO_str_functs[] = { static ERR_STRING_DATA BIO_str_reasons[] = { {ERR_REASON(BIO_R_ACCEPT_ERROR), "accept error"}, + {ERR_REASON(BIO_R_AMBIGUOUS_HOST_OR_SERVICE), "ambiguous host or service"}, {ERR_REASON(BIO_R_BAD_FOPEN_MODE), "bad fopen mode"}, {ERR_REASON(BIO_R_BAD_HOSTNAME_LOOKUP), "bad hostname lookup"}, {ERR_REASON(BIO_R_BROKEN_PIPE), "broken pipe"}, @@ -124,6 +129,7 @@ static ERR_STRING_DATA BIO_str_reasons[] = { {ERR_REASON(BIO_R_INVALID_IP_ADDRESS), "invalid ip address"}, {ERR_REASON(BIO_R_IN_USE), "in use"}, {ERR_REASON(BIO_R_KEEPALIVE), "keepalive"}, + {ERR_REASON(BIO_R_MALFORMED_HOST_OR_SERVICE), "malformed host or service"}, {ERR_REASON(BIO_R_NBIO_CONNECT_ERROR), "nbio connect error"}, {ERR_REASON(BIO_R_NO_ACCEPT_PORT_SPECIFIED), "no accept port specified"}, {ERR_REASON(BIO_R_NO_HOSTNAME_SPECIFIED), "no hostname specified"}, @@ -137,6 +143,8 @@ static ERR_STRING_DATA BIO_str_reasons[] = { {ERR_REASON(BIO_R_UNABLE_TO_LISTEN_SOCKET), "unable to listen socket"}, {ERR_REASON(BIO_R_UNINITIALIZED), "uninitialized"}, {ERR_REASON(BIO_R_UNSUPPORTED_METHOD), "unsupported method"}, + {ERR_REASON(BIO_R_UNSUPPORTED_PROTOCOL_FAMILY), + "unsupported protocol family"}, {ERR_REASON(BIO_R_WRITE_TO_READ_ONLY_BIO), "write to read only BIO"}, {ERR_REASON(BIO_R_WSASTARTUP), "WSAStartup"}, {0, NULL} diff --git a/crypto/err/err.c b/crypto/err/err.c index 2b2ecf4bf2..13757c2b21 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -173,6 +173,8 @@ static ERR_STRING_DATA ERR_str_functs[] = { # endif {ERR_PACK(0, SYS_F_OPENDIR, 0), "opendir"}, {ERR_PACK(0, SYS_F_FREAD, 0), "fread"}, + {ERR_PACK(0, SYS_F_GETADDRINFO, 0), "getaddrinfo"}, + {ERR_PACK(0, SYS_F_GETNAMEINFO, 0), "getnameinfo"}, {0, NULL}, }; diff --git a/include/openssl/bio.h b/include/openssl/bio.h index 999e573ae2..82d48450f1 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h @@ -810,6 +810,7 @@ void ERR_load_BIO_strings(void); /* Function codes. */ # define BIO_F_ACPT_STATE 100 +# define BIO_F_ADDR_STRINGS 134 # define BIO_F_BIO_ACCEPT 101 # define BIO_F_BIO_BER_GET_HEADER 102 # define BIO_F_BIO_CALLBACK_CTRL 131 @@ -819,6 +820,7 @@ void ERR_load_BIO_strings(void); # define BIO_F_BIO_GET_ACCEPT_SOCKET 105 # define BIO_F_BIO_GET_HOST_IP 106 # define BIO_F_BIO_GET_PORT 107 +# define BIO_F_BIO_LOOKUP 135 # define BIO_F_BIO_MAKE_PAIR 121 # define BIO_F_BIO_NEW 108 # define BIO_F_BIO_NEW_FILE 109 @@ -827,6 +829,7 @@ void ERR_load_BIO_strings(void); # define BIO_F_BIO_NREAD0 124 # define BIO_F_BIO_NWRITE 125 # define BIO_F_BIO_NWRITE0 122 +# define BIO_F_BIO_PARSE_HOSTSERV 136 # define BIO_F_BIO_PUTS 110 # define BIO_F_BIO_READ 111 # define BIO_F_BIO_SOCK_INIT 112 @@ -846,6 +849,7 @@ void ERR_load_BIO_strings(void); /* Reason codes. */ # define BIO_R_ACCEPT_ERROR 100 +# define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129 # define BIO_R_BAD_FOPEN_MODE 101 # define BIO_R_BAD_HOSTNAME_LOOKUP 102 # define BIO_R_BROKEN_PIPE 124 @@ -859,6 +863,7 @@ void ERR_load_BIO_strings(void); # define BIO_R_INVALID_IP_ADDRESS 108 # define BIO_R_IN_USE 123 # define BIO_R_KEEPALIVE 109 +# define BIO_R_MALFORMED_HOST_OR_SERVICE 130 # define BIO_R_NBIO_CONNECT_ERROR 110 # define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111 # define BIO_R_NO_HOSTNAME_SPECIFIED 112 @@ -872,6 +877,7 @@ void ERR_load_BIO_strings(void); # define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 # define BIO_R_UNINITIALIZED 120 # define BIO_R_UNSUPPORTED_METHOD 121 +# define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131 # define BIO_R_WRITE_TO_READ_ONLY_BIO 126 # define BIO_R_WSASTARTUP 122 diff --git a/include/openssl/err.h b/include/openssl/err.h index dd6f1253fb..0214e68c87 100644 --- a/include/openssl/err.h +++ b/include/openssl/err.h @@ -257,6 +257,8 @@ typedef struct err_state_st { # define SYS_F_WSASTARTUP 9/* Winsock stuff */ # define SYS_F_OPENDIR 10 # define SYS_F_FREAD 11 +# define SYS_F_GETADDRINFO 12 +# define SYS_F_GETNAMEINFO 13 /* reasons */ # define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ diff --git a/util/libeay.num b/util/libeay.num index f8ecea88ca..e2e0564c4d 100755 --- a/util/libeay.num +++ b/util/libeay.num @@ -4772,3 +4772,20 @@ EC_GROUP_get0_cofactor 5166 1_1_0 EXIST::FUNCTION:EC BN_bn2lebinpad 5167 1_1_0 EXIST::FUNCTION: BN_lebin2bn 5168 1_1_0 EXIST::FUNCTION: BN_bn2binpad 5169 1_1_0 EXIST::FUNCTION: +BIO_ADDR_service_string 5170 1_1_0 EXIST::FUNCTION: +BIO_ADDRINFO_family 5171 1_1_0 EXIST::FUNCTION: +BIO_ADDR_family 5172 1_1_0 EXIST::FUNCTION: +BIO_lookup 5173 1_1_0 EXIST::FUNCTION: +BIO_ADDR_path_string 5174 1_1_0 EXIST::FUNCTION: +BIO_ADDRINFO_protocol 5175 1_1_0 EXIST::FUNCTION: +BIO_ADDRINFO_socktype 5176 1_1_0 EXIST::FUNCTION: +BIO_ADDRINFO_next 5177 1_1_0 EXIST::FUNCTION: +BIO_ADDR_rawaddress 5178 1_1_0 EXIST::FUNCTION: +BIO_ADDR_hostname_string 5179 1_1_0 EXIST::FUNCTION: +BIO_ADDR_free 5180 1_1_0 EXIST::FUNCTION: +BIO_ADDR_rawport 5181 1_1_0 EXIST::FUNCTION: +BIO_ADDRINFO_address 5182 1_1_0 EXIST::FUNCTION: +BIO_ADDR_new 5183 1_1_0 EXIST::FUNCTION: +BIO_ADDR_rawmake 5184 1_1_0 EXIST::FUNCTION: +BIO_ADDRINFO_free 5185 1_1_0 EXIST::FUNCTION: +BIO_parse_hostserv 5186 1_1_0 EXIST::FUNCTION: -- 2.25.1