From 69588edbaa424beb71c6a9b1be416588232cb78c Mon Sep 17 00:00:00 2001 From: Kurt Roeckx Date: Tue, 12 Jul 2016 15:50:06 +0200 Subject: [PATCH] Check for errors allocating the error strings. Reviewed-by: Richard Levitte GH: #1330 --- crypto/asn1/asn1_err.c | 4 +- crypto/async/async_err.c | 3 +- crypto/bio/bio_err.c | 3 +- crypto/bn/bn_err.c | 3 +- crypto/buffer/buf_err.c | 3 +- crypto/cms/cms_err.c | 3 +- crypto/comp/comp_err.c | 3 +- crypto/conf/conf_err.c | 3 +- crypto/cpt_err.c | 3 +- crypto/ct/ct_err.c | 5 ++- crypto/dh/dh_err.c | 3 +- crypto/dsa/dsa_err.c | 3 +- crypto/dso/dso_err.c | 3 +- crypto/ec/ec_err.c | 3 +- crypto/engine/eng_err.c | 3 +- crypto/err/err.c | 12 ++++-- crypto/err/err_all.c | 70 ++++++++++++++++--------------- crypto/evp/evp_err.c | 5 ++- crypto/include/internal/err_int.h | 2 +- crypto/init.c | 5 ++- crypto/kdf/kdf_err.c | 3 +- crypto/objects/obj_err.c | 3 +- crypto/ocsp/ocsp_err.c | 3 +- crypto/pem/pem_err.c | 3 +- crypto/pkcs12/pk12err.c | 3 +- crypto/pkcs7/pkcs7err.c | 3 +- crypto/rand/rand_err.c | 3 +- crypto/rsa/rsa_err.c | 3 +- crypto/ts/ts_err.c | 3 +- crypto/ui/ui_err.c | 3 +- crypto/x509/x509_err.c | 3 +- crypto/x509v3/v3err.c | 3 +- include/internal/dso.h | 2 +- include/openssl/asn1.h | 2 +- include/openssl/async.h | 2 +- include/openssl/bio.h | 2 +- include/openssl/bn.h | 2 +- include/openssl/buffer.h | 2 +- include/openssl/cms.h | 2 +- include/openssl/comp.h | 2 +- include/openssl/conf.h | 2 +- include/openssl/crypto.h | 2 +- include/openssl/ct.h | 2 +- include/openssl/dh.h | 2 +- include/openssl/dsa.h | 2 +- include/openssl/ec.h | 2 +- include/openssl/engine.h | 2 +- include/openssl/err.h | 4 +- include/openssl/evp.h | 2 +- include/openssl/kdf.h | 2 +- include/openssl/objects.h | 2 +- include/openssl/ocsp.h | 2 +- include/openssl/pem.h | 2 +- include/openssl/pem2.h | 2 +- include/openssl/pkcs12.h | 2 +- include/openssl/pkcs7.h | 2 +- include/openssl/rand.h | 2 +- include/openssl/rsa.h | 2 +- include/openssl/ssl.h | 2 +- include/openssl/ts.h | 4 +- include/openssl/ui.h | 2 +- include/openssl/x509.h | 2 +- include/openssl/x509v3.h | 2 +- ssl/ssl_err.c | 3 +- util/mkerr.pl | 10 +++-- 65 files changed, 149 insertions(+), 108 deletions(-) diff --git a/crypto/asn1/asn1_err.c b/crypto/asn1/asn1_err.c index a363fdb2d1..97c3dec923 100644 --- a/crypto/asn1/asn1_err.c +++ b/crypto/asn1/asn1_err.c @@ -32,6 +32,7 @@ static ERR_STRING_DATA ASN1_str_functs[] = { {ERR_FUNC(ASN1_F_ASN1_D2I_READ_BIO), "asn1_d2i_read_bio"}, {ERR_FUNC(ASN1_F_ASN1_DIGEST), "ASN1_digest"}, {ERR_FUNC(ASN1_F_ASN1_DO_ADB), "asn1_do_adb"}, + {ERR_FUNC(ASN1_F_ASN1_DO_LOCK), "asn1_do_lock"}, {ERR_FUNC(ASN1_F_ASN1_DUP), "ASN1_dup"}, {ERR_FUNC(ASN1_F_ASN1_EX_C2I), "asn1_ex_c2i"}, {ERR_FUNC(ASN1_F_ASN1_FIND_END), "asn1_find_end"}, @@ -253,7 +254,7 @@ static ERR_STRING_DATA ASN1_str_reasons[] = { #endif -void ERR_load_ASN1_strings(void) +int ERR_load_ASN1_strings(void) { #ifndef OPENSSL_NO_ERR @@ -262,4 +263,5 @@ void ERR_load_ASN1_strings(void) ERR_load_strings(0, ASN1_str_reasons); } #endif + return 1; } diff --git a/crypto/async/async_err.c b/crypto/async/async_err.c index 13c41cdd28..ae97e96533 100644 --- a/crypto/async/async_err.c +++ b/crypto/async/async_err.c @@ -38,7 +38,7 @@ static ERR_STRING_DATA ASYNC_str_reasons[] = { #endif -void ERR_load_ASYNC_strings(void) +int ERR_load_ASYNC_strings(void) { #ifndef OPENSSL_NO_ERR @@ -47,4 +47,5 @@ void ERR_load_ASYNC_strings(void) ERR_load_strings(0, ASYNC_str_reasons); } #endif + return 1; } diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c index 75531824c3..d032dedbb7 100644 --- a/crypto/bio/bio_err.c +++ b/crypto/bio/bio_err.c @@ -112,7 +112,7 @@ static ERR_STRING_DATA BIO_str_reasons[] = { #endif -void ERR_load_BIO_strings(void) +int ERR_load_BIO_strings(void) { #ifndef OPENSSL_NO_ERR @@ -121,4 +121,5 @@ void ERR_load_BIO_strings(void) ERR_load_strings(0, BIO_str_reasons); } #endif + return 1; } diff --git a/crypto/bn/bn_err.c b/crypto/bn/bn_err.c index a71b265de2..5fe9db9ede 100644 --- a/crypto/bn/bn_err.c +++ b/crypto/bn/bn_err.c @@ -94,7 +94,7 @@ static ERR_STRING_DATA BN_str_reasons[] = { #endif -void ERR_load_BN_strings(void) +int ERR_load_BN_strings(void) { #ifndef OPENSSL_NO_ERR @@ -103,4 +103,5 @@ void ERR_load_BN_strings(void) ERR_load_strings(0, BN_str_reasons); } #endif + return 1; } diff --git a/crypto/buffer/buf_err.c b/crypto/buffer/buf_err.c index b7679ae064..a6a2ab88ae 100644 --- a/crypto/buffer/buf_err.c +++ b/crypto/buffer/buf_err.c @@ -31,7 +31,7 @@ static ERR_STRING_DATA BUF_str_reasons[] = { #endif -void ERR_load_BUF_strings(void) +int ERR_load_BUF_strings(void) { #ifndef OPENSSL_NO_ERR @@ -40,4 +40,5 @@ void ERR_load_BUF_strings(void) ERR_load_strings(0, BUF_str_reasons); } #endif + return 1; } diff --git a/crypto/cms/cms_err.c b/crypto/cms/cms_err.c index cfda0190c2..c6df1b5afe 100644 --- a/crypto/cms/cms_err.c +++ b/crypto/cms/cms_err.c @@ -245,7 +245,7 @@ static ERR_STRING_DATA CMS_str_reasons[] = { #endif -void ERR_load_CMS_strings(void) +int ERR_load_CMS_strings(void) { #ifndef OPENSSL_NO_ERR @@ -254,4 +254,5 @@ void ERR_load_CMS_strings(void) ERR_load_strings(0, CMS_str_reasons); } #endif + return 1; } diff --git a/crypto/comp/comp_err.c b/crypto/comp/comp_err.c index 0233e940f6..8e2e69568d 100644 --- a/crypto/comp/comp_err.c +++ b/crypto/comp/comp_err.c @@ -35,7 +35,7 @@ static ERR_STRING_DATA COMP_str_reasons[] = { #endif -void ERR_load_COMP_strings(void) +int ERR_load_COMP_strings(void) { #ifndef OPENSSL_NO_ERR @@ -44,4 +44,5 @@ void ERR_load_COMP_strings(void) ERR_load_strings(0, COMP_str_reasons); } #endif + return 1; } diff --git a/crypto/conf/conf_err.c b/crypto/conf/conf_err.c index 31bb15c34a..b583c057cd 100644 --- a/crypto/conf/conf_err.c +++ b/crypto/conf/conf_err.c @@ -66,7 +66,7 @@ static ERR_STRING_DATA CONF_str_reasons[] = { #endif -void ERR_load_CONF_strings(void) +int ERR_load_CONF_strings(void) { #ifndef OPENSSL_NO_ERR @@ -75,4 +75,5 @@ void ERR_load_CONF_strings(void) ERR_load_strings(0, CONF_str_reasons); } #endif + return 1; } diff --git a/crypto/cpt_err.c b/crypto/cpt_err.c index 3c6e8d53d2..c28dcf19a7 100644 --- a/crypto/cpt_err.c +++ b/crypto/cpt_err.c @@ -42,7 +42,7 @@ static ERR_STRING_DATA CRYPTO_str_reasons[] = { #endif -void ERR_load_CRYPTO_strings(void) +int ERR_load_CRYPTO_strings(void) { #ifndef OPENSSL_NO_ERR @@ -51,4 +51,5 @@ void ERR_load_CRYPTO_strings(void) ERR_load_strings(0, CRYPTO_str_reasons); } #endif + return 1; } diff --git a/crypto/ct/ct_err.c b/crypto/ct/ct_err.c index 8581dbb791..dbf0bd2b11 100644 --- a/crypto/ct/ct_err.c +++ b/crypto/ct/ct_err.c @@ -25,6 +25,8 @@ static ERR_STRING_DATA CT_str_functs[] = { {ERR_FUNC(CT_F_CTLOG_NEW_NULL), "CTLOG_new_null"}, {ERR_FUNC(CT_F_CTLOG_STORE_LOAD_CTX_NEW), "ctlog_store_load_ctx_new"}, {ERR_FUNC(CT_F_CTLOG_STORE_LOAD_FILE), "CTLOG_STORE_load_file"}, + {ERR_FUNC(CT_F_CTLOG_STORE_LOAD_LOG), "ctlog_store_load_log"}, + {ERR_FUNC(CT_F_CTLOG_STORE_NEW), "CTLOG_STORE_new"}, {ERR_FUNC(CT_F_CT_BASE64_DECODE), "ct_base64_decode"}, {ERR_FUNC(CT_F_CT_POLICY_EVAL_CTX_NEW), "CT_POLICY_EVAL_CTX_new"}, {ERR_FUNC(CT_F_CT_V1_LOG_ID_FROM_PKEY), "ct_v1_log_id_from_pkey"}, @@ -73,7 +75,7 @@ static ERR_STRING_DATA CT_str_reasons[] = { #endif -void ERR_load_CT_strings(void) +int ERR_load_CT_strings(void) { #ifndef OPENSSL_NO_ERR @@ -82,4 +84,5 @@ void ERR_load_CT_strings(void) ERR_load_strings(0, CT_str_reasons); } #endif + return 1; } diff --git a/crypto/dh/dh_err.c b/crypto/dh/dh_err.c index a5348b1aab..4e21f284bd 100644 --- a/crypto/dh/dh_err.c +++ b/crypto/dh/dh_err.c @@ -60,7 +60,7 @@ static ERR_STRING_DATA DH_str_reasons[] = { #endif -void ERR_load_DH_strings(void) +int ERR_load_DH_strings(void) { #ifndef OPENSSL_NO_ERR @@ -69,4 +69,5 @@ void ERR_load_DH_strings(void) ERR_load_strings(0, DH_str_reasons); } #endif + return 1; } diff --git a/crypto/dsa/dsa_err.c b/crypto/dsa/dsa_err.c index 028f79f32a..6de49eebbd 100644 --- a/crypto/dsa/dsa_err.c +++ b/crypto/dsa/dsa_err.c @@ -61,7 +61,7 @@ static ERR_STRING_DATA DSA_str_reasons[] = { #endif -void ERR_load_DSA_strings(void) +int ERR_load_DSA_strings(void) { #ifndef OPENSSL_NO_ERR @@ -70,4 +70,5 @@ void ERR_load_DSA_strings(void) ERR_load_strings(0, DSA_str_reasons); } #endif + return 1; } diff --git a/crypto/dso/dso_err.c b/crypto/dso/dso_err.c index 870c80beb0..a180580759 100644 --- a/crypto/dso/dso_err.c +++ b/crypto/dso/dso_err.c @@ -78,7 +78,7 @@ static ERR_STRING_DATA DSO_str_reasons[] = { #endif -void ERR_load_DSO_strings(void) +int ERR_load_DSO_strings(void) { #ifndef OPENSSL_NO_ERR @@ -87,4 +87,5 @@ void ERR_load_DSO_strings(void) ERR_load_strings(0, DSO_str_reasons); } #endif + return 1; } diff --git a/crypto/ec/ec_err.c b/crypto/ec/ec_err.c index 25dea231b8..39e8343623 100644 --- a/crypto/ec/ec_err.c +++ b/crypto/ec/ec_err.c @@ -271,7 +271,7 @@ static ERR_STRING_DATA EC_str_reasons[] = { #endif -void ERR_load_EC_strings(void) +int ERR_load_EC_strings(void) { #ifndef OPENSSL_NO_ERR @@ -280,4 +280,5 @@ void ERR_load_EC_strings(void) ERR_load_strings(0, EC_str_reasons); } #endif + return 1; } diff --git a/crypto/engine/eng_err.c b/crypto/engine/eng_err.c index 5eb8771969..5e9d16f3cd 100644 --- a/crypto/engine/eng_err.c +++ b/crypto/engine/eng_err.c @@ -110,7 +110,7 @@ static ERR_STRING_DATA ENGINE_str_reasons[] = { #endif -void ERR_load_ENGINE_strings(void) +int ERR_load_ENGINE_strings(void) { #ifndef OPENSSL_NO_ERR @@ -119,4 +119,5 @@ void ERR_load_ENGINE_strings(void) ERR_load_strings(0, ENGINE_str_reasons); } #endif + return 1; } diff --git a/crypto/err/err.c b/crypto/err/err.c index ad1ccd10d0..dc721c2e08 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -283,10 +283,11 @@ void err_cleanup(void) err_string_lock = NULL; } -void ERR_load_ERR_strings(void) +int ERR_load_ERR_strings(void) { #ifndef OPENSSL_NO_ERR - RUN_ONCE(&err_string_init, do_err_strings_init); + if (!RUN_ONCE(&err_string_init, do_err_strings_init)) + return 0; err_load_strings(0, ERR_str_libraries); err_load_strings(0, ERR_str_reasons); @@ -294,6 +295,7 @@ void ERR_load_ERR_strings(void) build_SYS_str_reasons(); err_load_strings(ERR_LIB_SYS, SYS_str_reasons); #endif + return 1; } static void err_load_strings(int lib, ERR_STRING_DATA *str) @@ -312,10 +314,12 @@ static void err_load_strings(int lib, ERR_STRING_DATA *str) CRYPTO_THREAD_unlock(err_string_lock); } -void ERR_load_strings(int lib, ERR_STRING_DATA *str) +int ERR_load_strings(int lib, ERR_STRING_DATA *str) { - ERR_load_ERR_strings(); + if (ERR_load_ERR_strings() == 0) + return 0; err_load_strings(lib, str); + return 1; } int ERR_unload_strings(int lib, ERR_STRING_DATA *str) diff --git a/crypto/err/err_all.c b/crypto/err/err_all.c index f617dd1a0d..3b1304f8e0 100644 --- a/crypto/err/err_all.c +++ b/crypto/err/err_all.c @@ -40,66 +40,70 @@ #include #include -void err_load_crypto_strings_int(void) +int err_load_crypto_strings_int(void) { + if ( #ifdef OPENSSL_FIPS - FIPS_set_error_callbacks(ERR_put_error, ERR_add_error_vdata); + FIPS_set_error_callbacks(ERR_put_error, ERR_add_error_vdata) == 0 || #endif #ifndef OPENSSL_NO_ERR - ERR_load_ERR_strings(); /* include error strings for SYSerr */ - ERR_load_BN_strings(); + ERR_load_ERR_strings() == 0 || /* include error strings for SYSerr */ + ERR_load_BN_strings() == 0 || # ifndef OPENSSL_NO_RSA - ERR_load_RSA_strings(); + ERR_load_RSA_strings() == 0 || # endif # ifndef OPENSSL_NO_DH - ERR_load_DH_strings(); + ERR_load_DH_strings() == 0 || # endif - ERR_load_EVP_strings(); - ERR_load_BUF_strings(); - ERR_load_OBJ_strings(); - ERR_load_PEM_strings(); + ERR_load_EVP_strings() == 0 || + ERR_load_BUF_strings() == 0 || + ERR_load_OBJ_strings() == 0 || + ERR_load_PEM_strings() == 0 || # ifndef OPENSSL_NO_DSA - ERR_load_DSA_strings(); + ERR_load_DSA_strings() == 0 || # endif - ERR_load_X509_strings(); - ERR_load_ASN1_strings(); - ERR_load_CONF_strings(); - ERR_load_CRYPTO_strings(); + ERR_load_X509_strings() == 0 || + ERR_load_ASN1_strings() == 0 || + ERR_load_CONF_strings() == 0 || + ERR_load_CRYPTO_strings() == 0 || # ifndef OPENSSL_NO_COMP - ERR_load_COMP_strings(); + ERR_load_COMP_strings() == 0 || # endif # ifndef OPENSSL_NO_EC - ERR_load_EC_strings(); + ERR_load_EC_strings() == 0 || # endif - /* skip ERR_load_SSL_strings() because it is not in this library */ - ERR_load_BIO_strings(); - ERR_load_PKCS7_strings(); - ERR_load_X509V3_strings(); - ERR_load_PKCS12_strings(); - ERR_load_RAND_strings(); - ERR_load_DSO_strings(); + /* skip ERR_load_SSL_strings() because it is not in this library */ + ERR_load_BIO_strings() == 0 || + ERR_load_PKCS7_strings() == 0 || + ERR_load_X509V3_strings() == 0 || + ERR_load_PKCS12_strings() == 0 || + ERR_load_RAND_strings() == 0 || + ERR_load_DSO_strings() == 0 || # ifndef OPENSSL_NO_TS - ERR_load_TS_strings(); + ERR_load_TS_strings() == 0 || # endif # ifndef OPENSSL_NO_ENGINE - ERR_load_ENGINE_strings(); + ERR_load_ENGINE_strings() == 0 || # endif # ifndef OPENSSL_NO_OCSP - ERR_load_OCSP_strings(); + ERR_load_OCSP_strings() == 0 || # endif #ifndef OPENSSL_NO_UI - ERR_load_UI_strings(); + ERR_load_UI_strings() == 0 || #endif # ifdef OPENSSL_FIPS - ERR_load_FIPS_strings(); + ERR_load_FIPS_strings() == 0 || # endif # ifndef OPENSSL_NO_CMS - ERR_load_CMS_strings(); + ERR_load_CMS_strings() == 0 || # endif # ifndef OPENSSL_NO_CT - ERR_load_CT_strings(); + ERR_load_CT_strings() == 0 || # endif - ERR_load_ASYNC_strings(); + ERR_load_ASYNC_strings() == 0 || #endif - ERR_load_KDF_strings(); + ERR_load_KDF_strings() == 0) + return 0; + + return 1; } diff --git a/crypto/evp/evp_err.c b/crypto/evp/evp_err.c index 50277ffb82..bde5e31e91 100644 --- a/crypto/evp/evp_err.c +++ b/crypto/evp/evp_err.c @@ -57,10 +57,10 @@ static ERR_STRING_DATA EVP_str_functs[] = { {ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT), "EVP_PKEY_encrypt"}, {ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT_INIT), "EVP_PKEY_encrypt_init"}, {ERR_FUNC(EVP_F_EVP_PKEY_ENCRYPT_OLD), "EVP_PKEY_encrypt_old"}, - {ERR_FUNC(EVP_F_EVP_PKEY_GET0_HMAC), "EVP_PKEY_get0_hmac"}, {ERR_FUNC(EVP_F_EVP_PKEY_GET0_DH), "EVP_PKEY_get0_DH"}, {ERR_FUNC(EVP_F_EVP_PKEY_GET0_DSA), "EVP_PKEY_get0_DSA"}, {ERR_FUNC(EVP_F_EVP_PKEY_GET0_EC_KEY), "EVP_PKEY_get0_EC_KEY"}, + {ERR_FUNC(EVP_F_EVP_PKEY_GET0_HMAC), "EVP_PKEY_get0_hmac"}, {ERR_FUNC(EVP_F_EVP_PKEY_GET0_RSA), "EVP_PKEY_get0_RSA"}, {ERR_FUNC(EVP_F_EVP_PKEY_KEYGEN), "EVP_PKEY_keygen"}, {ERR_FUNC(EVP_F_EVP_PKEY_KEYGEN_INIT), "EVP_PKEY_keygen_init"}, @@ -159,7 +159,7 @@ static ERR_STRING_DATA EVP_str_reasons[] = { #endif -void ERR_load_EVP_strings(void) +int ERR_load_EVP_strings(void) { #ifndef OPENSSL_NO_ERR @@ -168,4 +168,5 @@ void ERR_load_EVP_strings(void) ERR_load_strings(0, EVP_str_reasons); } #endif + return 1; } diff --git a/crypto/include/internal/err_int.h b/crypto/include/internal/err_int.h index 749a8db262..7fec3ed767 100644 --- a/crypto/include/internal/err_int.h +++ b/crypto/include/internal/err_int.h @@ -10,7 +10,7 @@ #ifndef INTERNAL_ERR_INT_H # define INTERNAL_ERR_INT_H -void err_load_crypto_strings_int(void); +int err_load_crypto_strings_int(void); void err_cleanup(void); void err_delete_thread_state(void); diff --git a/crypto/init.c b/crypto/init.c index ace11da610..332567eae7 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -92,6 +92,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_no_load_crypto_strings) DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_strings) { + int ret = 1; /* * OPENSSL_NO_AUTOERRINIT is provided here to prevent at compile time * pulling in all the error strings during static linking @@ -101,10 +102,10 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_strings) fprintf(stderr, "OPENSSL_INIT: ossl_init_load_crypto_strings: " "err_load_crypto_strings_int()\n"); # endif - err_load_crypto_strings_int(); + ret = err_load_crypto_strings_int(); #endif load_crypto_strings_inited = 1; - return 1; + return ret; } static CRYPTO_ONCE add_all_ciphers = CRYPTO_ONCE_STATIC_INIT; diff --git a/crypto/kdf/kdf_err.c b/crypto/kdf/kdf_err.c index 6707a52ba7..d7d71b35e4 100644 --- a/crypto/kdf/kdf_err.c +++ b/crypto/kdf/kdf_err.c @@ -33,7 +33,7 @@ static ERR_STRING_DATA KDF_str_reasons[] = { #endif -void ERR_load_KDF_strings(void) +int ERR_load_KDF_strings(void) { #ifndef OPENSSL_NO_ERR @@ -42,4 +42,5 @@ void ERR_load_KDF_strings(void) ERR_load_strings(0, KDF_str_reasons); } #endif + return 1; } diff --git a/crypto/objects/obj_err.c b/crypto/objects/obj_err.c index 2dd80be0e3..4677b67367 100644 --- a/crypto/objects/obj_err.c +++ b/crypto/objects/obj_err.c @@ -37,7 +37,7 @@ static ERR_STRING_DATA OBJ_str_reasons[] = { #endif -void ERR_load_OBJ_strings(void) +int ERR_load_OBJ_strings(void) { #ifndef OPENSSL_NO_ERR @@ -46,4 +46,5 @@ void ERR_load_OBJ_strings(void) ERR_load_strings(0, OBJ_str_reasons); } #endif + return 1; } diff --git a/crypto/ocsp/ocsp_err.c b/crypto/ocsp/ocsp_err.c index 59bcf85cd0..a2d96e9c9f 100644 --- a/crypto/ocsp/ocsp_err.c +++ b/crypto/ocsp/ocsp_err.c @@ -78,7 +78,7 @@ static ERR_STRING_DATA OCSP_str_reasons[] = { #endif -void ERR_load_OCSP_strings(void) +int ERR_load_OCSP_strings(void) { #ifndef OPENSSL_NO_ERR @@ -87,4 +87,5 @@ void ERR_load_OCSP_strings(void) ERR_load_strings(0, OCSP_str_reasons); } #endif + return 1; } diff --git a/crypto/pem/pem_err.c b/crypto/pem/pem_err.c index 7a42535b77..f36d89324b 100644 --- a/crypto/pem/pem_err.c +++ b/crypto/pem/pem_err.c @@ -102,7 +102,7 @@ static ERR_STRING_DATA PEM_str_reasons[] = { #endif -void ERR_load_PEM_strings(void) +int ERR_load_PEM_strings(void) { #ifndef OPENSSL_NO_ERR @@ -111,4 +111,5 @@ void ERR_load_PEM_strings(void) ERR_load_strings(0, PEM_str_reasons); } #endif + return 1; } diff --git a/crypto/pkcs12/pk12err.c b/crypto/pkcs12/pk12err.c index 36053f196c..f15a6951a2 100644 --- a/crypto/pkcs12/pk12err.c +++ b/crypto/pkcs12/pk12err.c @@ -81,7 +81,7 @@ static ERR_STRING_DATA PKCS12_str_reasons[] = { #endif -void ERR_load_PKCS12_strings(void) +int ERR_load_PKCS12_strings(void) { #ifndef OPENSSL_NO_ERR @@ -90,4 +90,5 @@ void ERR_load_PKCS12_strings(void) ERR_load_strings(0, PKCS12_str_reasons); } #endif + return 1; } diff --git a/crypto/pkcs7/pkcs7err.c b/crypto/pkcs7/pkcs7err.c index bcb479d506..d5baa9b832 100644 --- a/crypto/pkcs7/pkcs7err.c +++ b/crypto/pkcs7/pkcs7err.c @@ -118,7 +118,7 @@ static ERR_STRING_DATA PKCS7_str_reasons[] = { #endif -void ERR_load_PKCS7_strings(void) +int ERR_load_PKCS7_strings(void) { #ifndef OPENSSL_NO_ERR @@ -127,4 +127,5 @@ void ERR_load_PKCS7_strings(void) ERR_load_strings(0, PKCS7_str_reasons); } #endif + return 1; } diff --git a/crypto/rand/rand_err.c b/crypto/rand/rand_err.c index c58e7ee4fb..55431264a0 100644 --- a/crypto/rand/rand_err.c +++ b/crypto/rand/rand_err.c @@ -30,7 +30,7 @@ static ERR_STRING_DATA RAND_str_reasons[] = { #endif -void ERR_load_RAND_strings(void) +int ERR_load_RAND_strings(void) { #ifndef OPENSSL_NO_ERR @@ -39,4 +39,5 @@ void ERR_load_RAND_strings(void) ERR_load_strings(0, RAND_str_reasons); } #endif + return 1; } diff --git a/crypto/rsa/rsa_err.c b/crypto/rsa/rsa_err.c index 0bde045583..210709e5c9 100644 --- a/crypto/rsa/rsa_err.c +++ b/crypto/rsa/rsa_err.c @@ -170,7 +170,7 @@ static ERR_STRING_DATA RSA_str_reasons[] = { #endif -void ERR_load_RSA_strings(void) +int ERR_load_RSA_strings(void) { #ifndef OPENSSL_NO_ERR @@ -179,4 +179,5 @@ void ERR_load_RSA_strings(void) ERR_load_strings(0, RSA_str_reasons); } #endif + return 1; } diff --git a/crypto/ts/ts_err.c b/crypto/ts/ts_err.c index 08217f71b3..a6d73a174b 100644 --- a/crypto/ts/ts_err.c +++ b/crypto/ts/ts_err.c @@ -131,7 +131,7 @@ static ERR_STRING_DATA TS_str_reasons[] = { #endif -void ERR_load_TS_strings(void) +int ERR_load_TS_strings(void) { #ifndef OPENSSL_NO_ERR @@ -140,4 +140,5 @@ void ERR_load_TS_strings(void) ERR_load_strings(0, TS_str_reasons); } #endif + return 1; } diff --git a/crypto/ui/ui_err.c b/crypto/ui/ui_err.c index 03cd2bc554..ef03815ea2 100644 --- a/crypto/ui/ui_err.c +++ b/crypto/ui/ui_err.c @@ -48,7 +48,7 @@ static ERR_STRING_DATA UI_str_reasons[] = { #endif -void ERR_load_UI_strings(void) +int ERR_load_UI_strings(void) { #ifndef OPENSSL_NO_ERR @@ -57,4 +57,5 @@ void ERR_load_UI_strings(void) ERR_load_strings(0, UI_str_reasons); } #endif + return 1; } diff --git a/crypto/x509/x509_err.c b/crypto/x509/x509_err.c index 13f5a24f87..3f4b8ef0bc 100644 --- a/crypto/x509/x509_err.c +++ b/crypto/x509/x509_err.c @@ -129,7 +129,7 @@ static ERR_STRING_DATA X509_str_reasons[] = { #endif -void ERR_load_X509_strings(void) +int ERR_load_X509_strings(void) { #ifndef OPENSSL_NO_ERR @@ -138,4 +138,5 @@ void ERR_load_X509_strings(void) ERR_load_strings(0, X509_str_reasons); } #endif + return 1; } diff --git a/crypto/x509v3/v3err.c b/crypto/x509v3/v3err.c index 1f838bc018..5d79c8c6ca 100644 --- a/crypto/x509v3/v3err.c +++ b/crypto/x509v3/v3err.c @@ -174,7 +174,7 @@ static ERR_STRING_DATA X509V3_str_reasons[] = { #endif -void ERR_load_X509V3_strings(void) +int ERR_load_X509V3_strings(void) { #ifndef OPENSSL_NO_ERR @@ -183,4 +183,5 @@ void ERR_load_X509V3_strings(void) ERR_load_strings(0, X509V3_str_reasons); } #endif + return 1; } diff --git a/include/internal/dso.h b/include/internal/dso.h index d371fbe465..970beeb195 100644 --- a/include/internal/dso.h +++ b/include/internal/dso.h @@ -153,7 +153,7 @@ void *DSO_global_lookup(const char *name); * made after this point may be overwritten when the script is next run. */ -void ERR_load_DSO_strings(void); +int ERR_load_DSO_strings(void); /* Error codes for the DSO functions. */ diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h index 6994abf0cc..e313109d22 100644 --- a/include/openssl/asn1.h +++ b/include/openssl/asn1.h @@ -875,7 +875,7 @@ int SMIME_text(BIO *in, BIO *out); * made after this point may be overwritten when the script is next run. */ -void ERR_load_ASN1_strings(void); +int ERR_load_ASN1_strings(void); /* Error codes for the ASN1 functions. */ diff --git a/include/openssl/async.h b/include/openssl/async.h index ca51bb3412..5b2e496dbd 100644 --- a/include/openssl/async.h +++ b/include/openssl/async.h @@ -74,7 +74,7 @@ void ASYNC_unblock_pause(void); * made after this point may be overwritten when the script is next run. */ -void ERR_load_ASYNC_strings(void); +int ERR_load_ASYNC_strings(void); /* Error codes for the ASYNC functions. */ diff --git a/include/openssl/bio.h b/include/openssl/bio.h index d486d07199..ed50139ed4 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h @@ -763,7 +763,7 @@ int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, * made after this point may be overwritten when the script is next run. */ -void ERR_load_BIO_strings(void); +int ERR_load_BIO_strings(void); /* Error codes for the BIO functions. */ diff --git a/include/openssl/bn.h b/include/openssl/bn.h index c4fca99ff6..1e3c24af46 100644 --- a/include/openssl/bn.h +++ b/include/openssl/bn.h @@ -488,7 +488,7 @@ int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); * made after this point may be overwritten when the script is next run. */ -void ERR_load_BN_strings(void); +int ERR_load_BN_strings(void); /* Error codes for the BN functions. */ diff --git a/include/openssl/buffer.h b/include/openssl/buffer.h index e2e1e5da9d..91f0e07ff9 100644 --- a/include/openssl/buffer.h +++ b/include/openssl/buffer.h @@ -59,7 +59,7 @@ void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); * made after this point may be overwritten when the script is next run. */ -void ERR_load_BUF_strings(void); +int ERR_load_BUF_strings(void); /* Error codes for the BUF functions. */ diff --git a/include/openssl/cms.h b/include/openssl/cms.h index b1252acd6e..dbc27e5562 100644 --- a/include/openssl/cms.h +++ b/include/openssl/cms.h @@ -335,7 +335,7 @@ int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, * made after this point may be overwritten when the script is next run. */ -void ERR_load_CMS_strings(void); +int ERR_load_CMS_strings(void); /* Error codes for the CMS functions. */ diff --git a/include/openssl/comp.h b/include/openssl/comp.h index 520d709a6f..260ff1e0ac 100644 --- a/include/openssl/comp.h +++ b/include/openssl/comp.h @@ -50,7 +50,7 @@ const BIO_METHOD *BIO_f_zlib(void); * made after this point may be overwritten when the script is next run. */ -void ERR_load_COMP_strings(void); +int ERR_load_COMP_strings(void); /* Error codes for the COMP functions. */ diff --git a/include/openssl/conf.h b/include/openssl/conf.h index 147d27bb2a..462e3c9d39 100644 --- a/include/openssl/conf.h +++ b/include/openssl/conf.h @@ -168,7 +168,7 @@ void OPENSSL_load_builtin_modules(void); * made after this point may be overwritten when the script is next run. */ -void ERR_load_CONF_strings(void); +int ERR_load_CONF_strings(void); /* Error codes for the CONF functions. */ diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h index cbd05a8acc..18b9c1b7ba 100644 --- a/include/openssl/crypto.h +++ b/include/openssl/crypto.h @@ -436,7 +436,7 @@ int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); * made after this point may be overwritten when the script is next run. */ -void ERR_load_CRYPTO_strings(void); +int ERR_load_CRYPTO_strings(void); /* Error codes for the CRYPTO functions. */ diff --git a/include/openssl/ct.h b/include/openssl/ct.h index be7a953ff4..3b011cc932 100644 --- a/include/openssl/ct.h +++ b/include/openssl/ct.h @@ -481,7 +481,7 @@ __owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store); * made after this point may be overwritten when the script is next run. */ -void ERR_load_CT_strings(void); +int ERR_load_CT_strings(void); /* Error codes for the CT functions. */ diff --git a/include/openssl/dh.h b/include/openssl/dh.h index a574e1871e..ae309e7b31 100644 --- a/include/openssl/dh.h +++ b/include/openssl/dh.h @@ -296,7 +296,7 @@ int DH_meth_set_generate_params(DH_METHOD *dhm, * made after this point may be overwritten when the script is next run. */ -void ERR_load_DH_strings(void); +int ERR_load_DH_strings(void); /* Error codes for the DH functions. */ diff --git a/include/openssl/dsa.h b/include/openssl/dsa.h index 11ddd397b3..cbc60e168a 100644 --- a/include/openssl/dsa.h +++ b/include/openssl/dsa.h @@ -233,7 +233,7 @@ int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *)); * made after this point may be overwritten when the script is next run. */ -void ERR_load_DSA_strings(void); +int ERR_load_DSA_strings(void); /* Error codes for the DSA functions. */ diff --git a/include/openssl/ec.h b/include/openssl/ec.h index 03942eda84..ebeb3e9a4b 100644 --- a/include/openssl/ec.h +++ b/include/openssl/ec.h @@ -1360,7 +1360,7 @@ void EC_KEY_METHOD_get_verify(EC_KEY_METHOD *meth, * made after this point may be overwritten when the script is next run. */ -void ERR_load_EC_strings(void); +int ERR_load_EC_strings(void); /* Error codes for the EC functions. */ diff --git a/include/openssl/engine.h b/include/openssl/engine.h index 21c6961286..c0bedf6f97 100644 --- a/include/openssl/engine.h +++ b/include/openssl/engine.h @@ -755,7 +755,7 @@ DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void)) * made after this point may be overwritten when the script is next run. */ -void ERR_load_ENGINE_strings(void); +int ERR_load_ENGINE_strings(void); /* Error codes for the ENGINE functions. */ diff --git a/include/openssl/err.h b/include/openssl/err.h index 60ffc49edc..d98c9cd340 100644 --- a/include/openssl/err.h +++ b/include/openssl/err.h @@ -231,9 +231,9 @@ void ERR_print_errors_fp(FILE *fp); void ERR_print_errors(BIO *bp); void ERR_add_error_data(int num, ...); void ERR_add_error_vdata(int num, va_list args); -void ERR_load_strings(int lib, ERR_STRING_DATA str[]); +int ERR_load_strings(int lib, ERR_STRING_DATA str[]); int ERR_unload_strings(int lib, ERR_STRING_DATA str[]); -void ERR_load_ERR_strings(void); +int ERR_load_ERR_strings(void); #if OPENSSL_API_COMPAT < 0x10100000L # define ERR_load_crypto_strings() \ diff --git a/include/openssl/evp.h b/include/openssl/evp.h index 997f1e2c21..999660365c 100644 --- a/include/openssl/evp.h +++ b/include/openssl/evp.h @@ -1440,7 +1440,7 @@ void EVP_add_alg_module(void); * made after this point may be overwritten when the script is next run. */ -void ERR_load_EVP_strings(void); +int ERR_load_EVP_strings(void); /* Error codes for the EVP functions. */ diff --git a/include/openssl/kdf.h b/include/openssl/kdf.h index 3078b56dc4..9f87f788b2 100644 --- a/include/openssl/kdf.h +++ b/include/openssl/kdf.h @@ -56,7 +56,7 @@ extern "C" { * made after this point may be overwritten when the script is next run. */ -void ERR_load_KDF_strings(void); +int ERR_load_KDF_strings(void); /* Error codes for the KDF functions. */ diff --git a/include/openssl/objects.h b/include/openssl/objects.h index 4d3de7c9d0..09d614ffc0 100644 --- a/include/openssl/objects.h +++ b/include/openssl/objects.h @@ -1074,7 +1074,7 @@ void OBJ_sigid_free(void); * made after this point may be overwritten when the script is next run. */ -void ERR_load_OBJ_strings(void); +int ERR_load_OBJ_strings(void); /* Error codes for the OBJ functions. */ diff --git a/include/openssl/ocsp.h b/include/openssl/ocsp.h index c74495a0b2..a468a5233e 100644 --- a/include/openssl/ocsp.h +++ b/include/openssl/ocsp.h @@ -352,7 +352,7 @@ int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, * made after this point may be overwritten when the script is next run. */ -void ERR_load_OCSP_strings(void); +int ERR_load_OCSP_strings(void); /* Error codes for the OCSP functions. */ diff --git a/include/openssl/pem.h b/include/openssl/pem.h index 6dd76eeace..2375d63553 100644 --- a/include/openssl/pem.h +++ b/include/openssl/pem.h @@ -419,7 +419,7 @@ int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, * made after this point may be overwritten when the script is next run. */ -void ERR_load_PEM_strings(void); +int ERR_load_PEM_strings(void); /* Error codes for the PEM functions. */ diff --git a/include/openssl/pem2.h b/include/openssl/pem2.h index 9cb74721e6..cfe73f139e 100644 --- a/include/openssl/pem2.h +++ b/include/openssl/pem2.h @@ -12,7 +12,7 @@ extern "C" { #endif #ifndef HEADER_PEM_H -void ERR_load_PEM_strings(void); +int ERR_load_PEM_strings(void); #endif #ifdef __cplusplus diff --git a/include/openssl/pkcs12.h b/include/openssl/pkcs12.h index 4c49fb2881..a1e9d1d581 100644 --- a/include/openssl/pkcs12.h +++ b/include/openssl/pkcs12.h @@ -212,7 +212,7 @@ int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); * made after this point may be overwritten when the script is next run. */ -void ERR_load_PKCS12_strings(void); +int ERR_load_PKCS12_strings(void); /* Error codes for the PKCS12 functions. */ diff --git a/include/openssl/pkcs7.h b/include/openssl/pkcs7.h index 328a4f66b4..691f722022 100644 --- a/include/openssl/pkcs7.h +++ b/include/openssl/pkcs7.h @@ -318,7 +318,7 @@ BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); * made after this point may be overwritten when the script is next run. */ -void ERR_load_PKCS7_strings(void); +int ERR_load_PKCS7_strings(void); /* Error codes for the PKCS7 functions. */ diff --git a/include/openssl/rand.h b/include/openssl/rand.h index 8dab1a00fb..d521ae192a 100644 --- a/include/openssl/rand.h +++ b/include/openssl/rand.h @@ -73,7 +73,7 @@ DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) * made after this point may be overwritten when the script is next run. */ -void ERR_load_RAND_strings(void); +int ERR_load_RAND_strings(void); /* Error codes for the RAND functions. */ diff --git a/include/openssl/rsa.h b/include/openssl/rsa.h index b9d14e414c..9721218e1a 100644 --- a/include/openssl/rsa.h +++ b/include/openssl/rsa.h @@ -456,7 +456,7 @@ int RSA_meth_set_keygen(RSA_METHOD *rsa, * made after this point may be overwritten when the script is next run. */ -void ERR_load_RSA_strings(void); +int ERR_load_RSA_strings(void); /* Error codes for the RSA functions. */ diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index 3a6cd4c5f9..1533daa4b7 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -2036,7 +2036,7 @@ extern const char SSL_version_str[]; * made after this point may be overwritten when the script is next run. */ -void ERR_load_SSL_strings(void); +int ERR_load_SSL_strings(void); /* Error codes for the SSL functions. */ diff --git a/include/openssl/ts.h b/include/openssl/ts.h index 3e31b2fd3b..25ad13769a 100644 --- a/include/openssl/ts.h +++ b/include/openssl/ts.h @@ -156,8 +156,6 @@ ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, const unsigned char **pp, long length); ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); -void ERR_load_TS_strings(void); - int TS_REQ_set_version(TS_REQ *a, long version); long TS_REQ_get_version(const TS_REQ *a); @@ -532,7 +530,7 @@ int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, * made after this point may be overwritten when the script is next run. */ -void ERR_load_TS_strings(void); +int ERR_load_TS_strings(void); /* Error codes for the TS functions. */ diff --git a/include/openssl/ui.h b/include/openssl/ui.h index dcebb6e771..26f4f04495 100644 --- a/include/openssl/ui.h +++ b/include/openssl/ui.h @@ -334,7 +334,7 @@ int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, * made after this point may be overwritten when the script is next run. */ -void ERR_load_UI_strings(void); +int ERR_load_UI_strings(void); /* Error codes for the UI functions. */ diff --git a/include/openssl/x509.h b/include/openssl/x509.h index 2f7444dc46..581d830b00 100644 --- a/include/openssl/x509.h +++ b/include/openssl/x509.h @@ -995,7 +995,7 @@ int X509_TRUST_get_trust(const X509_TRUST *xp); * made after this point may be overwritten when the script is next run. */ -void ERR_load_X509_strings(void); +int ERR_load_X509_strings(void); /* Error codes for the X509 functions. */ diff --git a/include/openssl/x509v3.h b/include/openssl/x509v3.h index e6053c57fe..89be5f9c14 100644 --- a/include/openssl/x509v3.h +++ b/include/openssl/x509v3.h @@ -863,7 +863,7 @@ int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, * made after this point may be overwritten when the script is next run. */ -void ERR_load_X509V3_strings(void); +int ERR_load_X509V3_strings(void); /* Error codes for the X509V3 functions. */ diff --git a/ssl/ssl_err.c b/ssl/ssl_err.c index aed91e3b00..f573633ac6 100644 --- a/ssl/ssl_err.c +++ b/ssl/ssl_err.c @@ -661,7 +661,7 @@ static ERR_STRING_DATA SSL_str_reasons[] = { #endif -void ERR_load_SSL_strings(void) +int ERR_load_SSL_strings(void) { #ifndef OPENSSL_NO_ERR @@ -670,4 +670,5 @@ void ERR_load_SSL_strings(void) ERR_load_strings(0, SSL_str_reasons); } #endif + return 1; } diff --git a/util/mkerr.pl b/util/mkerr.pl index 7d0797859f..79c8cfc31c 100644 --- a/util/mkerr.pl +++ b/util/mkerr.pl @@ -457,12 +457,12 @@ foreach $lib (keys %csrc) EOF if($static) { print OUT <<"EOF"; -${staticloader}void ERR_load_${lib}_strings(void); +${staticloader}int ERR_load_${lib}_strings(void); EOF } else { print OUT <<"EOF"; -${staticloader}void ERR_load_${lib}_strings(void); +${staticloader}int ERR_load_${lib}_strings(void); ${staticloader}void ERR_unload_${lib}_strings(void); ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line); # define ${lib}err(f,r) ERR_${lib}_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) @@ -652,7 +652,7 @@ if($static) { #endif -${staticloader}void ERR_load_${lib}_strings(void) +${staticloader}int ERR_load_${lib}_strings(void) { #ifndef OPENSSL_NO_ERR @@ -661,6 +661,7 @@ ${staticloader}void ERR_load_${lib}_strings(void) ERR_load_strings($load_errcode, ${lib}_str_reasons); } #endif + return 1; } EOF } else { @@ -680,7 +681,7 @@ static ERR_STRING_DATA ${lib}_lib_name[] = { static int ${lib}_lib_error_code = 0; static int ${lib}_error_init = 1; -${staticloader}void ERR_load_${lib}_strings(void) +${staticloader}int ERR_load_${lib}_strings(void) { if (${lib}_lib_error_code == 0) ${lib}_lib_error_code = ERR_get_next_error_library(); @@ -697,6 +698,7 @@ ${staticloader}void ERR_load_${lib}_strings(void) ERR_load_strings(0, ${lib}_lib_name); #endif } + return 1; } ${staticloader}void ERR_unload_${lib}_strings(void) -- 2.25.1