From b857ffe62925f0d76d658177c26ab8c4c1340b95 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 15 Apr 2015 16:36:31 -0400 Subject: [PATCH] Remove CRYPTO_ex_data_new_class. It's unused and requires ex_data support a class number per type. Change-Id: Ie1fb55053631ef00c3318f3253f7c9501988f522 Reviewed-on: https://boringssl-review.googlesource.com/4371 Reviewed-by: Adam Langley --- crypto/ex_data.c | 12 ------------ include/openssl/ex_data.h | 18 +----------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/crypto/ex_data.c b/crypto/ex_data.c index 67021524..8f54a901 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -139,10 +139,6 @@ static struct CRYPTO_STATIC_MUTEX global_classes_lock = CRYPTO_STATIC_MUTEX_INIT; static LHASH_OF(EX_CLASS_ITEM) *global_classes = NULL; -static struct CRYPTO_STATIC_MUTEX global_next_class_lock = - CRYPTO_STATIC_MUTEX_INIT; -static int global_next_class = 100; - /* class_hash is a hash function used by an LHASH of |EX_CLASS_ITEM| * structures. */ static uint32_t class_hash(const EX_CLASS_ITEM *a) { @@ -319,14 +315,6 @@ static int get_func_pointers(STACK_OF(CRYPTO_EX_DATA_FUNCS) **out, return 1; } -int CRYPTO_ex_data_new_class(void) { - CRYPTO_STATIC_MUTEX_lock_write(&global_next_class_lock); - const int ret = global_next_class++; - CRYPTO_STATIC_MUTEX_unlock(&global_next_class_lock); - - return ret; -} - int CRYPTO_new_ex_data(int class_value, void *obj, CRYPTO_EX_DATA *ad) { STACK_OF(CRYPTO_EX_DATA_FUNCS) *func_pointers; size_t i; diff --git a/include/openssl/ex_data.h b/include/openssl/ex_data.h index 777eea87..abf96a3f 100644 --- a/include/openssl/ex_data.h +++ b/include/openssl/ex_data.h @@ -171,8 +171,7 @@ typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, * each class of object should provide a wrapper function that sets * |class_value| correctly. * - * The |class_value| argument should be one of |CRYPTO_EX_INDEX_*| or a - * user-defined class value returned from |CRYPTO_ex_data_new_class|. + * The |class_value| argument should be one of |CRYPTO_EX_INDEX_*|. * * See the descriptions of the callback typedefs for details of when they are * called. Any of the callback arguments may be NULL. The |argl| and |argp| @@ -209,8 +208,6 @@ OPENSSL_EXPORT int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int index, void *val); OPENSSL_EXPORT void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int index); /* CRYPTO_EX_INDEX_* are the built-in classes of objects. - * - * User defined classes start at 100. * * TODO(fork): WARNING: these are called "INDEX", but they aren't! */ enum { @@ -228,19 +225,6 @@ enum { }; -/* User-defined classes of objects. - * - * Core OpenSSL code has predefined class values given above (the - * |CRYPTO_EX_INDEX_*| values). It's possible to get dynamic class values - * assigned for user-defined objects. */ - -/* CRYPTO_ex_data_new_class returns a fresh class value for a user-defined type - * that wishes to use ex_data. - * - * TODO(fork): hopefully remove this. */ -OPENSSL_EXPORT int CRYPTO_ex_data_new_class(void); - - /* Embedding, allocating and freeing |CRYPTO_EX_DATA| structures for objects * that embed them. */