diff options
author | Matt Caswell <matt@openssl.org> | 2016-01-26 11:31:41 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-01-26 13:19:10 +0000 |
commit | a18a31e49d266b687f425c3c434a5aef1f719e38 (patch) | |
tree | f7d08fd63fcc76289537c8c357d2e38f0a900e89 /ssl/ssl_lib.c | |
parent | 1bca5888da944b00b7cc675d1d53a53da6d3da1a (diff) | |
download | openssl-a18a31e49d266b687f425c3c434a5aef1f719e38.tar.gz |
Add SSL_up_ref() and SSL_CTX_up_ref()
The SSL and SSL_CTX structures are reference counted. However since libssl
was made opaque there is no way for users of the library to manipulate the
reference counts. This adds functions to enable that.
Reviewed-by: Stephen Henson <steve@openssl.org>
Diffstat (limited to 'ssl/ssl_lib.c')
-rw-r--r-- | ssl/ssl_lib.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 7c99e8d7d4..d29da6dfbf 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -745,6 +745,11 @@ SSL *SSL_new(SSL_CTX *ctx) return (NULL); } +void SSL_up_ref(SSL *s) +{ + CRYPTO_add(&s->references, 1, CRYPTO_LOCK_SSL); +} + int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx, unsigned int sid_ctx_len) { @@ -2348,6 +2353,11 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth) return (NULL); } +void SSL_CTX_up_ref(SSL_CTX *ctx) +{ + CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX); +} + void SSL_CTX_free(SSL_CTX *a) { int i; |