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.
This commit is contained in:
Geoff Thorpe
2001-08-25 17:24:21 +00:00
parent e7cf7fcd21
commit 5cbc2e8bc1
6 changed files with 54 additions and 1 deletions

View File

@@ -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;