diff options
author | Rich Salz <rsalz@akamai.com> | 2019-05-31 13:52:45 -0400 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-07-16 05:26:28 +0200 |
commit | aac96e2797c34a6b2a839eb58c30ab3328a0cee8 (patch) | |
tree | 105434e5b948326f7846dce7a9a8fb7ff41974e6 /crypto | |
parent | 3d9b33b5e48d82d098a1f8c37dbf616a0d84621c (diff) | |
download | openssl-aac96e2797c34a6b2a839eb58c30ab3328a0cee8.zip openssl-aac96e2797c34a6b2a839eb58c30ab3328a0cee8.tar.gz openssl-aac96e2797c34a6b2a839eb58c30ab3328a0cee8.tar.bz2 |
Remove function name from errors
Deprecate all xxx_F_ defines.
Removed some places that tested for a specific function.
Use empty field for the function names in output.
Update documentation.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9058)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/crmf/crmf_lib.c | 11 | ||||
-rw-r--r-- | crypto/err/err.c | 62 | ||||
-rw-r--r-- | crypto/ui/ui_lib.c | 7 |
3 files changed, 12 insertions, 68 deletions
diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c index 55f1f38..e777a34 100644 --- a/crypto/crmf/crmf_lib.c +++ b/crypto/crmf/crmf_lib.c @@ -299,20 +299,20 @@ int OSSL_CRMF_MSG_set_certReqId(OSSL_CRMF_MSG *crm, int rid) } /* get ASN.1 encoded integer, return -1 on error */ -static int crmf_asn1_get_int(int func, const ASN1_INTEGER *a) +static int crmf_asn1_get_int(const ASN1_INTEGER *a) { int64_t res; if (!ASN1_INTEGER_get_int64(&res, a)) { - CRMFerr(func, ASN1_R_INVALID_NUMBER); + CRMFerr(0, ASN1_R_INVALID_NUMBER); return -1; } if (res < INT_MIN) { - CRMFerr(func, ASN1_R_TOO_SMALL); + CRMFerr(0, ASN1_R_TOO_SMALL); return -1; } if (res > INT_MAX) { - CRMFerr(func, ASN1_R_TOO_LARGE); + CRMFerr(0, ASN1_R_TOO_LARGE); return -1; } return (int)res; @@ -324,8 +324,7 @@ int OSSL_CRMF_MSG_get_certReqId(OSSL_CRMF_MSG *crm) CRMFerr(CRMF_F_OSSL_CRMF_MSG_GET_CERTREQID, CRMF_R_NULL_ARGUMENT); return -1; } - return crmf_asn1_get_int(CRMF_F_OSSL_CRMF_MSG_GET_CERTREQID, - crm->certReq->certReqId); + return crmf_asn1_get_int(crm->certReq->certReqId); } diff --git a/crypto/err/err.c b/crypto/err/err.c index 8752c11..c161dc2 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -71,36 +71,6 @@ static ERR_STRING_DATA ERR_str_libraries[] = { {0, NULL}, }; -static ERR_STRING_DATA ERR_str_functs[] = { - {ERR_PACK(0, SYS_F_FOPEN, 0), "fopen"}, - {ERR_PACK(0, SYS_F_CONNECT, 0), "connect"}, - {ERR_PACK(0, SYS_F_GETSERVBYNAME, 0), "getservbyname"}, - {ERR_PACK(0, SYS_F_SOCKET, 0), "socket"}, - {ERR_PACK(0, SYS_F_IOCTLSOCKET, 0), "ioctlsocket"}, - {ERR_PACK(0, SYS_F_BIND, 0), "bind"}, - {ERR_PACK(0, SYS_F_LISTEN, 0), "listen"}, - {ERR_PACK(0, SYS_F_ACCEPT, 0), "accept"}, -# ifdef OPENSSL_SYS_WINDOWS - {ERR_PACK(0, SYS_F_WSASTARTUP, 0), "WSAstartup"}, -# 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"}, - {ERR_PACK(0, SYS_F_SETSOCKOPT, 0), "setsockopt"}, - {ERR_PACK(0, SYS_F_GETSOCKOPT, 0), "getsockopt"}, - {ERR_PACK(0, SYS_F_GETSOCKNAME, 0), "getsockname"}, - {ERR_PACK(0, SYS_F_GETHOSTBYNAME, 0), "gethostbyname"}, - {ERR_PACK(0, SYS_F_FFLUSH, 0), "fflush"}, - {ERR_PACK(0, SYS_F_OPEN, 0), "open"}, - {ERR_PACK(0, SYS_F_CLOSE, 0), "close"}, - {ERR_PACK(0, SYS_F_IOCTL, 0), "ioctl"}, - {ERR_PACK(0, SYS_F_STAT, 0), "stat"}, - {ERR_PACK(0, SYS_F_FCNTL, 0), "fcntl"}, - {ERR_PACK(0, SYS_F_FSTAT, 0), "fstat"}, - {0, NULL}, -}; - static ERR_STRING_DATA ERR_str_reasons[] = { {ERR_R_SYS_LIB, "system lib"}, {ERR_R_BN_LIB, "BN lib"}, @@ -164,7 +134,7 @@ static unsigned long err_string_data_hash(const ERR_STRING_DATA *a) unsigned long ret, l; l = a->error; - ret = l ^ ERR_GET_LIB(l) ^ ERR_GET_FUNC(l); + ret = l ^ ERR_GET_LIB(l); return (ret ^ ret % 19 * 13); } @@ -354,8 +324,6 @@ int ERR_load_ERR_strings(void) err_load_strings(ERR_str_libraries); err_load_strings(ERR_str_reasons); - err_patch(ERR_LIB_SYS, ERR_str_functs); - err_load_strings(ERR_str_functs); build_SYS_str_reasons(); #endif return 1; @@ -588,9 +556,9 @@ static unsigned long get_error_values(int inc, int top, const char **file, void ERR_error_string_n(unsigned long e, char *buf, size_t len) { - char lsbuf[64], fsbuf[64], rsbuf[64]; - const char *ls, *fs, *rs; - unsigned long l, f, r; + char lsbuf[64], rsbuf[64]; + const char *ls, *rs; + unsigned long f = 0, l, r; if (len == 0) return; @@ -602,13 +570,6 @@ void ERR_error_string_n(unsigned long e, char *buf, size_t len) ls = lsbuf; } - fs = ERR_func_error_string(e); - f = ERR_GET_FUNC(e); - if (fs == NULL) { - BIO_snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f); - fs = fsbuf; - } - rs = ERR_reason_error_string(e); r = ERR_GET_REASON(e); if (rs == NULL) { @@ -616,7 +577,7 @@ void ERR_error_string_n(unsigned long e, char *buf, size_t len) rs = rsbuf; } - BIO_snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, fs, rs); + BIO_snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, "", rs); if (strlen(buf) == len - 1) { /* Didn't fit; use a minimal format. */ BIO_snprintf(buf, len, "err:%lx:%lx:%lx:%lx", e, l, f, r); @@ -654,18 +615,9 @@ const char *ERR_lib_error_string(unsigned long e) const char *ERR_func_error_string(unsigned long e) { - ERR_STRING_DATA d, *p; - unsigned long l, f; - - if (!RUN_ONCE(&err_string_init, do_err_strings_init)) { + if (!RUN_ONCE(&err_string_init, do_err_strings_init)) return NULL; - } - - l = ERR_GET_LIB(e); - f = ERR_GET_FUNC(e); - d.error = ERR_PACK(l, f, 0); - p = int_err_get_item(&d); - return ((p == NULL) ? NULL : p->string); + return ERR_GET_LIB(e) == ERR_LIB_SYS ? "system library" : NULL; } const char *ERR_reason_error_string(unsigned long e) diff --git a/crypto/ui/ui_lib.c b/crypto/ui/ui_lib.c index 8c3502e..d039351 100644 --- a/crypto/ui/ui_lib.c +++ b/crypto/ui/ui_lib.c @@ -874,13 +874,6 @@ int UI_get_result_maxsize(UI_STRING *uis) int UI_set_result(UI *ui, UI_STRING *uis, const char *result) { -#if 0 - /* - * This is placed here solely to preserve UI_F_UI_SET_RESULT - * To be removed for OpenSSL 1.2.0 - */ - UIerr(UI_F_UI_SET_RESULT, ERR_R_DISABLED); -#endif return UI_set_result_ex(ui, uis, result, strlen(result)); } |