diff options
Diffstat (limited to 'boost/asio/ssl/context.hpp')
-rw-r--r-- | boost/asio/ssl/context.hpp | 93 |
1 files changed, 32 insertions, 61 deletions
diff --git a/boost/asio/ssl/context.hpp b/boost/asio/ssl/context.hpp index 8bab40ab3e..6869c0f011 100644 --- a/boost/asio/ssl/context.hpp +++ b/boost/asio/ssl/context.hpp @@ -17,20 +17,15 @@ #include <boost/asio/detail/config.hpp> -#if defined(BOOST_ASIO_ENABLE_OLD_SSL) -# include <boost/asio/ssl/basic_context.hpp> -# include <boost/asio/ssl/context_service.hpp> -#else // defined(BOOST_ASIO_ENABLE_OLD_SSL) -# include <string> -# include <boost/asio/buffer.hpp> -# include <boost/asio/io_service.hpp> -# include <boost/asio/ssl/context_base.hpp> -# include <boost/asio/ssl/detail/openssl_types.hpp> -# include <boost/asio/ssl/detail/openssl_init.hpp> -# include <boost/asio/ssl/detail/password_callback.hpp> -# include <boost/asio/ssl/detail/verify_callback.hpp> -# include <boost/asio/ssl/verify_mode.hpp> -#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL) +#include <string> +#include <boost/asio/buffer.hpp> +#include <boost/asio/io_context.hpp> +#include <boost/asio/ssl/context_base.hpp> +#include <boost/asio/ssl/detail/openssl_types.hpp> +#include <boost/asio/ssl/detail/openssl_init.hpp> +#include <boost/asio/ssl/detail/password_callback.hpp> +#include <boost/asio/ssl/detail/verify_callback.hpp> +#include <boost/asio/ssl/verify_mode.hpp> #include <boost/asio/detail/push_options.hpp> @@ -38,13 +33,6 @@ namespace boost { namespace asio { namespace ssl { -#if defined(BOOST_ASIO_ENABLE_OLD_SSL) - -/// Typedef for the typical usage of context. -typedef basic_context<context_service> context; - -#else // defined(BOOST_ASIO_ENABLE_OLD_SSL) - class context : public context_base, private noncopyable @@ -53,15 +41,9 @@ public: /// The native handle type of the SSL context. typedef SSL_CTX* native_handle_type; - /// (Deprecated: Use native_handle_type.) The native type of the SSL context. - typedef SSL_CTX* impl_type; - /// Constructor. BOOST_ASIO_DECL explicit context(method m); - /// Deprecated constructor taking a reference to an io_service object. - BOOST_ASIO_DECL context(boost::asio::io_service&, method m); - #if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a context from another. /** @@ -101,15 +83,6 @@ public: */ BOOST_ASIO_DECL native_handle_type native_handle(); - /// (Deprecated: Use native_handle().) Get the underlying implementation in - /// the native type. - /** - * This function may be used to obtain the underlying implementation of the - * context. This is intended to allow access to context functionality that is - * not otherwise provided. - */ - BOOST_ASIO_DECL impl_type impl(); - /// Clear options on the context. /** * This function may be used to configure the SSL options used by the context. @@ -136,7 +109,7 @@ public: * * @note Calls @c SSL_CTX_clear_options. */ - BOOST_ASIO_DECL boost::system::error_code clear_options(options o, + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID clear_options(options o, boost::system::error_code& ec); /// Set options on the context. @@ -165,7 +138,7 @@ public: * * @note Calls @c SSL_CTX_set_options. */ - BOOST_ASIO_DECL boost::system::error_code set_options(options o, + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID set_options(options o, boost::system::error_code& ec); /// Set the peer verification mode. @@ -194,7 +167,7 @@ public: * * @note Calls @c SSL_CTX_set_verify. */ - BOOST_ASIO_DECL boost::system::error_code set_verify_mode( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID set_verify_mode( verify_mode v, boost::system::error_code& ec); /// Set the peer verification depth. @@ -223,7 +196,7 @@ public: * * @note Calls @c SSL_CTX_set_verify_depth. */ - BOOST_ASIO_DECL boost::system::error_code set_verify_depth( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID set_verify_depth( int depth, boost::system::error_code& ec); /// Set the callback used to verify peer certificates. @@ -266,7 +239,7 @@ public: * @note Calls @c SSL_CTX_set_verify. */ template <typename VerifyCallback> - boost::system::error_code set_verify_callback(VerifyCallback callback, + BOOST_ASIO_SYNC_OP_VOID set_verify_callback(VerifyCallback callback, boost::system::error_code& ec); /// Load a certification authority file for performing verification. @@ -295,7 +268,7 @@ public: * * @note Calls @c SSL_CTX_load_verify_locations. */ - BOOST_ASIO_DECL boost::system::error_code load_verify_file( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID load_verify_file( const std::string& filename, boost::system::error_code& ec); /// Add certification authority for performing verification. @@ -324,7 +297,7 @@ public: * * @note Calls @c SSL_CTX_get_cert_store and @c X509_STORE_add_cert. */ - BOOST_ASIO_DECL boost::system::error_code add_certificate_authority( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID add_certificate_authority( const const_buffer& ca, boost::system::error_code& ec); /// Configures the context to use the default directories for finding @@ -351,7 +324,7 @@ public: * * @note Calls @c SSL_CTX_set_default_verify_paths. */ - BOOST_ASIO_DECL boost::system::error_code set_default_verify_paths( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID set_default_verify_paths( boost::system::error_code& ec); /// Add a directory containing certificate authority files to be used for @@ -384,7 +357,7 @@ public: * * @note Calls @c SSL_CTX_load_verify_locations. */ - BOOST_ASIO_DECL boost::system::error_code add_verify_path( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID add_verify_path( const std::string& path, boost::system::error_code& ec); /// Use a certificate from a memory buffer. @@ -414,7 +387,7 @@ public: * * @note Calls @c SSL_CTX_use_certificate or SSL_CTX_use_certificate_ASN1. */ - BOOST_ASIO_DECL boost::system::error_code use_certificate( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_certificate( const const_buffer& certificate, file_format format, boost::system::error_code& ec); @@ -445,7 +418,7 @@ public: * * @note Calls @c SSL_CTX_use_certificate_file. */ - BOOST_ASIO_DECL boost::system::error_code use_certificate_file( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_certificate_file( const std::string& filename, file_format format, boost::system::error_code& ec); @@ -475,7 +448,7 @@ public: * * @note Calls @c SSL_CTX_use_certificate and SSL_CTX_add_extra_chain_cert. */ - BOOST_ASIO_DECL boost::system::error_code use_certificate_chain( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_certificate_chain( const const_buffer& chain, boost::system::error_code& ec); /// Use a certificate chain from a file. @@ -504,7 +477,7 @@ public: * * @note Calls @c SSL_CTX_use_certificate_chain_file. */ - BOOST_ASIO_DECL boost::system::error_code use_certificate_chain_file( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_certificate_chain_file( const std::string& filename, boost::system::error_code& ec); /// Use a private key from a memory buffer. @@ -534,7 +507,7 @@ public: * * @note Calls @c SSL_CTX_use_PrivateKey or SSL_CTX_use_PrivateKey_ASN1. */ - BOOST_ASIO_DECL boost::system::error_code use_private_key( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_private_key( const const_buffer& private_key, file_format format, boost::system::error_code& ec); @@ -565,7 +538,7 @@ public: * * @note Calls @c SSL_CTX_use_PrivateKey_file. */ - BOOST_ASIO_DECL boost::system::error_code use_private_key_file( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_private_key_file( const std::string& filename, file_format format, boost::system::error_code& ec); @@ -598,7 +571,7 @@ public: * * @note Calls @c SSL_CTX_use_RSAPrivateKey or SSL_CTX_use_RSAPrivateKey_ASN1. */ - BOOST_ASIO_DECL boost::system::error_code use_rsa_private_key( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_rsa_private_key( const const_buffer& private_key, file_format format, boost::system::error_code& ec); @@ -631,7 +604,7 @@ public: * * @note Calls @c SSL_CTX_use_RSAPrivateKey_file. */ - BOOST_ASIO_DECL boost::system::error_code use_rsa_private_key_file( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_rsa_private_key_file( const std::string& filename, file_format format, boost::system::error_code& ec); @@ -663,7 +636,7 @@ public: * * @note Calls @c SSL_CTX_set_tmp_dh. */ - BOOST_ASIO_DECL boost::system::error_code use_tmp_dh( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_tmp_dh( const const_buffer& dh, boost::system::error_code& ec); /// Use the specified file to obtain the temporary Diffie-Hellman parameters. @@ -692,7 +665,7 @@ public: * * @note Calls @c SSL_CTX_set_tmp_dh. */ - BOOST_ASIO_DECL boost::system::error_code use_tmp_dh_file( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID use_tmp_dh_file( const std::string& filename, boost::system::error_code& ec); /// Set the password callback. @@ -733,7 +706,7 @@ public: * @note Calls @c SSL_CTX_set_default_passwd_cb. */ template <typename PasswordCallback> - boost::system::error_code set_password_callback(PasswordCallback callback, + BOOST_ASIO_SYNC_OP_VOID set_password_callback(PasswordCallback callback, boost::system::error_code& ec); private: @@ -744,7 +717,7 @@ private: struct dh_cleanup; // Helper function used to set a peer certificate verification callback. - BOOST_ASIO_DECL boost::system::error_code do_set_verify_callback( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID do_set_verify_callback( detail::verify_callback_base* callback, boost::system::error_code& ec); // Callback used when the SSL implementation wants to verify a certificate. @@ -752,7 +725,7 @@ private: int preverified, X509_STORE_CTX* ctx); // Helper function used to set a password callback. - BOOST_ASIO_DECL boost::system::error_code do_set_password_callback( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID do_set_password_callback( detail::password_callback_base* callback, boost::system::error_code& ec); // Callback used when the SSL implementation wants a password. @@ -760,7 +733,7 @@ private: char* buf, int size, int purpose, void* data); // Helper function to set the temporary Diffie-Hellman parameters from a BIO. - BOOST_ASIO_DECL boost::system::error_code do_use_tmp_dh( + BOOST_ASIO_DECL BOOST_ASIO_SYNC_OP_VOID do_use_tmp_dh( BIO* bio, boost::system::error_code& ec); // Helper function to make a BIO from a memory buffer. @@ -773,8 +746,6 @@ private: boost::asio::ssl::detail::openssl_init<> init_; }; -#endif // defined(BOOST_ASIO_ENABLE_OLD_SSL) - } // namespace ssl } // namespace asio } // namespace boost |