chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.85k stars 1.2k forks source link

OpenSSL `options` type is too small for some newer flags on Windows #1250

Closed rcombs closed 1 year ago

rcombs commented 1 year ago

Currently, asio::ssl::context_base::options has type long: https://github.com/chriskohlhoff/asio/blob/1408e2895c94c8e254e9e8ddd66ba083777f0dc2/asio/include/asio/ssl/context_base.hpp#L108

On older OpenSSL (pre-3.x), the actual type accepted by SSL_CTX_set_options was unsigned long. On 3.0.0 and later, the type is uint64_t. SSL_OP_CRYPTOPRO_TLSEXT_BUG (0x80000000U, potentially problematic for a signed 32-bit long) exists even pre-3.x (and is part of SSL_OP_ALL!), and on 3.0.0, there are option bits (e.g. SSL_OP_NO_TX_CERTIFICATE_COMPRESSION) that exceed 32 bits. This type should be changed to a value matching the built-against OpenSSL version, or to uint64_t with a range check in the set_options function for versions prior to 3.x.

vinipsmaker commented 1 year ago

Fix landed in master: https://github.com/chriskohlhoff/asio/commit/b9071e4c7414be85bb12ebb17ab477a7f38e2268

Please, close the issue.