summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/ssl/ssl_lib.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2015-12-03 21:18:48 +0000
committerjkim <jkim@FreeBSD.org>2015-12-03 21:18:48 +0000
commitfdc1215ebe5182b5e2cd7afb01377a6d2e5d5781 (patch)
tree96586bfb12cf0a48212a27e95bfcefd19843fef0 /crypto/openssl/ssl/ssl_lib.c
parent68a4f44cfaf14b23814241e38f291d7c61c65198 (diff)
downloadFreeBSD-src-fdc1215ebe5182b5e2cd7afb01377a6d2e5d5781.zip
FreeBSD-src-fdc1215ebe5182b5e2cd7afb01377a6d2e5d5781.tar.gz
Merge OpenSSL 1.0.1q.
Diffstat (limited to 'crypto/openssl/ssl/ssl_lib.c')
-rw-r--r--crypto/openssl/ssl/ssl_lib.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/openssl/ssl/ssl_lib.c b/crypto/openssl/ssl/ssl_lib.c
index e11746a..93d1cbe 100644
--- a/crypto/openssl/ssl/ssl_lib.c
+++ b/crypto/openssl/ssl/ssl_lib.c
@@ -307,6 +307,7 @@ SSL *SSL_new(SSL_CTX *ctx)
s->options = ctx->options;
s->mode = ctx->mode;
s->max_cert_list = ctx->max_cert_list;
+ s->references = 1;
if (ctx->cert != NULL) {
/*
@@ -375,7 +376,6 @@ SSL *SSL_new(SSL_CTX *ctx)
if (!s->method->ssl_new(s))
goto err;
- s->references = 1;
s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1;
SSL_clear(s);
@@ -3283,8 +3283,11 @@ EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
{
ssl_clear_hash_ctx(hash);
*hash = EVP_MD_CTX_create();
- if (md)
- EVP_DigestInit_ex(*hash, md, NULL);
+ if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
+ EVP_MD_CTX_destroy(*hash);
+ *hash = NULL;
+ return NULL;
+ }
return *hash;
}
OpenPOWER on IntegriCloud