projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix no-ocsp
[openssl.git]
/
crypto
/
engine
/
eng_table.c
diff --git
a/crypto/engine/eng_table.c
b/crypto/engine/eng_table.c
index 5fd00ddc2cc24f3ceff47ee743122c8cea0c9350..9648c0cb94881994fda163267bf8a811a4aed14d 100644
(file)
--- a/
crypto/engine/eng_table.c
+++ b/
crypto/engine/eng_table.c
@@
-58,7
+58,7
@@
#include "eng_int.h"
/* The type of the items in the table */
#include "eng_int.h"
/* The type of the items in the table */
-
typedef
struct st_engine_pile {
+struct st_engine_pile {
/* The 'nid' of this algorithm/mode */
int nid;
/* ENGINEs that implement this algorithm/mode. */
/* The 'nid' of this algorithm/mode */
int nid;
/* ENGINEs that implement this algorithm/mode. */
@@
-69,9
+69,7
@@
typedef struct st_engine_pile {
* Zero if 'sk' is newer than the cached 'funct', non-zero otherwise
*/
int uptodate;
* Zero if 'sk' is newer than the cached 'funct', non-zero otherwise
*/
int uptodate;
-} ENGINE_PILE;
-
-DECLARE_LHASH_OF(ENGINE_PILE);
+};
/* The type exposed in eng_int.h */
struct st_engine_table {
/* The type exposed in eng_int.h */
struct st_engine_table {
@@
-108,9
+106,6
@@
static int engine_pile_cmp(const ENGINE_PILE *a, const ENGINE_PILE *b)
return a->nid - b->nid;
}
return a->nid - b->nid;
}
-static IMPLEMENT_LHASH_HASH_FN(engine_pile, ENGINE_PILE)
-static IMPLEMENT_LHASH_COMP_FN(engine_pile, ENGINE_PILE)
-
static int int_table_check(ENGINE_TABLE **t, int create)
{
LHASH_OF(ENGINE_PILE) *lh;
static int int_table_check(ENGINE_TABLE **t, int create)
{
LHASH_OF(ENGINE_PILE) *lh;
@@
-119,7
+114,7
@@
static int int_table_check(ENGINE_TABLE **t, int create)
return 1;
if (!create)
return 0;
return 1;
if (!create)
return 0;
- if ((lh = lh_ENGINE_PILE_new()) == NULL)
+ if ((lh = lh_ENGINE_PILE_new(
engine_pile_hash, engine_pile_cmp
)) == NULL)
return 0;
*t = (ENGINE_TABLE *)lh;
return 1;
return 0;
*t = (ENGINE_TABLE *)lh;
return 1;
@@
-135,7
+130,7
@@
int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup,
{
int ret = 0, added = 0;
ENGINE_PILE tmplate, *fnd;
{
int ret = 0, added = 0;
ENGINE_PILE tmplate, *fnd;
- CRYPTO_
w_lock(CRYPTO_LOCK_ENGINE
);
+ CRYPTO_
THREAD_write_lock(global_engine_lock
);
if (!(*table))
added = 1;
if (!int_table_check(table, 1))
if (!(*table))
added = 1;
if (!int_table_check(table, 1))
@@
-160,7
+155,7
@@
int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup,
fnd->funct = NULL;
(void)lh_ENGINE_PILE_insert(&(*table)->piles, fnd);
}
fnd->funct = NULL;
(void)lh_ENGINE_PILE_insert(&(*table)->piles, fnd);
}
- /* A registration shouldn't add dupl
ci
ate entries */
+ /* A registration shouldn't add dupl
ic
ate entries */
(void)sk_ENGINE_delete_ptr(fnd->sk, e);
/*
* if 'setdefault', this ENGINE goes to the head of the list
(void)sk_ENGINE_delete_ptr(fnd->sk, e);
/*
* if 'setdefault', this ENGINE goes to the head of the list
@@
-184,11
+179,11
@@
int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup,
}
ret = 1;
end:
}
ret = 1;
end:
- CRYPTO_
w_unlock(CRYPTO_LOCK_ENGINE
);
+ CRYPTO_
THREAD_unlock(global_engine_lock
);
return ret;
}
return ret;
}
-static void int_unregister_cb
_doall_arg
(ENGINE_PILE *pile, ENGINE *e)
+static void int_unregister_cb(ENGINE_PILE *pile, ENGINE *e)
{
int n;
/* Iterate the 'c->sk' stack removing any occurrence of 'e' */
{
int n;
/* Iterate the 'c->sk' stack removing any occurrence of 'e' */
@@
-202,16
+197,14
@@
static void int_unregister_cb_doall_arg(ENGINE_PILE *pile, ENGINE *e)
}
}
}
}
-static IMPLEMENT_LHASH_DOALL_ARG_FN(int_unregister_cb, ENGINE_PILE, ENGINE)
+IMPLEMENT_LHASH_DOALL_ARG(ENGINE_PILE, ENGINE);
void engine_table_unregister(ENGINE_TABLE **table, ENGINE *e)
{
void engine_table_unregister(ENGINE_TABLE **table, ENGINE *e)
{
- CRYPTO_
w_lock(CRYPTO_LOCK_ENGINE
);
+ CRYPTO_
THREAD_write_lock(global_engine_lock
);
if (int_table_check(table, 0))
if (int_table_check(table, 0))
- lh_ENGINE_PILE_doall_arg(&(*table)->piles,
- LHASH_DOALL_ARG_FN(int_unregister_cb),
- ENGINE, e);
- CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
+ lh_ENGINE_PILE_doall_ENGINE(&(*table)->piles, int_unregister_cb, e);
+ CRYPTO_THREAD_unlock(global_engine_lock);
}
static void int_cleanup_cb_doall(ENGINE_PILE *p)
}
static void int_cleanup_cb_doall(ENGINE_PILE *p)
@@
-224,18
+217,15
@@
static void int_cleanup_cb_doall(ENGINE_PILE *p)
OPENSSL_free(p);
}
OPENSSL_free(p);
}
-static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE)
-
void engine_table_cleanup(ENGINE_TABLE **table)
{
void engine_table_cleanup(ENGINE_TABLE **table)
{
- CRYPTO_
w_lock(CRYPTO_LOCK_ENGINE
);
+ CRYPTO_
THREAD_write_lock(global_engine_lock
);
if (*table) {
if (*table) {
- lh_ENGINE_PILE_doall(&(*table)->piles,
- LHASH_DOALL_FN(int_cleanup_cb));
+ lh_ENGINE_PILE_doall(&(*table)->piles, int_cleanup_cb_doall);
lh_ENGINE_PILE_free(&(*table)->piles);
*table = NULL;
}
lh_ENGINE_PILE_free(&(*table)->piles);
*table = NULL;
}
- CRYPTO_
w_unlock(CRYPTO_LOCK_ENGINE
);
+ CRYPTO_
THREAD_unlock(global_engine_lock
);
}
/* return a functional reference for a given 'nid' */
}
/* return a functional reference for a given 'nid' */
@@
-258,7
+248,7
@@
ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,
return NULL;
}
ERR_set_mark();
return NULL;
}
ERR_set_mark();
- CRYPTO_
w_lock(CRYPTO_LOCK_ENGINE
);
+ CRYPTO_
THREAD_write_lock(global_engine_lock
);
/*
* Check again inside the lock otherwise we could race against cleanup
* operations. But don't worry about a fprintf(stderr).
/*
* Check again inside the lock otherwise we could race against cleanup
* operations. But don't worry about a fprintf(stderr).
@@
-329,7
+319,7
@@
ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,
fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, caching "
"'no matching ENGINE'\n", f, l, nid);
#endif
fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, caching "
"'no matching ENGINE'\n", f, l, nid);
#endif
- CRYPTO_
w_unlock(CRYPTO_LOCK_ENGINE
);
+ CRYPTO_
THREAD_unlock(global_engine_lock
);
/*
* Whatever happened, any failed init()s are not failures in this
* context, so clear our error state.
/*
* Whatever happened, any failed init()s are not failures in this
* context, so clear our error state.
@@
-340,12
+330,12
@@
ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,
/* Table enumeration */
/* Table enumeration */
-static void int_
cb_doall_arg(
ENGINE_PILE *pile, ENGINE_PILE_DOALL *dall)
+static void int_
dall(const
ENGINE_PILE *pile, ENGINE_PILE_DOALL *dall)
{
dall->cb(pile->nid, pile->sk, pile->funct, dall->arg);
}
{
dall->cb(pile->nid, pile->sk, pile->funct, dall->arg);
}
-static IMPLEMENT_LHASH_DOALL_ARG_FN(int_cb, ENGINE_PILE, ENGINE_PILE_DOALL)
+IMPLEMENT_LHASH_DOALL_ARG_CONST(ENGINE_PILE, ENGINE_PILE_DOALL);
void engine_table_doall(ENGINE_TABLE *table, engine_table_doall_cb *cb,
void *arg)
void engine_table_doall(ENGINE_TABLE *table, engine_table_doall_cb *cb,
void *arg)
@@
-354,7
+344,5
@@
void engine_table_doall(ENGINE_TABLE *table, engine_table_doall_cb *cb,
dall.cb = cb;
dall.arg = arg;
if (table)
dall.cb = cb;
dall.arg = arg;
if (table)
- lh_ENGINE_PILE_doall_arg(&table->piles,
- LHASH_DOALL_ARG_FN(int_cb),
- ENGINE_PILE_DOALL, &dall);
+ lh_ENGINE_PILE_doall_ENGINE_PILE_DOALL(&table->piles, int_dall, &dall);
}
}