From aac96e2797c34a6b2a839eb58c30ab3328a0cee8 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Fri, 31 May 2019 13:52:45 -0400 Subject: [PATCH] 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 Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/9058) --- CHANGES | 4 + apps/rsa.c | 1 - apps/speed.c | 1 - crypto/crmf/crmf_lib.c | 11 ++- crypto/err/err.c | 62 ++------------ crypto/ui/ui_lib.c | 7 -- doc/man3/ERR_GET_LIB.pod | 3 +- include/openssl/err.h | 82 +++++++++--------- ssl/d1_lib.c | 2 +- ssl/statem/statem.h | 4 +- test/evp_test.c | 27 +++--- test/recipes/30-test_evp_data/evppkey.txt | 11 --- test/recipes/30-test_evp_data/evppkey_ecc.txt | 84 ------------------- test/sslapitest.c | 9 +- util/mkerr.pl | 56 ++++--------- 15 files changed, 91 insertions(+), 273 deletions(-) diff --git a/CHANGES b/CHANGES index c44dc0fdc7..d826308b75 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,10 @@ Changes between 1.1.1 and 3.0.0 [xx XXX xxxx] + *) Removed the function names from error messages and deprecated the + xxx_F_xxx define's. + [Rich Salz] + *) Removed NextStep support and the macro OPENSSL_UNISTD [Rich Salz] diff --git a/apps/rsa.c b/apps/rsa.c index 78958e053e..7c0620c6f2 100644 --- a/apps/rsa.c +++ b/apps/rsa.c @@ -227,7 +227,6 @@ int rsa_main(int argc, char **argv) while ((err = ERR_peek_error()) != 0 && ERR_GET_LIB(err) == ERR_LIB_RSA && - ERR_GET_FUNC(err) == RSA_F_RSA_CHECK_KEY_EX && ERR_GET_REASON(err) != ERR_R_MALLOC_FAILURE) { BIO_printf(out, "RSA key error: %s\n", ERR_reason_error_string(err)); diff --git a/apps/speed.c b/apps/speed.c index 88e0069742..d71b823f2a 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -3114,7 +3114,6 @@ int speed_main(int argc, char **argv) if (error == ERR_peek_last_error() && /* oldest and latest errors match */ /* check that the error origin matches */ ERR_GET_LIB(error) == ERR_LIB_EVP && - ERR_GET_FUNC(error) == EVP_F_INT_CTX_NEW && ERR_GET_REASON(error) == EVP_R_UNSUPPORTED_ALGORITHM) ERR_get_error(); /* pop error from queue */ if (ERR_peek_error()) { diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c index 55f1f38af8..e777a34e67 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 8752c11977..c161dc280c 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 8c3502e8cf..d0393511a0 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)); } diff --git a/doc/man3/ERR_GET_LIB.pod b/doc/man3/ERR_GET_LIB.pod index 6f14a09d82..2046159021 100644 --- a/doc/man3/ERR_GET_LIB.pod +++ b/doc/man3/ERR_GET_LIB.pod @@ -38,12 +38,13 @@ unique. However, when checking for sub-library specific reason codes, be sure to also compare the library number. ERR_GET_LIB(), ERR_GET_FUNC(), ERR_GET_REASON(), and ERR_FATAL_ERROR() - are macros. +are macros. =head1 RETURN VALUES The library number, function code, reason code, and whether the error is fatal, respectively. +Starting with OpenSSL 3.0.0, the function code is always set to zero. =head1 SEE ALSO diff --git a/include/openssl/err.h b/include/openssl/err.h index f601eaf2d5..2e92b38c4b 100644 --- a/include/openssl/err.h +++ b/include/openssl/err.h @@ -103,47 +103,47 @@ typedef struct err_state_st { # define ERR_LIB_USER 128 -# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CRMFerr(f,r) ERR_PUT_error(ERR_LIB_CRMF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CMPerr(f,r) ERR_PUT_error(ERR_LIB_CMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define ESSerr(f,r) ERR_PUT_error(ERR_LIB_ESS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PROPerr(f,r) ERR_PUT_error(ERR_LIB_PROP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) -# define PROVerr(f,r) ERR_PUT_error(ERR_LIB_PROV,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define CRMFerr(f,r) ERR_PUT_error(ERR_LIB_CRMF,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define CMPerr(f,r) ERR_PUT_error(ERR_LIB_CMP,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define ESSerr(f,r) ERR_PUT_error(ERR_LIB_ESS,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define PROPerr(f,r) ERR_PUT_error(ERR_LIB_PROP,0,(r),OPENSSL_FILE,OPENSSL_LINE) +# define PROVerr(f,r) ERR_PUT_error(ERR_LIB_PROV,0,(r),OPENSSL_FILE,OPENSSL_LINE) # define ERR_PACK(l,f,r) ( \ (((unsigned int)(l) & 0x0FF) << 24L) | \ diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c index d3f681ba41..01955d7b4f 100644 --- a/ssl/d1_lib.c +++ b/ssl/d1_lib.c @@ -378,7 +378,7 @@ int dtls1_check_timeout_num(SSL *s) if (s->d1->timeout.num_alerts > DTLS1_TMO_ALERT_COUNT) { /* fail the connection, enough alerts have been sent */ - SSLfatal(s, SSL_AD_NO_ALERT, SSL_F_DTLS1_CHECK_TIMEOUT_NUM, + SSLfatal(s, SSL_AD_NO_ALERT, 0, SSL_R_READ_TIMEOUT_EXPIRED); return -1; } diff --git a/ssl/statem/statem.h b/ssl/statem/statem.h index e26a5be0e2..a9309c967d 100644 --- a/ssl/statem/statem.h +++ b/ssl/statem/statem.h @@ -136,10 +136,10 @@ void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file, int line); # define SSL_AD_NO_ALERT -1 # ifndef OPENSSL_NO_ERR -# define SSLfatal(s, al, f, r) ossl_statem_fatal((s), (al), (f), (r), \ +# define SSLfatal(s, al, f, r) ossl_statem_fatal((s), (al), (0), (r), \ OPENSSL_FILE, OPENSSL_LINE) # else -# define SSLfatal(s, al, f, r) ossl_statem_fatal((s), (al), (f), (r), NULL, 0) +# define SSLfatal(s, al, f, r) ossl_statem_fatal((s), (al), (0), (r), NULL, 0) # endif int ossl_statem_in_error(const SSL *s); diff --git a/test/evp_test.c b/test/evp_test.c index f76929d539..7e282031a1 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -36,7 +36,6 @@ typedef struct evp_test_st { const EVP_TEST_METHOD *meth; /* method for this test */ const char *err, *aux_err; /* Error string for test */ char *expected_err; /* Expected error value of test */ - char *func; /* Expected error function string */ char *reason; /* Expected error reason string */ void *data; /* test specific data */ } EVP_TEST; @@ -2735,8 +2734,6 @@ static void clear_test(EVP_TEST *t) } OPENSSL_free(t->expected_err); t->expected_err = NULL; - OPENSSL_free(t->func); - t->func = NULL; OPENSSL_free(t->reason); t->reason = NULL; @@ -2779,10 +2776,10 @@ static int check_test_error(EVP_TEST *t) return 0; } - if (t->func == NULL && t->reason == NULL) + if (t->reason == NULL) return 1; - if (t->func == NULL || t->reason == NULL) { + if (t->reason == NULL) { TEST_info("%s:%d: Test is missing function or reason code", t->s.test_file, t->s.start); return 0; @@ -2790,25 +2787,25 @@ static int check_test_error(EVP_TEST *t) err = ERR_peek_error(); if (err == 0) { - TEST_info("%s:%d: Expected error \"%s:%s\" not set", - t->s.test_file, t->s.start, t->func, t->reason); + TEST_info("%s:%d: Expected error \"%s\" not set", + t->s.test_file, t->s.start, t->reason); return 0; } func = ERR_func_error_string(err); reason = ERR_reason_error_string(err); if (func == NULL && reason == NULL) { - TEST_info("%s:%d: Expected error \"%s:%s\", no strings available." + TEST_info("%s:%d: Expected error \"%s\", no strings available." " Assuming ok.", - t->s.test_file, t->s.start, t->func, t->reason); + t->s.test_file, t->s.start, t->reason); return 1; } - if (strcmp(func, t->func) == 0 && strcmp(reason, t->reason) == 0) + if (strcmp(reason, t->reason) == 0) return 1; - TEST_info("%s:%d: Expected error \"%s:%s\", got \"%s:%s\"", - t->s.test_file, t->s.start, t->func, t->reason, func, reason); + TEST_info("%s:%d: Expected error \"%s\", got \"%s\"", + t->s.test_file, t->s.start, t->reason, reason); return 0; } @@ -3039,11 +3036,7 @@ top: } t->expected_err = take_value(pp); } else if (strcmp(pp->key, "Function") == 0) { - if (t->func != NULL) { - TEST_info("Line %d: multiple function lines\n", t->s.curr); - return 0; - } - t->func = take_value(pp); + /* Ignore old line. */ } else if (strcmp(pp->key, "Reason") == 0) { if (t->reason != NULL) { TEST_info("Line %d: multiple reason lines", t->s.curr); diff --git a/test/recipes/30-test_evp_data/evppkey.txt b/test/recipes/30-test_evp_data/evppkey.txt index 00259b58b4..d395f15664 100644 --- a/test/recipes/30-test_evp_data/evppkey.txt +++ b/test/recipes/30-test_evp_data/evppkey.txt @@ -374,13 +374,11 @@ Result = KEYOP_ERROR # Illegal RSA key derivation Derive = RSA-2048 Result = KEYOP_INIT_ERROR -Function = EVP_PKEY_derive_init Reason = operation not supported for this keytype Sign = RSA-2048 Ctrl = rsa_mgf1_md:sha1 Result = PKEY_CTRL_INVALID -Function = pkey_rsa_ctrl Reason = invalid mgf1 md # RSA PSS key tests @@ -571,19 +569,16 @@ Result = PKEY_CTRL_ERROR # Illegal decrypt Decrypt = RSA-PSS Result = KEYOP_INIT_ERROR -Function = EVP_PKEY_decrypt_init Reason = operation not supported for this keytype # Invalid key: rejected when we try to init Verify = RSA-PSS-BAD Result = KEYOP_INIT_ERROR -Function = rsa_pss_get_param Reason = invalid salt length # Invalid key: rejected when we try to init Verify = RSA-PSS-BAD2 Result = KEYOP_INIT_ERROR -Function = pkey_pss_init Reason = invalid salt length @@ -762,12 +757,10 @@ SharedSecret=4A5D9D5BA4CE2DE1728E3BF480350F25E07E21C947D19E3376F09B3C1E161742 Sign=Alice-25519 Result = KEYOP_INIT_ERROR -Function = EVP_PKEY_sign_init Reason = operation not supported for this keytype Verify=Alice-25519 Result = KEYOP_INIT_ERROR -Function = EVP_PKEY_verify_init Reason = operation not supported for this keytype Title = X448 test vectors (from RFC7748 6.2) @@ -834,12 +827,10 @@ SharedSecret=07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b56fd2 Sign=Alice-448 Result = KEYOP_INIT_ERROR -Function = EVP_PKEY_sign_init Reason = operation not supported for this keytype Verify=Alice-448 Result = KEYOP_INIT_ERROR -Function = EVP_PKEY_verify_init Reason = operation not supported for this keytype @@ -17286,7 +17277,6 @@ Derive=ALICE_cf_sect283k1 PeerKey=BOB_cf_sect283k1_PUB Ctrl=ecdh_cofactor_mode:1 Result = DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title = Test keypair mismatches @@ -17830,7 +17820,6 @@ KeyGen = rsaEncryption Ctrl = rsa_keygen_bits:128 KeyName = tmprsa Result = PKEY_CTRL_INVALID -Function = pkey_rsa_ctrl Reason = key size too small # RSA-PSS with restrictions, should succeed. diff --git a/test/recipes/30-test_evp_data/evppkey_ecc.txt b/test/recipes/30-test_evp_data/evppkey_ecc.txt index 8e618c83f9..b255f772bc 100644 --- a/test/recipes/30-test_evp_data/evppkey_ecc.txt +++ b/test/recipes/30-test_evp_data/evppkey_ecc.txt @@ -623,7 +623,6 @@ Derive=BOB_cf_c2pnb163v1 PeerKey=MALICE_cf_c2pnb163v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -631,7 +630,6 @@ Derive=ALICE_cf_c2pnb163v1 PeerKey=MALICE_cf_c2pnb163v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2pnb163v2 curve tests @@ -695,7 +693,6 @@ Derive=BOB_cf_c2pnb163v2 PeerKey=MALICE_cf_c2pnb163v2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -703,7 +700,6 @@ Derive=ALICE_cf_c2pnb163v2 PeerKey=MALICE_cf_c2pnb163v2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2pnb163v3 curve tests @@ -767,7 +763,6 @@ Derive=BOB_cf_c2pnb163v3 PeerKey=MALICE_cf_c2pnb163v3_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -775,7 +770,6 @@ Derive=ALICE_cf_c2pnb163v3 PeerKey=MALICE_cf_c2pnb163v3_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2pnb176v1 curve tests @@ -839,7 +833,6 @@ Derive=BOB_cf_c2pnb176v1 PeerKey=MALICE_cf_c2pnb176v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -847,7 +840,6 @@ Derive=ALICE_cf_c2pnb176v1 PeerKey=MALICE_cf_c2pnb176v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2pnb208w1 curve tests @@ -913,7 +905,6 @@ Derive=BOB_cf_c2pnb208w1 PeerKey=MALICE_cf_c2pnb208w1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -921,7 +912,6 @@ Derive=ALICE_cf_c2pnb208w1 PeerKey=MALICE_cf_c2pnb208w1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2pnb272w1 curve tests @@ -987,7 +977,6 @@ Derive=BOB_cf_c2pnb272w1 PeerKey=MALICE_cf_c2pnb272w1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -995,7 +984,6 @@ Derive=ALICE_cf_c2pnb272w1 PeerKey=MALICE_cf_c2pnb272w1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2pnb304w1 curve tests @@ -1061,7 +1049,6 @@ Derive=BOB_cf_c2pnb304w1 PeerKey=MALICE_cf_c2pnb304w1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1069,7 +1056,6 @@ Derive=ALICE_cf_c2pnb304w1 PeerKey=MALICE_cf_c2pnb304w1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2pnb368w1 curve tests @@ -1138,7 +1124,6 @@ Derive=BOB_cf_c2pnb368w1 PeerKey=MALICE_cf_c2pnb368w1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1146,7 +1131,6 @@ Derive=ALICE_cf_c2pnb368w1 PeerKey=MALICE_cf_c2pnb368w1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2tnb191v1 curve tests @@ -1212,7 +1196,6 @@ Derive=BOB_cf_c2tnb191v1 PeerKey=MALICE_cf_c2tnb191v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1220,7 +1203,6 @@ Derive=ALICE_cf_c2tnb191v1 PeerKey=MALICE_cf_c2tnb191v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2tnb191v2 curve tests @@ -1286,7 +1268,6 @@ Derive=BOB_cf_c2tnb191v2 PeerKey=MALICE_cf_c2tnb191v2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1294,7 +1275,6 @@ Derive=ALICE_cf_c2tnb191v2 PeerKey=MALICE_cf_c2tnb191v2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2tnb191v3 curve tests @@ -1360,7 +1340,6 @@ Derive=BOB_cf_c2tnb191v3 PeerKey=MALICE_cf_c2tnb191v3_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1368,7 +1347,6 @@ Derive=ALICE_cf_c2tnb191v3 PeerKey=MALICE_cf_c2tnb191v3_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2tnb239v1 curve tests @@ -1434,7 +1412,6 @@ Derive=BOB_cf_c2tnb239v1 PeerKey=MALICE_cf_c2tnb239v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1442,7 +1419,6 @@ Derive=ALICE_cf_c2tnb239v1 PeerKey=MALICE_cf_c2tnb239v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2tnb239v2 curve tests @@ -1508,7 +1484,6 @@ Derive=BOB_cf_c2tnb239v2 PeerKey=MALICE_cf_c2tnb239v2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1516,7 +1491,6 @@ Derive=ALICE_cf_c2tnb239v2 PeerKey=MALICE_cf_c2tnb239v2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2tnb239v3 curve tests @@ -1582,7 +1556,6 @@ Derive=BOB_cf_c2tnb239v3 PeerKey=MALICE_cf_c2tnb239v3_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1590,7 +1563,6 @@ Derive=ALICE_cf_c2tnb239v3 PeerKey=MALICE_cf_c2tnb239v3_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2tnb359v1 curve tests @@ -1659,7 +1631,6 @@ Derive=BOB_cf_c2tnb359v1 PeerKey=MALICE_cf_c2tnb359v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1667,7 +1638,6 @@ Derive=ALICE_cf_c2tnb359v1 PeerKey=MALICE_cf_c2tnb359v1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=c2tnb431r1 curve tests @@ -1736,7 +1706,6 @@ Derive=BOB_cf_c2tnb431r1 PeerKey=MALICE_cf_c2tnb431r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -1744,7 +1713,6 @@ Derive=ALICE_cf_c2tnb431r1 PeerKey=MALICE_cf_c2tnb431r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=prime192v1 curve tests @@ -2121,7 +2089,6 @@ Derive=BOB_cf_secp112r2 PeerKey=MALICE_cf_secp112r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -2129,7 +2096,6 @@ Derive=ALICE_cf_secp112r2 PeerKey=MALICE_cf_secp112r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=secp128r1 curve tests @@ -2226,7 +2192,6 @@ Derive=BOB_cf_secp128r2 PeerKey=MALICE_cf_secp128r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -2234,7 +2199,6 @@ Derive=ALICE_cf_secp128r2 PeerKey=MALICE_cf_secp128r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=secp160k1 curve tests @@ -2651,7 +2615,6 @@ Derive=BOB_cf_sect113r1 PeerKey=MALICE_cf_sect113r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -2659,7 +2622,6 @@ Derive=ALICE_cf_sect113r1 PeerKey=MALICE_cf_sect113r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect113r2 curve tests @@ -2720,7 +2682,6 @@ Derive=BOB_cf_sect113r2 PeerKey=MALICE_cf_sect113r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -2728,7 +2689,6 @@ Derive=ALICE_cf_sect113r2 PeerKey=MALICE_cf_sect113r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect131r1 curve tests @@ -2792,7 +2752,6 @@ Derive=BOB_cf_sect131r1 PeerKey=MALICE_cf_sect131r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -2800,7 +2759,6 @@ Derive=ALICE_cf_sect131r1 PeerKey=MALICE_cf_sect131r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect131r2 curve tests @@ -2864,7 +2822,6 @@ Derive=BOB_cf_sect131r2 PeerKey=MALICE_cf_sect131r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -2872,7 +2829,6 @@ Derive=ALICE_cf_sect131r2 PeerKey=MALICE_cf_sect131r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect163k1 curve tests @@ -2936,7 +2892,6 @@ Derive=BOB_cf_sect163k1 PeerKey=MALICE_cf_sect163k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -2944,7 +2899,6 @@ Derive=ALICE_cf_sect163k1 PeerKey=MALICE_cf_sect163k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect163r1 curve tests @@ -3008,7 +2962,6 @@ Derive=BOB_cf_sect163r1 PeerKey=MALICE_cf_sect163r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3016,7 +2969,6 @@ Derive=ALICE_cf_sect163r1 PeerKey=MALICE_cf_sect163r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect163r2 curve tests @@ -3080,7 +3032,6 @@ Derive=BOB_cf_sect163r2 PeerKey=MALICE_cf_sect163r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3088,7 +3039,6 @@ Derive=ALICE_cf_sect163r2 PeerKey=MALICE_cf_sect163r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect193r1 curve tests @@ -3152,7 +3102,6 @@ Derive=BOB_cf_sect193r1 PeerKey=MALICE_cf_sect193r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3160,7 +3109,6 @@ Derive=ALICE_cf_sect193r1 PeerKey=MALICE_cf_sect193r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect193r2 curve tests @@ -3224,7 +3172,6 @@ Derive=BOB_cf_sect193r2 PeerKey=MALICE_cf_sect193r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3232,7 +3179,6 @@ Derive=ALICE_cf_sect193r2 PeerKey=MALICE_cf_sect193r2_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect233k1 curve tests @@ -3298,7 +3244,6 @@ Derive=BOB_cf_sect233k1 PeerKey=MALICE_cf_sect233k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3306,7 +3251,6 @@ Derive=ALICE_cf_sect233k1 PeerKey=MALICE_cf_sect233k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect233r1 curve tests @@ -3372,7 +3316,6 @@ Derive=BOB_cf_sect233r1 PeerKey=MALICE_cf_sect233r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3380,7 +3323,6 @@ Derive=ALICE_cf_sect233r1 PeerKey=MALICE_cf_sect233r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect239k1 curve tests @@ -3446,7 +3388,6 @@ Derive=BOB_cf_sect239k1 PeerKey=MALICE_cf_sect239k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3454,7 +3395,6 @@ Derive=ALICE_cf_sect239k1 PeerKey=MALICE_cf_sect239k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect283k1 curve tests @@ -3520,7 +3460,6 @@ Derive=BOB_cf_sect283k1 PeerKey=MALICE_cf_sect283k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3528,7 +3467,6 @@ Derive=ALICE_cf_sect283k1 PeerKey=MALICE_cf_sect283k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect283r1 curve tests @@ -3594,7 +3532,6 @@ Derive=BOB_cf_sect283r1 PeerKey=MALICE_cf_sect283r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3602,7 +3539,6 @@ Derive=ALICE_cf_sect283r1 PeerKey=MALICE_cf_sect283r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect409k1 curve tests @@ -3671,7 +3607,6 @@ Derive=BOB_cf_sect409k1 PeerKey=MALICE_cf_sect409k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3679,7 +3614,6 @@ Derive=ALICE_cf_sect409k1 PeerKey=MALICE_cf_sect409k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect409r1 curve tests @@ -3748,7 +3682,6 @@ Derive=BOB_cf_sect409r1 PeerKey=MALICE_cf_sect409r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3756,7 +3689,6 @@ Derive=ALICE_cf_sect409r1 PeerKey=MALICE_cf_sect409r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect571k1 curve tests @@ -3825,7 +3757,6 @@ Derive=BOB_cf_sect571k1 PeerKey=MALICE_cf_sect571k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3833,7 +3764,6 @@ Derive=ALICE_cf_sect571k1 PeerKey=MALICE_cf_sect571k1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=sect571r1 curve tests @@ -3902,7 +3832,6 @@ Derive=BOB_cf_sect571r1 PeerKey=MALICE_cf_sect571r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3910,7 +3839,6 @@ Derive=ALICE_cf_sect571r1 PeerKey=MALICE_cf_sect571r1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=wap-wsg-idm-ecid-wtls10 curve tests @@ -3976,7 +3904,6 @@ Derive=BOB_cf_wap-wsg-idm-ecid-wtls10 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls10_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -3984,7 +3911,6 @@ Derive=ALICE_cf_wap-wsg-idm-ecid-wtls10 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls10_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=wap-wsg-idm-ecid-wtls11 curve tests @@ -4050,7 +3976,6 @@ Derive=BOB_cf_wap-wsg-idm-ecid-wtls11 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls11_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -4058,7 +3983,6 @@ Derive=ALICE_cf_wap-wsg-idm-ecid-wtls11 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls11_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=wap-wsg-idm-ecid-wtls12 curve tests @@ -4159,7 +4083,6 @@ Derive=BOB_cf_wap-wsg-idm-ecid-wtls1 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -4167,7 +4090,6 @@ Derive=ALICE_cf_wap-wsg-idm-ecid-wtls1 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls1_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=wap-wsg-idm-ecid-wtls3 curve tests @@ -4231,7 +4153,6 @@ Derive=BOB_cf_wap-wsg-idm-ecid-wtls3 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls3_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -4239,7 +4160,6 @@ Derive=ALICE_cf_wap-wsg-idm-ecid-wtls3 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls3_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=wap-wsg-idm-ecid-wtls4 curve tests @@ -4300,7 +4220,6 @@ Derive=BOB_cf_wap-wsg-idm-ecid-wtls4 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls4_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -4308,7 +4227,6 @@ Derive=ALICE_cf_wap-wsg-idm-ecid-wtls4 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls4_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=wap-wsg-idm-ecid-wtls5 curve tests @@ -4372,7 +4290,6 @@ Derive=BOB_cf_wap-wsg-idm-ecid-wtls5 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls5_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity # ECC CDH Alice with Malice peer @@ -4380,7 +4297,6 @@ Derive=ALICE_cf_wap-wsg-idm-ecid-wtls5 PeerKey=MALICE_cf_wap-wsg-idm-ecid-wtls5_PUB Ctrl=ecdh_cofactor_mode:1 Result=DERIVE_ERROR -Function=EC_POINT_get_affine_coordinates Reason=point at infinity Title=wap-wsg-idm-ecid-wtls6 curve tests diff --git a/test/sslapitest.c b/test/sslapitest.c index bc1f006a95..aa9452460e 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -3764,7 +3764,6 @@ static int test_tls13_key_exchange(int idx) int kexch_groups_size = 0; int max_version = TLS1_3_VERSION; int want_err = SSL_ERROR_NONE; - int expected_err_func = 0; int expected_err_reason = 0; switch (idx) { @@ -3824,16 +3823,16 @@ static int test_tls13_key_exchange(int idx) if (!TEST_true(create_ssl_connection(serverssl, clientssl, want_err))) { /* Fail only if no error is expected in handshake */ - if (expected_err_func == 0) + if (expected_err_reason == 0) goto end; } /* Fail if expected error is not happening for failure testcases */ - if (expected_err_func) { + if (expected_err_reason != 0) { unsigned long err_code = ERR_get_error(); + ERR_print_errors_fp(stdout); - if (TEST_int_eq(ERR_GET_FUNC(err_code), expected_err_func) - && TEST_int_eq(ERR_GET_REASON(err_code), expected_err_reason)) + if (TEST_int_eq(ERR_GET_REASON(err_code), expected_err_reason)) testresult = 1; goto end; } diff --git a/util/mkerr.pl b/util/mkerr.pl index 08593d026d..aae49ac237 100755 --- a/util/mkerr.pl +++ b/util/mkerr.pl @@ -122,20 +122,22 @@ if ( $internal ) { } # Data parsed out of the config and state files. +# We always map function-code values to zero, so items marked below with +# an asterisk could eventually be removed. TODO(4.0) my %hinc; # lib -> header my %libinc; # header -> lib my %cskip; # error_file -> lib my %errorfile; # lib -> error file name -my %fmax; # lib -> max assigned function code +my %fmax; # lib -> max assigned function code* my %rmax; # lib -> max assigned reason code -my %fassigned; # lib -> colon-separated list of assigned function codes +my %fassigned; # lib -> colon-separated list of assigned function codes* my %rassigned; # lib -> colon-separated list of assigned reason codes -my %fnew; # lib -> count of new function codes +my %fnew; # lib -> count of new function codes* my %rnew; # lib -> count of new reason codes my %rextra; # "extra" reason code -> lib my %rcodes; # reason-name -> value -my %ftrans; # old name -> #define-friendly name (all caps) -my %fcodes; # function-name -> value +my %ftrans; # old name -> #define-friendly name (all caps)* +my %fcodes; # function-name -> value* my $statefile; # state file with assigned reason and function codes my %strings; # define -> text @@ -454,9 +456,9 @@ foreach my $lib ( keys %errorfile ) { #ifndef HEADER_${lib}ERR_H # define HEADER_${lib}ERR_H -# ifndef HEADER_SYMHACKS_H -# include -# endif +# include +# include + EOF if ( $internal ) { @@ -480,7 +482,7 @@ int ERR_load_${lib}_strings(void); EOF } else { print OUT <<"EOF"; -# define ${lib}err(f, r) ERR_${lib}_error((f), (r), OPENSSL_FILE, OPENSSL_LINE) +# define ${lib}err(f, r) ERR_${lib}_error(0, (r), OPENSSL_FILE, OPENSSL_LINE) EOF if ( ! $static ) { @@ -500,6 +502,7 @@ EOF } print OUT "\n/*\n * $lib function codes.\n */\n"; + print OUT "# if !OPENSSL_API_3\n"; foreach my $i ( @function ) { my $z = 48 - length($i); $z = 0 if $z < 0; @@ -514,8 +517,9 @@ EOF $fassigned{$lib} .= "$findcode:"; print STDERR "New Function code $i\n" if $debug; } - printf OUT "#${indent}define $i%s $fcodes{$i}\n", " " x $z; + printf OUT "#${indent} define $i%s 0\n", " " x $z; } + print OUT "# endif\n"; print OUT "\n/*\n * $lib reason codes.\n */\n"; foreach my $i ( @reasons ) { @@ -575,32 +579,6 @@ EOF #ifndef OPENSSL_NO_ERR -static ${const}ERR_STRING_DATA ${lib}_str_functs[] = { -EOF - - # Add each function code: if a function name is found then use it. - foreach my $i ( @function ) { - my $fn; - if ( exists $strings{$i} and $strings{$i} ne '' ) { - $fn = $strings{$i}; - $fn = "" if $fn eq '*'; - } else { - $i =~ /^${lib}_F_(\S+)$/; - $fn = $1; - $fn = $ftrans{$fn} if exists $ftrans{$fn}; - $strings{$i} = $fn; - } - my $short = " {ERR_PACK($pack_lib, $i, 0), \"$fn\"},"; - if ( length($short) <= 80 ) { - print OUT "$short\n"; - } else { - print OUT " {ERR_PACK($pack_lib, $i, 0),\n \"$fn\"},\n"; - } - } - print OUT <<"EOF"; - {0, NULL} -}; - static ${const}ERR_STRING_DATA ${lib}_str_reasons[] = { EOF @@ -635,10 +613,8 @@ EOF int ERR_load_${lib}_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(${lib}_str_functs[0].error) == NULL) { - ERR_load_strings_const(${lib}_str_functs); + if (ERR_func_error_string(${lib}_str_reasons[0].error) == NULL) ERR_load_strings_const(${lib}_str_reasons); - } #endif return 1; } @@ -657,7 +633,6 @@ ${st}int ERR_load_${lib}_strings(void) if (!error_loaded) { #ifndef OPENSSL_NO_ERR - ERR_load_strings(lib_code, ${lib}_str_functs); ERR_load_strings(lib_code, ${lib}_str_reasons); #endif error_loaded = 1; @@ -669,7 +644,6 @@ ${st}void ERR_unload_${lib}_strings(void) { if (error_loaded) { #ifndef OPENSSL_NO_ERR - ERR_unload_strings(lib_code, ${lib}_str_functs); ERR_unload_strings(lib_code, ${lib}_str_reasons); #endif error_loaded = 0; -- 2.25.1