summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2001-09-01 20:02:13 +0000
committerGeoff Thorpe <geoff@openssl.org>2001-09-01 20:02:13 +0000
commit79aa04ef27f69a1149d4d0e72d2d2953b6241ef0 (patch)
tree28eb317ea6bcd7f391cffe2fe694e92224ce1ff8 /crypto/dh
parent3a0799977bcb154d044828e96a25a01eb478de51 (diff)
Make the necessary changes to work with the recent "ex_data" overhaul.
See the commit log message for that for more information. NB: X509_STORE_CTX's use of "ex_data" support was actually misimplemented (initialisation by "memset" won't/can't/doesn't work). This fixes that but requires that X509_STORE_CTX_init() be able to handle errors - so its prototype has been changed to return 'int' rather than 'void'. All uses of that function throughout the source code have been tracked down and adjusted.
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_lib.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index f96b454757..7c304615bf 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -65,8 +65,6 @@
const char *DH_version="Diffie-Hellman" OPENSSL_VERSION_PTEXT;
static const DH_METHOD *default_DH_method = NULL;
-static int dh_meth_num = 0;
-static STACK_OF(CRYPTO_EX_DATA_FUNCS) *dh_meth = NULL;
void DH_set_default_openssl_method(const DH_METHOD *meth)
{
@@ -174,10 +172,10 @@ DH *DH_new_method(ENGINE *engine)
ret->method_mont_p=NULL;
ret->references = 1;
ret->flags=meth->flags;
- CRYPTO_new_ex_data(dh_meth,ret,&ret->ex_data);
+ CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data);
if ((meth->init != NULL) && !meth->init(ret))
{
- CRYPTO_free_ex_data(dh_meth,ret,&ret->ex_data);
+ CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data);
OPENSSL_free(ret);
ret=NULL;
}
@@ -206,7 +204,7 @@ void DH_free(DH *r)
if(meth->finish) meth->finish(r);
ENGINE_finish(r->engine);
- CRYPTO_free_ex_data(dh_meth, r, &r->ex_data);
+ CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data);
if (r->p != NULL) BN_clear_free(r->p);
if (r->g != NULL) BN_clear_free(r->g);
@@ -238,10 +236,8 @@ int DH_up(DH *r)
int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
- if(CRYPTO_get_ex_new_index(dh_meth_num, &dh_meth, argl, argp,
- new_func, dup_func, free_func) < 0)
- return -1;
- return (dh_meth_num++);
+ return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, argl, argp,
+ new_func, dup_func, free_func);
}
int DH_set_ex_data(DH *d, int idx, void *arg)