summaryrefslogtreecommitdiffstats
path: root/crypto/rsa
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2016-01-30 12:04:25 -0500
committerRich Salz <rsalz@openssl.org>2016-02-11 12:40:32 -0500
commitf3f1cf8444f439c0be9de04bf3821a20d00fd956 (patch)
tree50d0fc624d4680e6cd734328126cd60a9dc128be /crypto/rsa
parent7823d792d0cad3b44ad5389a8d3381becefe7f44 (diff)
Move to REF_DEBUG, for consistency.
Add utility macros REF_ASSERT_NOT and REF_PRINT_COUNT This is also RT 4181 Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/rsa')
-rw-r--r--crypto/rsa/rsa_lib.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c
index 62b2854ecc..a8afb2cef7 100644
--- a/crypto/rsa/rsa_lib.c
+++ b/crypto/rsa/rsa_lib.c
@@ -183,17 +183,10 @@ void RSA_free(RSA *r)
return;
i = CRYPTO_add(&r->references, -1, CRYPTO_LOCK_RSA);
-#ifdef REF_PRINT
- REF_PRINT("RSA", r);
-#endif
+ REF_PRINT_COUNT("RSA", r);
if (i > 0)
return;
-#ifdef REF_CHECK
- if (i < 0) {
- fprintf(stderr, "RSA_free, bad reference count\n");
- abort();
- }
-#endif
+ REF_ASSERT_ISNT(i < 0);
if (r->meth->finish)
r->meth->finish(r);
@@ -221,15 +214,9 @@ void RSA_free(RSA *r)
int RSA_up_ref(RSA *r)
{
int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA);
-#ifdef REF_PRINT
- REF_PRINT("RSA", r);
-#endif
-#ifdef REF_CHECK
- if (i < 2) {
- fprintf(stderr, "RSA_up_ref, bad reference count\n");
- abort();
- }
-#endif
+
+ REF_PRINT_COUNT("RSA", r);
+ REF_ASSERT_ISNT(i < 2);
return ((i > 1) ? 1 : 0);
}