diff options
-rw-r--r-- | crypto/err/err.c | 5 | ||||
-rw-r--r-- | crypto/err/err_data.h | 66 | ||||
-rw-r--r-- | crypto/err/err_data_generate.go | 4 | ||||
-rw-r--r-- | crypto/err/err_impl.c | 1 | ||||
-rw-r--r-- | crypto/lhash/make_macros.sh | 11 | ||||
-rw-r--r-- | include/openssl/lhash.h | 1 | ||||
-rw-r--r-- | include/openssl/lhash_macros.h | 40 |
7 files changed, 46 insertions, 82 deletions
diff --git a/crypto/err/err.c b/crypto/err/err.c index 6ca7f23b..144f1c36 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -778,6 +778,9 @@ int ERR_pop_to_mark(void) { void ERR_load_crypto_strings(void) {} -void ERR_free_strings(void) {} +void ERR_free_strings(void) { + err_fns_check(); + ERRFN(shutdown)(err_state_free); +} void ERR_load_BIO_strings(void) {} diff --git a/crypto/err/err_data.h b/crypto/err/err_data.h index 61323d44..2053ef54 100644 --- a/crypto/err/err_data.h +++ b/crypto/err/err_data.h @@ -18,39 +18,39 @@ #include <openssl/type_check.h> -OPENSSL_COMPILE_ASSERT(ERR_LIB_NONE == 1, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_SYS == 2, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_BN == 3, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_RSA == 4, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_DH == 5, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_EVP == 6, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_BUF == 7, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_OBJ == 8, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_PEM == 9, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_DSA == 10, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_X509 == 11, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_ASN1 == 12, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_CONF == 13, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_CRYPTO == 14, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_EC == 15, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_SSL == 16, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_BIO == 17, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_PKCS7 == 18, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_PKCS8 == 19, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_X509V3 == 20, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_RAND == 21, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_ENGINE == 22, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_OCSP == 23, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_UI == 24, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_COMP == 25, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_ECDSA == 26, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_ECDH == 27, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_HMAC == 28, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_DIGEST == 29, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_CIPHER == 30, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_USER == 31, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_LIB_HKDF == 32, library_values_changed); -OPENSSL_COMPILE_ASSERT(ERR_NUM_LIBS == 33, library_values_changed); +OPENSSL_COMPILE_ASSERT(ERR_LIB_NONE == 1, library_values_changed_1); +OPENSSL_COMPILE_ASSERT(ERR_LIB_SYS == 2, library_values_changed_2); +OPENSSL_COMPILE_ASSERT(ERR_LIB_BN == 3, library_values_changed_3); +OPENSSL_COMPILE_ASSERT(ERR_LIB_RSA == 4, library_values_changed_4); +OPENSSL_COMPILE_ASSERT(ERR_LIB_DH == 5, library_values_changed_5); +OPENSSL_COMPILE_ASSERT(ERR_LIB_EVP == 6, library_values_changed_6); +OPENSSL_COMPILE_ASSERT(ERR_LIB_BUF == 7, library_values_changed_7); +OPENSSL_COMPILE_ASSERT(ERR_LIB_OBJ == 8, library_values_changed_8); +OPENSSL_COMPILE_ASSERT(ERR_LIB_PEM == 9, library_values_changed_9); +OPENSSL_COMPILE_ASSERT(ERR_LIB_DSA == 10, library_values_changed_10); +OPENSSL_COMPILE_ASSERT(ERR_LIB_X509 == 11, library_values_changed_11); +OPENSSL_COMPILE_ASSERT(ERR_LIB_ASN1 == 12, library_values_changed_12); +OPENSSL_COMPILE_ASSERT(ERR_LIB_CONF == 13, library_values_changed_13); +OPENSSL_COMPILE_ASSERT(ERR_LIB_CRYPTO == 14, library_values_changed_14); +OPENSSL_COMPILE_ASSERT(ERR_LIB_EC == 15, library_values_changed_15); +OPENSSL_COMPILE_ASSERT(ERR_LIB_SSL == 16, library_values_changed_16); +OPENSSL_COMPILE_ASSERT(ERR_LIB_BIO == 17, library_values_changed_17); +OPENSSL_COMPILE_ASSERT(ERR_LIB_PKCS7 == 18, library_values_changed_18); +OPENSSL_COMPILE_ASSERT(ERR_LIB_PKCS8 == 19, library_values_changed_19); +OPENSSL_COMPILE_ASSERT(ERR_LIB_X509V3 == 20, library_values_changed_20); +OPENSSL_COMPILE_ASSERT(ERR_LIB_RAND == 21, library_values_changed_21); +OPENSSL_COMPILE_ASSERT(ERR_LIB_ENGINE == 22, library_values_changed_22); +OPENSSL_COMPILE_ASSERT(ERR_LIB_OCSP == 23, library_values_changed_23); +OPENSSL_COMPILE_ASSERT(ERR_LIB_UI == 24, library_values_changed_24); +OPENSSL_COMPILE_ASSERT(ERR_LIB_COMP == 25, library_values_changed_25); +OPENSSL_COMPILE_ASSERT(ERR_LIB_ECDSA == 26, library_values_changed_26); +OPENSSL_COMPILE_ASSERT(ERR_LIB_ECDH == 27, library_values_changed_27); +OPENSSL_COMPILE_ASSERT(ERR_LIB_HMAC == 28, library_values_changed_28); +OPENSSL_COMPILE_ASSERT(ERR_LIB_DIGEST == 29, library_values_changed_29); +OPENSSL_COMPILE_ASSERT(ERR_LIB_CIPHER == 30, library_values_changed_30); +OPENSSL_COMPILE_ASSERT(ERR_LIB_USER == 31, library_values_changed_31); +OPENSSL_COMPILE_ASSERT(ERR_LIB_HKDF == 32, library_values_changed_32); +OPENSSL_COMPILE_ASSERT(ERR_NUM_LIBS == 33, library_values_changed_num); static const uint32_t kFunctionValues[] = { 0xc3232b0, diff --git a/crypto/err/err_data_generate.go b/crypto/err/err_data_generate.go index c29c8ae8..925b45e4 100644 --- a/crypto/err/err_data_generate.go +++ b/crypto/err/err_data_generate.go @@ -272,9 +272,9 @@ func main() { `) for i, name := range libraryNames { - fmt.Fprintf(out, "OPENSSL_COMPILE_ASSERT(ERR_LIB_%s == %d, library_values_changed);\n", name, i+1) + fmt.Fprintf(out, "OPENSSL_COMPILE_ASSERT(ERR_LIB_%s == %d, library_values_changed_%d);\n", name, i+1, i+1) } - fmt.Fprintf(out, "OPENSSL_COMPILE_ASSERT(ERR_NUM_LIBS == %d, library_values_changed);\n", len(libraryNames) + 1) + fmt.Fprintf(out, "OPENSSL_COMPILE_ASSERT(ERR_NUM_LIBS == %d, library_values_changed_num);\n", len(libraryNames) + 1) out.WriteString("\n") e.functions.WriteTo(out, "Function") diff --git a/crypto/err/err_impl.c b/crypto/err/err_impl.c index 0c36f82e..5eb75b70 100644 --- a/crypto/err/err_impl.c +++ b/crypto/err/err_impl.c @@ -116,7 +116,6 @@ DEFINE_LHASH_OF(ERR_STATE); -DEFINE_LHASH_OF(ERR_STRING_DATA); /* state_hash is a map from thread ID to ERR_STATE. It works like thread-local * storage. */ diff --git a/crypto/lhash/make_macros.sh b/crypto/lhash/make_macros.sh index 79d1e57d..8a876af3 100644 --- a/crypto/lhash/make_macros.sh +++ b/crypto/lhash/make_macros.sh @@ -1,6 +1,9 @@ #!/bin/sh -cat > lhash_macros.h << EOF +include_dir=../../include/openssl +out=${include_dir}/lhash_macros.h + +cat > $out << EOF /* Copyright (c) 2014, Google Inc. * * Permission to use, copy, modify, and/or distribute this software for any @@ -24,7 +27,7 @@ EOF output_lhash () { type=$1 - cat >> lhash_macros.h << EOF + cat >> $out << EOF /* ${type} */ #define lh_${type}_new(hash, comp)\\ ((LHASH_OF(${type})*) lh_new(CHECKED_CAST(lhash_hash_func, uint32_t (*) (const ${type} *), hash), CHECKED_CAST(lhash_cmp_func, int (*) (const ${type} *a, const ${type} *b), comp))) @@ -54,11 +57,11 @@ output_lhash () { EOF } -lhash_types=$(cat lhash.h | grep '^ \* LHASH_OF:' | sed -e 's/.*LHASH_OF://' -e 's/ .*//') +lhash_types=$(cat ${include_dir}/lhash.h | grep '^ \* LHASH_OF:' | sed -e 's/.*LHASH_OF://' -e 's/ .*//') for type in $lhash_types; do echo Hash of ${type} output_lhash "${type}" done -clang-format -i lhash_macros.h +clang-format -i $out diff --git a/include/openssl/lhash.h b/include/openssl/lhash.h index c8628d1e..96c49661 100644 --- a/include/openssl/lhash.h +++ b/include/openssl/lhash.h @@ -97,7 +97,6 @@ extern "C" { * LHASH_OF:ASN1_OBJECT * LHASH_OF:CONF_VALUE * LHASH_OF:ERR_STATE - * LHASH_OF:ERR_STRING_DATA * LHASH_OF:EX_CLASS_ITEM * LHASH_OF:SSL_SESSION */ diff --git a/include/openssl/lhash_macros.h b/include/openssl/lhash_macros.h index f84b5edd..9f20e4bf 100644 --- a/include/openssl/lhash_macros.h +++ b/include/openssl/lhash_macros.h @@ -128,46 +128,6 @@ void (*)(ERR_STATE *, void *), func), \ arg); -/* ERR_STRING_DATA */ -#define lh_ERR_STRING_DATA_new(hash, comp) \ - ((LHASH_OF(ERR_STRING_DATA) *)lh_new( \ - CHECKED_CAST(lhash_hash_func, uint32_t (*)(const ERR_STRING_DATA *), \ - hash), \ - CHECKED_CAST( \ - lhash_cmp_func, \ - int (*)(const ERR_STRING_DATA *a, const ERR_STRING_DATA *b), comp))) - -#define lh_ERR_STRING_DATA_free(lh) \ - lh_free(CHECKED_CAST(_LHASH *, LHASH_OF(ERR_STRING_DATA) *, lh)); - -#define lh_ERR_STRING_DATA_num_items(lh) \ - lh_num_items(CHECKED_CAST(_LHASH *, LHASH_OF(ERR_STRING_DATA) *, lh)) - -#define lh_ERR_STRING_DATA_retrieve(lh, data) \ - ((ERR_STRING_DATA *)lh_retrieve( \ - CHECKED_CAST(_LHASH *, LHASH_OF(ERR_STRING_DATA) *, lh), \ - CHECKED_CAST(void *, ERR_STRING_DATA *, data))) - -#define lh_ERR_STRING_DATA_insert(lh, old_data, data) \ - lh_insert(CHECKED_CAST(_LHASH *, LHASH_OF(ERR_STRING_DATA) *, lh), \ - CHECKED_CAST(void **, ERR_STRING_DATA **, old_data), \ - CHECKED_CAST(void *, ERR_STRING_DATA *, data)) - -#define lh_ERR_STRING_DATA_delete(lh, data) \ - ((ERR_STRING_DATA *)lh_delete( \ - CHECKED_CAST(_LHASH *, LHASH_OF(ERR_STRING_DATA) *, lh), \ - CHECKED_CAST(void *, ERR_STRING_DATA *, data))) - -#define lh_ERR_STRING_DATA_doall(lh, func) \ - lh_doall(CHECKED_CAST(_LHASH *, LHASH_OF(ERR_STRING_DATA) *, lh), \ - CHECKED_CAST(void (*)(void *), void (*)(ERR_STRING_DATA *), func)); - -#define lh_ERR_STRING_DATA_doall_arg(lh, func, arg) \ - lh_doall_arg(CHECKED_CAST(_LHASH *, LHASH_OF(ERR_STRING_DATA) *, lh), \ - CHECKED_CAST(void (*)(void *, void *), \ - void (*)(ERR_STRING_DATA *, void *), func), \ - arg); - /* EX_CLASS_ITEM */ #define lh_EX_CLASS_ITEM_new(hash, comp) \ ((LHASH_OF(EX_CLASS_ITEM) *)lh_new( \ |