#ssl configuration issue?

3 messages · Page 1 of 1 (latest)

severe wren
#

question I have some code setting up an ssl context for boost asio, and when I set the cipher list for http2 ciphers I sometimes get a segfault on exit, when I run the debugger and compile the binary with symbols I can see that the segfault is in pthread key delete in an openssl cleanup function
the following code is simplified to highlight the issue

inline ssl_context& get_ssl_context() 
    { 
        // designed to be a singleton ssl context
        static ssl_context ctx_(boost::asio::ssl::context::tls_client);
        static std::once_flag once_flag;
        std::call_once(once_flag, [&] {
            ctx_.set_default_verify_paths();
            // TODO: Change this to verify peer for deployment
            ctx_.set_verify_mode(boost::asio::ssl::verify_none);
            ctx_.set_options(
                boost::asio::ssl::context::default_workarounds |
                boost::asio::ssl::context::no_sslv2 |
                boost::asio::ssl::context::no_sslv3 |
                boost::asio::ssl::context::no_tlsv1 |
                boost::asio::ssl::context::no_tlsv1_1 |
                SSL_OP_NO_COMPRESSION
            );
            // if i comment the following line then the segfault doesn't ever occur on cleanup
            int ret = ::SSL_CTX_set_cipher_list(ctx_.native_handle(),
                                                    "ECDHE-RSA-CHACHA20-POLY1305"
                                                );
            
            if (ret != 1) {
                // If this is zero, OpenSSL rejected the cipher string.
                ERR_print_errors_fp(stderr);
            }
        });
        return ctx_; 
    }
    ```
surreal templeBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

severe wren
#

if the line is left uncommented then everything else seems to work fine until cleanup, and this happens with or without making network requests, and no errors seem to occur until the cleanup
anyone have any idea why this could be happening?