summaryrefslogtreecommitdiff
path: root/boost/asio/ssl/impl/context.ipp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/ssl/impl/context.ipp')
-rw-r--r--boost/asio/ssl/impl/context.ipp21
1 files changed, 12 insertions, 9 deletions
diff --git a/boost/asio/ssl/impl/context.ipp b/boost/asio/ssl/impl/context.ipp
index f50ce454ea..f35e43c2a6 100644
--- a/boost/asio/ssl/impl/context.ipp
+++ b/boost/asio/ssl/impl/context.ipp
@@ -3,7 +3,7 @@
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
-// Copyright (c) 2005-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2005-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -510,23 +510,26 @@ BOOST_ASIO_SYNC_OP_VOID context::add_certificate_authority(
bio_cleanup bio = { make_buffer_bio(ca) };
if (bio.p)
{
- x509_cleanup cert = { ::PEM_read_bio_X509(bio.p, 0, 0, 0) };
- if (cert.p)
+ if (X509_STORE* store = ::SSL_CTX_get_cert_store(handle_))
{
- if (X509_STORE* store = ::SSL_CTX_get_cert_store(handle_))
+ for (;;)
{
- if (::X509_STORE_add_cert(store, cert.p) == 1)
+ x509_cleanup cert = { ::PEM_read_bio_X509(bio.p, 0, 0, 0) };
+ if (!cert.p)
+ break;
+
+ if (::X509_STORE_add_cert(store, cert.p) != 1)
{
- ec = boost::system::error_code();
+ ec = boost::system::error_code(
+ static_cast<int>(::ERR_get_error()),
+ boost::asio::error::get_ssl_category());
BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
}
}
}
}
- ec = boost::system::error_code(
- static_cast<int>(::ERR_get_error()),
- boost::asio::error::get_ssl_category());
+ ec = boost::system::error_code();
BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
}