summaryrefslogtreecommitdiffstats
path: root/src/crypto/dh/dh.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/dh/dh.c')
-rw-r--r--src/crypto/dh/dh.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/crypto/dh/dh.c b/src/crypto/dh/dh.c
index ab7ed8b..96b85f3 100644
--- a/src/crypto/dh/dh.c
+++ b/src/crypto/dh/dh.c
@@ -116,7 +116,7 @@ void DH_free(DH *dh) {
return;
}
- if (CRYPTO_add(&dh->references, -1, CRYPTO_LOCK_DH) > 0) {
+ if (!CRYPTO_refcount_dec_and_test_zero(&dh->references)) {
return;
}
@@ -164,8 +164,10 @@ int DH_compute_key(unsigned char *out, const BIGNUM *peers_key, DH *dh) {
int DH_size(const DH *dh) { return BN_num_bytes(dh->p); }
-int DH_up_ref(DH *r) {
- CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DH);
+unsigned DH_num_bits(const DH *dh) { return BN_num_bits(dh->p); }
+
+int DH_up_ref(DH *dh) {
+ CRYPTO_refcount_inc(&dh->references);
return 1;
}