From 540ad3effb3e280cbec61900c7b724671ecc1ed2 Mon Sep 17 00:00:00 2001 From: jsing Date: Wed, 14 Feb 2018 17:08:44 +0000 Subject: [PATCH] Provide SSL_CTX_up_ref(). --- lib/libssl/Symbols.list | 1 + lib/libssl/ssl.h | 3 ++- lib/libssl/ssl_lib.c | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libssl/Symbols.list b/lib/libssl/Symbols.list index c91dff9e58c..e2862d62436 100644 --- a/lib/libssl/Symbols.list +++ b/lib/libssl/Symbols.list @@ -115,6 +115,7 @@ SSL_CTX_set_tmp_rsa_callback SSL_CTX_set_trust SSL_CTX_set_verify SSL_CTX_set_verify_depth +SSL_CTX_up_ref SSL_CTX_use_PrivateKey SSL_CTX_use_PrivateKey_ASN1 SSL_CTX_use_PrivateKey_file diff --git a/lib/libssl/ssl.h b/lib/libssl/ssl.h index 7768f0a80f9..51b8fdb3cca 100644 --- a/lib/libssl/ssl.h +++ b/lib/libssl/ssl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl.h,v 1.135 2018/02/14 16:16:10 jsing Exp $ */ +/* $OpenBSD: ssl.h,v 1.136 2018/02/14 17:08:44 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1208,6 +1208,7 @@ void BIO_ssl_shutdown(BIO *ssl_bio); int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); void SSL_CTX_free(SSL_CTX *); +int SSL_CTX_up_ref(SSL_CTX *ctx); long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); long SSL_CTX_get_timeout(const SSL_CTX *ctx); X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index 9e3ef907290..16f2b546379 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.173 2018/02/14 16:16:10 jsing Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.174 2018/02/14 17:08:44 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1964,6 +1964,13 @@ SSL_CTX_free(SSL_CTX *ctx) free(ctx); } +int +SSL_CTX_up_ref(SSL_CTX *ctx) +{ + int refs = CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX); + return ((refs > 1) ? 1 : 0); +} + void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb) { -- 2.20.1