Browse Source

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 <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9756)
Richard Levitte 4 years ago
parent
commit
0cd1b144f9

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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;