boost开发常见问题

//参考
unsigned long ssl_options = boost::asio::ssl::context::default_workarounds
	| boost::asio::ssl::context::no_sslv2
	| boost::asio::ssl::context::single_dh_use;

if (!ssl_enable_v3)
	ssl_options |= boost::asio::ssl::context::no_sslv3;

ctx_.set_options(ssl_options);
ctx_.set_password_callback(std::forward(f));
ctx_.use_certificate_chain_file(std::move(certificate_chain_file));
ctx_.use_private_key_file(std::move(private_key_file), boost::asio::ssl::context::pem);
ctx_.use_tmp_dh_file(std::move(tmp_dh_file));



//server
context_.use_certificate_chain_file("server.crt"); 
context_.use_private_key_file("server.key", boost::asio::ssl::context::pem);
context_.use_tmp_dh_file("dh512.pem");



//client
ctx.load_verify_file("server.crt");

boost启用ssl后,什么都不干就会有内存泄露.

解决:

修改openssl的头文件 openssl\ssl.h

# define SSL_OP_NO_COMPRESSION 0x00020000L

将此行注释掉

is code

发表评论

电子邮件地址不会被公开。