Convert reference counts in crypto/
This change converts the reference counts in crypto/ to use
|CRYPTO_refcount_t|. The reference counts in |X509_PKEY| and |X509_INFO|
were never actually used and so were dropped.
Change-Id: I75d572cdac1f8c1083c482e29c9519282d7fd16c
Reviewed-on: https://boringssl-review.googlesource.com/4772
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/rsa/rsa.c b/crypto/rsa/rsa.c
index 5cc48ed..17059b0 100644
--- a/crypto/rsa/rsa.c
+++ b/crypto/rsa/rsa.c
@@ -121,7 +121,7 @@
return;
}
- if (CRYPTO_add(&rsa->references, -1, CRYPTO_LOCK_RSA) > 0) {
+ if (!CRYPTO_refcount_dec_and_test_zero(&rsa->references)) {
return;
}
@@ -150,7 +150,7 @@
}
int RSA_up_ref(RSA *rsa) {
- CRYPTO_add(&rsa->references, 1, CRYPTO_LOCK_RSA);
+ CRYPTO_refcount_inc(&rsa->references);
return 1;
}