Skip to content

Commit

Permalink
util/mkerr.pl: make it not depend on the function code
Browse files Browse the repository at this point in the history
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 openssl#9756

Reviewed-by: Matt Caswell <[email protected]>
(Merged from openssl#9756)
  • Loading branch information
levitte committed Sep 12, 2019
1 parent 6beb8b3 commit 0cd1b14
Show file tree
Hide file tree
Showing 37 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion crypto/asn1/asn1_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/async/async_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/bio/bio_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/bn/bn_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/buffer/buf_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/cmp/cmp_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/cms/cms_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/comp/comp_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/conf/conf_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/cpt_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/crmf/crmf_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/ct/ct_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/dh/dh_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/dsa/dsa_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/dso/dso_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/ec/ec_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/engine/eng_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/ess/ess_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/evp/evp_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/objects/obj_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/ocsp/ocsp_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/pem/pem_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/pkcs12/pk12err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/pkcs7/pkcs7err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/property/property_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/rand/rand_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/rsa/rsa_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/sm2/sm2_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/store/store_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/ts/ts_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/ui/ui_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/x509/v3err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crypto/x509/x509_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/openssl/rsaerr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion providers/common/provider_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ssl/ssl_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion util/mkerr.pl
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ sub help
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;
Expand Down

0 comments on commit 0cd1b14

Please sign in to comment.