diff options
author | Adam Langley <agl@google.com> | 2015-05-11 17:20:37 -0700 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2015-05-12 23:06:14 +0000 |
commit | e9ada863a7b3e81f5d2b1e3bdd2305da902a87f5 (patch) | |
tree | 6e43e34595ecf887c26c32b86d8ab097fe8cac64 /src/crypto/dh/dh.c | |
parent | b3106a0cc1493bbe0505c0ec0ce3da4ca90a29ae (diff) | |
download | external_boringssl-e9ada863a7b3e81f5d2b1e3bdd2305da902a87f5.zip external_boringssl-e9ada863a7b3e81f5d2b1e3bdd2305da902a87f5.tar.gz external_boringssl-e9ada863a7b3e81f5d2b1e3bdd2305da902a87f5.tar.bz2 |
external/boringssl: bump revision.
This change bumps the BoringSSL revision to the current tip-of-tree.
Change-Id: I91d5bf467e16e8d86cb19a4de873985f524e5faa
Diffstat (limited to 'src/crypto/dh/dh.c')
-rw-r--r-- | src/crypto/dh/dh.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/crypto/dh/dh.c b/src/crypto/dh/dh.c index 7a50da7..ab7ed8b 100644 --- a/src/crypto/dh/dh.c +++ b/src/crypto/dh/dh.c @@ -66,10 +66,13 @@ #include <openssl/thread.h> #include "internal.h" +#include "../internal.h" extern const DH_METHOD DH_default_method; +static CRYPTO_EX_DATA_CLASS g_ex_data_class = CRYPTO_EX_DATA_CLASS_INIT; + DH *DH_new(void) { return DH_new_method(NULL); } DH *DH_new_method(const ENGINE *engine) { @@ -90,14 +93,16 @@ DH *DH_new_method(const ENGINE *engine) { } METHOD_ref(dh->meth); + CRYPTO_MUTEX_init(&dh->method_mont_p_lock); + dh->references = 1; - if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, dh, &dh->ex_data)) { + if (!CRYPTO_new_ex_data(&g_ex_data_class, dh, &dh->ex_data)) { OPENSSL_free(dh); return NULL; } if (dh->meth->init && !dh->meth->init(dh)) { - CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, dh, &dh->ex_data); + CRYPTO_free_ex_data(&g_ex_data_class, dh, &dh->ex_data); METHOD_unref(dh->meth); OPENSSL_free(dh); return NULL; @@ -120,7 +125,7 @@ void DH_free(DH *dh) { } METHOD_unref(dh->meth); - CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, dh, &dh->ex_data); + CRYPTO_free_ex_data(&g_ex_data_class, dh, &dh->ex_data); if (dh->method_mont_p) BN_MONT_CTX_free(dh->method_mont_p); if (dh->p != NULL) BN_clear_free(dh->p); @@ -131,6 +136,7 @@ void DH_free(DH *dh) { if (dh->counter != NULL) BN_clear_free(dh->counter); if (dh->pub_key != NULL) BN_clear_free(dh->pub_key); if (dh->priv_key != NULL) BN_clear_free(dh->priv_key); + CRYPTO_MUTEX_cleanup(&dh->method_mont_p_lock); OPENSSL_free(dh); } @@ -173,9 +179,7 @@ static int int_dh_bn_cpy(BIGNUM **dst, const BIGNUM *src) { } } - if (*dst) { - BN_free(*dst); - } + BN_free(*dst); *dst = a; return 1; } @@ -198,11 +202,10 @@ static int int_dh_param_copy(DH *to, const DH *from, int is_x942) { return 0; } - if (to->seed) { - OPENSSL_free(to->seed); - to->seed = NULL; - to->seedlen = 0; - } + OPENSSL_free(to->seed); + to->seed = NULL; + to->seedlen = 0; + if (from->seed) { to->seed = BUF_memdup(from->seed, from->seedlen); if (!to->seed) { @@ -230,8 +233,12 @@ DH *DHparams_dup(const DH *dh) { 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) { - return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, argl, argp, new_func, - dup_func, free_func); + int index; + if (!CRYPTO_get_ex_new_index(&g_ex_data_class, &index, argl, argp, new_func, + dup_func, free_func)) { + return -1; + } + return index; } int DH_set_ex_data(DH *d, int idx, void *arg) { |