summaryrefslogtreecommitdiffstats
path: root/crypto/dsa/dsa_lib.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2001-08-25 17:24:21 +0000
committerGeoff Thorpe <geoff@openssl.org>2001-08-25 17:24:21 +0000
commit5cbc2e8bc187058e2ec2f17f53c3429c16dbc0d8 (patch)
tree0a50486525b7a160cf7bc1cbccdb9fe76d295aaa /crypto/dsa/dsa_lib.c
parente7cf7fcd216e8680200b3e3f9feb112f8c5952f3 (diff)
Give DH, DSA, and RSA functions to "up" their reference counts. Otherwise,
dependant code has to directly increment the "references" value of each such structure using the corresponding lock. Apart from code duplication, this provided no "REF_CHECK/REF_PRINT" checking and violated encapsulation.
Diffstat (limited to 'crypto/dsa/dsa_lib.c')
-rw-r--r--crypto/dsa/dsa_lib.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c
index 5855568741..98878dfaa3 100644
--- a/crypto/dsa/dsa_lib.c
+++ b/crypto/dsa/dsa_lib.c
@@ -228,6 +228,22 @@ void DSA_free(DSA *r)
OPENSSL_free(r);
}
+int DSA_up(DSA *r)
+ {
+ int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DSA);
+#ifdef REF_PRINT
+ REF_PRINT("DSA",r);
+#endif
+#ifdef REF_CHECK
+ if (i < 2)
+ {
+ fprintf(stderr, "DSA_up, bad reference count\n");
+ abort();
+ }
+#endif
+ return ((i > 1) ? 1 : 0);
+ }
+
int DSA_size(const DSA *r)
{
int ret,i;