summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2016-08-03 15:15:20 -0400
committerRich Salz <rsalz@openssl.org>2016-08-04 14:23:08 -0400
commit412c8507ee61aeb1fcac4b6e84cd7e6501789124 (patch)
tree645b9f9579c5e8b8f78da4b53a92e3d44f641526
parent20fc103f782bb0bcd41d211c6423187b02146b9d (diff)
Remove "lockit" from internal error-hash function
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1389)
-rw-r--r--apps/errstr.c13
-rw-r--r--crypto/err/err.c29
-rw-r--r--include/openssl/err.h2
-rw-r--r--util/libcrypto.num1
4 files changed, 8 insertions, 37 deletions
diff --git a/apps/errstr.c b/apps/errstr.c
index ae7acf52f8..5fda799d14 100644
--- a/apps/errstr.c
+++ b/apps/errstr.c
@@ -17,16 +17,13 @@
#include <openssl/ssl.h>
typedef enum OPTION_choice {
- OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
- OPT_STATS
+ OPT_ERR = -1, OPT_EOF = 0, OPT_HELP
} OPTION_CHOICE;
OPTIONS errstr_options[] = {
{OPT_HELP_STR, 1, '-', "Usage: %s [options] errnum...\n"},
{OPT_HELP_STR, 1, '-', " errnum Error number\n"},
{"help", OPT_HELP, '-', "Display this summary"},
- {"stats", OPT_STATS, '-',
- "Print internal hashtable statistics (long!)"},
{NULL}
};
@@ -48,14 +45,6 @@ int errstr_main(int argc, char **argv)
opt_help(errstr_options);
ret = 0;
goto end;
- case OPT_STATS:
- lh_ERR_STRING_DATA_node_stats_bio(ERR_get_string_table(),
- bio_out);
- lh_ERR_STRING_DATA_stats_bio(ERR_get_string_table(), bio_out);
- lh_ERR_STRING_DATA_node_usage_stats_bio(ERR_get_string_table(),
- bio_out);
- ret = 0;
- goto end;
}
}
diff --git a/crypto/err/err.c b/crypto/err/err.c
index dc721c2e08..eac2025fd5 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -126,7 +126,7 @@ static CRYPTO_ONCE err_string_init = CRYPTO_ONCE_STATIC_INIT;
static CRYPTO_RWLOCK *err_string_lock;
/* Predeclarations of the "err_defaults" functions */
-static LHASH_OF(ERR_STRING_DATA) *get_hash(int create, int lockit);
+static LHASH_OF(ERR_STRING_DATA) *get_hash(int create);
static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *);
/*
@@ -155,22 +155,12 @@ static int err_string_data_cmp(const ERR_STRING_DATA *a,
return (int)(a->error - b->error);
}
-static LHASH_OF(ERR_STRING_DATA) *get_hash(int create, int lockit)
+static LHASH_OF(ERR_STRING_DATA) *get_hash(int create)
{
- LHASH_OF(ERR_STRING_DATA) *ret = NULL;
-
- if (lockit)
- CRYPTO_THREAD_write_lock(err_string_lock);
- if (!int_error_hash && create) {
+ if (int_error_hash == NULL && create)
int_error_hash = lh_ERR_STRING_DATA_new(err_string_data_hash,
err_string_data_cmp);
- }
- if (int_error_hash != NULL)
- ret = int_error_hash;
- if (lockit)
- CRYPTO_THREAD_unlock(err_string_lock);
-
- return ret;
+ return int_error_hash;
}
static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d)
@@ -179,7 +169,7 @@ static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *d)
LHASH_OF(ERR_STRING_DATA) *hash;
CRYPTO_THREAD_read_lock(err_string_lock);
- hash = get_hash(0, 0);
+ hash = get_hash(0);
if (hash)
p = lh_ERR_STRING_DATA_retrieve(hash, d);
CRYPTO_THREAD_unlock(err_string_lock);
@@ -303,7 +293,7 @@ static void err_load_strings(int lib, ERR_STRING_DATA *str)
LHASH_OF(ERR_STRING_DATA) *hash;
CRYPTO_THREAD_write_lock(err_string_lock);
- hash = get_hash(1, 0);
+ hash = get_hash(1);
if (hash) {
for (; str->error; str++) {
if (lib)
@@ -330,7 +320,7 @@ int ERR_unload_strings(int lib, ERR_STRING_DATA *str)
return 0;
CRYPTO_THREAD_write_lock(err_string_lock);
- hash = get_hash(0, 0);
+ hash = get_hash(0);
if (hash) {
for (; str->error; str++) {
if (lib)
@@ -582,11 +572,6 @@ char *ERR_error_string(unsigned long e, char *ret)
return ret;
}
-LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void)
-{
- return get_hash(0, 1);
-}
-
const char *ERR_lib_error_string(unsigned long e)
{
ERR_STRING_DATA d, *p;
diff --git a/include/openssl/err.h b/include/openssl/err.h
index d98c9cd340..fdffd66db0 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -245,8 +245,6 @@ DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *))
DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid))
ERR_STATE *ERR_get_state(void);
-LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void);
-
int ERR_get_next_error_library(void);
int ERR_set_mark(void);
diff --git a/util/libcrypto.num b/util/libcrypto.num
index 0954a48345..e4c16b195b 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -1800,7 +1800,6 @@ EVP_PKEY_meth_get_verify_recover 1785 1_1_0 EXIST::FUNCTION:
NAME_CONSTRAINTS_check 1786 1_1_0 EXIST::FUNCTION:
X509_CERT_AUX_it 1787 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
X509_CERT_AUX_it 1787 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
-ERR_get_string_table 1788 1_1_0 EXIST::FUNCTION:
X509_get_X509_PUBKEY 1789 1_1_0 EXIST::FUNCTION:
TXT_DB_create_index 1790 1_1_0 EXIST::FUNCTION:
RAND_set_rand_engine 1791 1_1_0 EXIST::FUNCTION:ENGINE