From 2f545ae45d4b93649e40ff7f93e2c3e6ce3154ae Mon Sep 17 00:00:00 2001 From: Kurt Roeckx Date: Sat, 27 Aug 2016 16:01:08 +0200 Subject: Add support for reference counting using C11 atomics Reviewed-by: Andy Polyakov Reviewed-by: Rich Salz GH: #1500 --- crypto/evp/p_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crypto/evp') diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 9828620552..234d05f270 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -160,7 +160,7 @@ int EVP_PKEY_up_ref(EVP_PKEY *pkey) { int i; - if (CRYPTO_atomic_add(&pkey->references, 1, &i, pkey->lock) <= 0) + if (CRYPTO_UP_REF(&pkey->references, &i, pkey->lock) <= 0) return 0; REF_PRINT_COUNT("EVP_PKEY", pkey); @@ -392,7 +392,7 @@ void EVP_PKEY_free(EVP_PKEY *x) if (x == NULL) return; - CRYPTO_atomic_add(&x->references, -1, &i, x->lock); + CRYPTO_DOWN_REF(&x->references, &i, x->lock); REF_PRINT_COUNT("EVP_PKEY", x); if (i > 0) return; -- cgit v1.2.3