From: Richard Levitte Date: Wed, 4 Sep 2019 19:45:56 +0000 (+0200) Subject: util/mkerr.pl: make it not depend on the function code X-Git-Tag: openssl-3.0.0-alpha1~1374 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=0cd1b144f99e9aabea15a158bd567cba81592039 util/mkerr.pl: make it not depend on the function code The output C code was made to use ERR_func_error_string() to see if a string table was already loaded or not. Since this function returns NULL always, this check became useless. Change it to use ERR_reason_error_string() instead, as there's no reason to believe we will get rid of reason strings, ever. To top it off, we rebuild all affected C sources. Fixes #9756 Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/9756) --- diff --git a/crypto/asn1/asn1_err.c b/crypto/asn1/asn1_err.c index 9d398f7d07..96878e2a46 100644 --- a/crypto/asn1/asn1_err.c +++ b/crypto/asn1/asn1_err.c @@ -201,7 +201,7 @@ static const ERR_STRING_DATA ASN1_str_reasons[] = { int ERR_load_ASN1_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(ASN1_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(ASN1_str_reasons[0].error) == NULL) ERR_load_strings_const(ASN1_str_reasons); #endif return 1; diff --git a/crypto/async/async_err.c b/crypto/async/async_err.c index f3643e107c..7a06f75265 100644 --- a/crypto/async/async_err.c +++ b/crypto/async/async_err.c @@ -29,7 +29,7 @@ static const ERR_STRING_DATA ASYNC_str_reasons[] = { int ERR_load_ASYNC_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(ASYNC_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(ASYNC_str_reasons[0].error) == NULL) ERR_load_strings_const(ASYNC_str_reasons); #endif return 1; diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c index 69f8d64705..178fdd6a79 100644 --- a/crypto/bio/bio_err.c +++ b/crypto/bio/bio_err.c @@ -76,7 +76,7 @@ static const ERR_STRING_DATA BIO_str_reasons[] = { int ERR_load_BIO_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(BIO_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(BIO_str_reasons[0].error) == NULL) ERR_load_strings_const(BIO_str_reasons); #endif return 1; diff --git a/crypto/bn/bn_err.c b/crypto/bn/bn_err.c index e1f260dcf8..ce0ea3865d 100644 --- a/crypto/bn/bn_err.c +++ b/crypto/bn/bn_err.c @@ -47,7 +47,7 @@ static const ERR_STRING_DATA BN_str_reasons[] = { int ERR_load_BN_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(BN_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(BN_str_reasons[0].error) == NULL) ERR_load_strings_const(BN_str_reasons); #endif return 1; diff --git a/crypto/buffer/buf_err.c b/crypto/buffer/buf_err.c index 066ce567ee..702707bb88 100644 --- a/crypto/buffer/buf_err.c +++ b/crypto/buffer/buf_err.c @@ -22,7 +22,7 @@ static const ERR_STRING_DATA BUF_str_reasons[] = { int ERR_load_BUF_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(BUF_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(BUF_str_reasons[0].error) == NULL) ERR_load_strings_const(BUF_str_reasons); #endif return 1; diff --git a/crypto/cmp/cmp_err.c b/crypto/cmp/cmp_err.c index 77e0aa1b35..4e3a5c347e 100644 --- a/crypto/cmp/cmp_err.c +++ b/crypto/cmp/cmp_err.c @@ -22,7 +22,7 @@ static const ERR_STRING_DATA CMP_str_reasons[] = { int ERR_load_CMP_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(CMP_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(CMP_str_reasons[0].error) == NULL) ERR_load_strings_const(CMP_str_reasons); #endif return 1; diff --git a/crypto/cms/cms_err.c b/crypto/cms/cms_err.c index a5d5a47409..98500d7cba 100644 --- a/crypto/cms/cms_err.c +++ b/crypto/cms/cms_err.c @@ -146,7 +146,7 @@ static const ERR_STRING_DATA CMS_str_reasons[] = { int ERR_load_CMS_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(CMS_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(CMS_str_reasons[0].error) == NULL) ERR_load_strings_const(CMS_str_reasons); #endif return 1; diff --git a/crypto/comp/comp_err.c b/crypto/comp/comp_err.c index f29d0bcc44..d4ae0406a3 100644 --- a/crypto/comp/comp_err.c +++ b/crypto/comp/comp_err.c @@ -28,7 +28,7 @@ static const ERR_STRING_DATA COMP_str_reasons[] = { int ERR_load_COMP_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(COMP_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(COMP_str_reasons[0].error) == NULL) ERR_load_strings_const(COMP_str_reasons); #endif return 1; diff --git a/crypto/conf/conf_err.c b/crypto/conf/conf_err.c index f337700929..96d2cd99f5 100644 --- a/crypto/conf/conf_err.c +++ b/crypto/conf/conf_err.c @@ -58,7 +58,7 @@ static const ERR_STRING_DATA CONF_str_reasons[] = { int ERR_load_CONF_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(CONF_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(CONF_str_reasons[0].error) == NULL) ERR_load_strings_const(CONF_str_reasons); #endif return 1; diff --git a/crypto/cpt_err.c b/crypto/cpt_err.c index 012f181d2a..0028b329a3 100644 --- a/crypto/cpt_err.c +++ b/crypto/cpt_err.c @@ -52,7 +52,7 @@ static const ERR_STRING_DATA CRYPTO_str_reasons[] = { int ERR_load_CRYPTO_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(CRYPTO_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(CRYPTO_str_reasons[0].error) == NULL) ERR_load_strings_const(CRYPTO_str_reasons); #endif return 1; diff --git a/crypto/crmf/crmf_err.c b/crypto/crmf/crmf_err.c index 68d0d73d1e..87e6a2da60 100644 --- a/crypto/crmf/crmf_err.c +++ b/crypto/crmf/crmf_err.c @@ -54,7 +54,7 @@ static const ERR_STRING_DATA CRMF_str_reasons[] = { int ERR_load_CRMF_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(CRMF_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(CRMF_str_reasons[0].error) == NULL) ERR_load_strings_const(CRMF_str_reasons); #endif return 1; diff --git a/crypto/ct/ct_err.c b/crypto/ct/ct_err.c index a960428ca5..f9b9b57b22 100644 --- a/crypto/ct/ct_err.c +++ b/crypto/ct/ct_err.c @@ -48,7 +48,7 @@ static const ERR_STRING_DATA CT_str_reasons[] = { int ERR_load_CT_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(CT_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(CT_str_reasons[0].error) == NULL) ERR_load_strings_const(CT_str_reasons); #endif return 1; diff --git a/crypto/dh/dh_err.c b/crypto/dh/dh_err.c index 69f1452441..e5eb32381d 100644 --- a/crypto/dh/dh_err.c +++ b/crypto/dh/dh_err.c @@ -60,7 +60,7 @@ static const ERR_STRING_DATA DH_str_reasons[] = { int ERR_load_DH_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(DH_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(DH_str_reasons[0].error) == NULL) ERR_load_strings_const(DH_str_reasons); #endif return 1; diff --git a/crypto/dsa/dsa_err.c b/crypto/dsa/dsa_err.c index 5b0b71507f..f4d187e4b9 100644 --- a/crypto/dsa/dsa_err.c +++ b/crypto/dsa/dsa_err.c @@ -39,7 +39,7 @@ static const ERR_STRING_DATA DSA_str_reasons[] = { int ERR_load_DSA_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(DSA_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(DSA_str_reasons[0].error) == NULL) ERR_load_strings_const(DSA_str_reasons); #endif return 1; diff --git a/crypto/dso/dso_err.c b/crypto/dso/dso_err.c index 4afb106a8f..8a4d9a812a 100644 --- a/crypto/dso/dso_err.c +++ b/crypto/dso/dso_err.c @@ -49,7 +49,7 @@ static const ERR_STRING_DATA DSO_str_reasons[] = { int ERR_load_DSO_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(DSO_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(DSO_str_reasons[0].error) == NULL) ERR_load_strings_const(DSO_str_reasons); #endif return 1; diff --git a/crypto/ec/ec_err.c b/crypto/ec/ec_err.c index 566b40f13d..66d9c4b16e 100644 --- a/crypto/ec/ec_err.c +++ b/crypto/ec/ec_err.c @@ -112,7 +112,7 @@ static const ERR_STRING_DATA EC_str_reasons[] = { int ERR_load_EC_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(EC_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(EC_str_reasons[0].error) == NULL) ERR_load_strings_const(EC_str_reasons); #endif return 1; diff --git a/crypto/engine/eng_err.c b/crypto/engine/eng_err.c index 75097753a1..c602e0ffe7 100644 --- a/crypto/engine/eng_err.c +++ b/crypto/engine/eng_err.c @@ -81,7 +81,7 @@ static const ERR_STRING_DATA ENGINE_str_reasons[] = { int ERR_load_ENGINE_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(ENGINE_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(ENGINE_str_reasons[0].error) == NULL) ERR_load_strings_const(ENGINE_str_reasons); #endif return 1; diff --git a/crypto/ess/ess_err.c b/crypto/ess/ess_err.c index 0b582277ad..b494aa246f 100644 --- a/crypto/ess/ess_err.c +++ b/crypto/ess/ess_err.c @@ -28,7 +28,7 @@ static const ERR_STRING_DATA ESS_str_reasons[] = { int ERR_load_ESS_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(ESS_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(ESS_str_reasons[0].error) == NULL) ERR_load_strings_const(ESS_str_reasons); #endif return 1; diff --git a/crypto/evp/evp_err.c b/crypto/evp/evp_err.c index 63174f98f6..b74b87e4f5 100644 --- a/crypto/evp/evp_err.c +++ b/crypto/evp/evp_err.c @@ -161,7 +161,7 @@ static const ERR_STRING_DATA EVP_str_reasons[] = { int ERR_load_EVP_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(EVP_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(EVP_str_reasons[0].error) == NULL) ERR_load_strings_const(EVP_str_reasons); #endif return 1; diff --git a/crypto/objects/obj_err.c b/crypto/objects/obj_err.c index f8b48fe0de..b32e9f6f55 100644 --- a/crypto/objects/obj_err.c +++ b/crypto/objects/obj_err.c @@ -24,7 +24,7 @@ static const ERR_STRING_DATA OBJ_str_reasons[] = { int ERR_load_OBJ_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(OBJ_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(OBJ_str_reasons[0].error) == NULL) ERR_load_strings_const(OBJ_str_reasons); #endif return 1; diff --git a/crypto/ocsp/ocsp_err.c b/crypto/ocsp/ocsp_err.c index fd479bcd9f..6e2152b3b2 100644 --- a/crypto/ocsp/ocsp_err.c +++ b/crypto/ocsp/ocsp_err.c @@ -65,7 +65,7 @@ static const ERR_STRING_DATA OCSP_str_reasons[] = { int ERR_load_OCSP_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(OCSP_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(OCSP_str_reasons[0].error) == NULL) ERR_load_strings_const(OCSP_str_reasons); #endif return 1; diff --git a/crypto/pem/pem_err.c b/crypto/pem/pem_err.c index a4743d10bd..014aade185 100644 --- a/crypto/pem/pem_err.c +++ b/crypto/pem/pem_err.c @@ -60,7 +60,7 @@ static const ERR_STRING_DATA PEM_str_reasons[] = { int ERR_load_PEM_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(PEM_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(PEM_str_reasons[0].error) == NULL) ERR_load_strings_const(PEM_str_reasons); #endif return 1; diff --git a/crypto/pkcs12/pk12err.c b/crypto/pkcs12/pk12err.c index c9fd1d7fe9..c3ad2bf708 100644 --- a/crypto/pkcs12/pk12err.c +++ b/crypto/pkcs12/pk12err.c @@ -56,7 +56,7 @@ static const ERR_STRING_DATA PKCS12_str_reasons[] = { int ERR_load_PKCS12_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(PKCS12_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(PKCS12_str_reasons[0].error) == NULL) ERR_load_strings_const(PKCS12_str_reasons); #endif return 1; diff --git a/crypto/pkcs7/pkcs7err.c b/crypto/pkcs7/pkcs7err.c index 24201247d4..f7b87d552a 100644 --- a/crypto/pkcs7/pkcs7err.c +++ b/crypto/pkcs7/pkcs7err.c @@ -90,7 +90,7 @@ static const ERR_STRING_DATA PKCS7_str_reasons[] = { int ERR_load_PKCS7_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(PKCS7_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(PKCS7_str_reasons[0].error) == NULL) ERR_load_strings_const(PKCS7_str_reasons); #endif return 1; diff --git a/crypto/property/property_err.c b/crypto/property/property_err.c index 49dc525273..477dedfd00 100644 --- a/crypto/property/property_err.c +++ b/crypto/property/property_err.c @@ -39,7 +39,7 @@ static const ERR_STRING_DATA PROP_str_reasons[] = { int ERR_load_PROP_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(PROP_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(PROP_str_reasons[0].error) == NULL) ERR_load_strings_const(PROP_str_reasons); #endif return 1; diff --git a/crypto/rand/rand_err.c b/crypto/rand/rand_err.c index fa6be1ea80..53d329380a 100644 --- a/crypto/rand/rand_err.c +++ b/crypto/rand/rand_err.c @@ -89,7 +89,7 @@ static const ERR_STRING_DATA RAND_str_reasons[] = { int ERR_load_RAND_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(RAND_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(RAND_str_reasons[0].error) == NULL) ERR_load_strings_const(RAND_str_reasons); #endif return 1; diff --git a/crypto/rsa/rsa_err.c b/crypto/rsa/rsa_err.c index 5923073056..692b1a1bd3 100644 --- a/crypto/rsa/rsa_err.c +++ b/crypto/rsa/rsa_err.c @@ -155,7 +155,7 @@ static const ERR_STRING_DATA RSA_str_reasons[] = { int ERR_load_RSA_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(RSA_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(RSA_str_reasons[0].error) == NULL) ERR_load_strings_const(RSA_str_reasons); #endif return 1; diff --git a/crypto/sm2/sm2_err.c b/crypto/sm2/sm2_err.c index 24ecdf5380..d8e1179056 100644 --- a/crypto/sm2/sm2_err.c +++ b/crypto/sm2/sm2_err.c @@ -36,7 +36,7 @@ static const ERR_STRING_DATA SM2_str_reasons[] = { int ERR_load_SM2_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(SM2_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(SM2_str_reasons[0].error) == NULL) ERR_load_strings_const(SM2_str_reasons); #endif return 1; diff --git a/crypto/store/store_err.c b/crypto/store/store_err.c index 417aa49ba6..aa8ab4f9b0 100644 --- a/crypto/store/store_err.c +++ b/crypto/store/store_err.c @@ -62,7 +62,7 @@ static const ERR_STRING_DATA OSSL_STORE_str_reasons[] = { int ERR_load_OSSL_STORE_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(OSSL_STORE_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(OSSL_STORE_str_reasons[0].error) == NULL) ERR_load_strings_const(OSSL_STORE_str_reasons); #endif return 1; diff --git a/crypto/ts/ts_err.c b/crypto/ts/ts_err.c index b0203153a6..e87c492686 100644 --- a/crypto/ts/ts_err.c +++ b/crypto/ts/ts_err.c @@ -78,7 +78,7 @@ static const ERR_STRING_DATA TS_str_reasons[] = { int ERR_load_TS_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(TS_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(TS_str_reasons[0].error) == NULL) ERR_load_strings_const(TS_str_reasons); #endif return 1; diff --git a/crypto/ui/ui_err.c b/crypto/ui/ui_err.c index 7d6352b25b..2b564f71be 100644 --- a/crypto/ui/ui_err.c +++ b/crypto/ui/ui_err.c @@ -39,7 +39,7 @@ static const ERR_STRING_DATA UI_str_reasons[] = { int ERR_load_UI_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(UI_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(UI_str_reasons[0].error) == NULL) ERR_load_strings_const(UI_str_reasons); #endif return 1; diff --git a/crypto/x509/v3err.c b/crypto/x509/v3err.c index c02e1d2ef5..cbda3f2cf8 100644 --- a/crypto/x509/v3err.c +++ b/crypto/x509/v3err.c @@ -134,7 +134,7 @@ static const ERR_STRING_DATA X509V3_str_reasons[] = { int ERR_load_X509V3_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(X509V3_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(X509V3_str_reasons[0].error) == NULL) ERR_load_strings_const(X509V3_str_reasons); #endif return 1; diff --git a/crypto/x509/x509_err.c b/crypto/x509/x509_err.c index ff6d273310..1b01fd0131 100644 --- a/crypto/x509/x509_err.c +++ b/crypto/x509/x509_err.c @@ -77,7 +77,7 @@ static const ERR_STRING_DATA X509_str_reasons[] = { int ERR_load_X509_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(X509_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(X509_str_reasons[0].error) == NULL) ERR_load_strings_const(X509_str_reasons); #endif return 1; diff --git a/include/openssl/rsaerr.h b/include/openssl/rsaerr.h index 51f69e7919..da092fb02f 100644 --- a/include/openssl/rsaerr.h +++ b/include/openssl/rsaerr.h @@ -142,8 +142,8 @@ int ERR_load_RSA_strings(void); # define RSA_R_KEY_PRIME_NUM_INVALID 165 # define RSA_R_KEY_SIZE_TOO_SMALL 120 # define RSA_R_LAST_OCTET_INVALID 134 -# define RSA_R_MISSING_PRIVATE_KEY 179 # define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 +# define RSA_R_MISSING_PRIVATE_KEY 179 # define RSA_R_MODULUS_TOO_LARGE 105 # define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 # define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 diff --git a/providers/common/provider_err.c b/providers/common/provider_err.c index b9895593b9..f9524a7f62 100644 --- a/providers/common/provider_err.c +++ b/providers/common/provider_err.c @@ -91,7 +91,7 @@ static const ERR_STRING_DATA PROV_str_reasons[] = { int ERR_load_PROV_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(PROV_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(PROV_str_reasons[0].error) == NULL) ERR_load_strings_const(PROV_str_reasons); #endif return 1; diff --git a/ssl/ssl_err.c b/ssl/ssl_err.c index ef9b95a0c9..fc81948815 100644 --- a/ssl/ssl_err.c +++ b/ssl/ssl_err.c @@ -552,7 +552,7 @@ static const ERR_STRING_DATA SSL_str_reasons[] = { int ERR_load_SSL_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(SSL_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(SSL_str_reasons[0].error) == NULL) ERR_load_strings_const(SSL_str_reasons); #endif return 1; diff --git a/util/mkerr.pl b/util/mkerr.pl index 7fd34d277f..c2888890cd 100755 --- a/util/mkerr.pl +++ b/util/mkerr.pl @@ -607,7 +607,7 @@ EOF int ERR_load_${lib}_strings(void) { #ifndef OPENSSL_NO_ERR - if (ERR_func_error_string(${lib}_str_reasons[0].error) == NULL) + if (ERR_reason_error_string(${lib}_str_reasons[0].error) == NULL) ERR_load_strings_const(${lib}_str_reasons); #endif return 1;