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>
This commit is contained in:
Matt Caswell
2016-01-26 11:31:41 +00:00
parent 1bca5888da
commit a18a31e49d
6 changed files with 36 additions and 6 deletions

View File

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