Boost C++ Libraries: Ticket #7209: Asio SSL overflow in constant https://svn.boost.org/trac10/ticket/7209 <p> Dear Chris, </p> <p> I am getting a warning about overflow in SSL context options. </p> <p> Environment: Ubuntu Quantal (development) boost trunk (also applies to 1.50 1.51, ...) Configured with: ../src/configure -v --with-pkgversion='<a class="missing wiki">Ubuntu/Linaro</a> 4.7.1-6ubuntu1' --with-bugurl=<a class="ext-link" href="file:///usr/share/doc/gcc-4.7/README.Bugs"><span class="icon">​</span>file:///usr/share/doc/gcc-4.7/README.Bugs</a> --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.1 (<a class="missing wiki">Ubuntu/Linaro</a> 4.7.1-6ubuntu1) </p> <pre class="wiki">In file included from /adnet/boost-1.50.0/include/boost/asio/ssl/context.hpp:26:0, from /adnet/boost-1.50.0/include/boost/asio/ssl.hpp:19, from /adnet/src/cttc-pce-trunk/apps/server/plugins/openflow/connection.cpp:12: /adnet/boost-1.50.0/include/boost/asio/ssl/context_base.hpp:92:42: warning: overflow in implicit constant conversion [-Woverflow] </pre><p> In context_base.hpp </p> <p> Note in /usr/include/openssl/ssl.h:564:23019: </p> <pre class="wiki">/* SSL_OP_ALL: various bug workarounds that should be rather harmless. * This used to be 0x000FFFFFL before 0.9.7. */ #define SSL_OP_ALL 0x80000BFFL </pre><p> the new value seems to overflow? </p> <p> could you please consider something in the lines of: </p> <pre class="wiki">--- /adnet/boost-trunk/boost/asio/ssl/context_base.hpp 2012-01-12 11:33:11.408503342 +0100 +++ /adnet/boost-1.50.0/include/boost/asio/ssl/context_base.hpp 2012-08-08 13:55:48.660086890 +0200 @@ -71,29 +71,29 @@ }; /// Bitmask type for SSL options. - typedef int options; + typedef long options; #if defined(GENERATING_DOCUMENTATION) /// Implement various bug workarounds. - static const int default_workarounds = implementation_defined; + static const long default_workarounds = implementation_defined; /// Always create a new key when using tmp_dh parameters. - static const int single_dh_use = implementation_defined; + static const long single_dh_use = implementation_defined; /// Disable SSL v2. - static const int no_sslv2 = implementation_defined; + static const long no_sslv2 = implementation_defined; /// Disable SSL v3. - static const int no_sslv3 = implementation_defined; + static const long no_sslv3 = implementation_defined; /// Disable TLS v1. - static const int no_tlsv1 = implementation_defined; + static const long no_tlsv1 = implementation_defined; #else - BOOST_STATIC_CONSTANT(int, default_workarounds = SSL_OP_ALL); - BOOST_STATIC_CONSTANT(int, single_dh_use = SSL_OP_SINGLE_DH_USE); - BOOST_STATIC_CONSTANT(int, no_sslv2 = SSL_OP_NO_SSLv2); - BOOST_STATIC_CONSTANT(int, no_sslv3 = SSL_OP_NO_SSLv3); - BOOST_STATIC_CONSTANT(int, no_tlsv1 = SSL_OP_NO_TLSv1); + BOOST_STATIC_CONSTANT(long, default_workarounds = SSL_OP_ALL); + BOOST_STATIC_CONSTANT(long, single_dh_use = SSL_OP_SINGLE_DH_USE); + BOOST_STATIC_CONSTANT(long, no_sslv2 = SSL_OP_NO_SSLv2); + BOOST_STATIC_CONSTANT(long, no_sslv3 = SSL_OP_NO_SSLv3); + BOOST_STATIC_CONSTANT(long, no_tlsv1 = SSL_OP_NO_TLSv1); #endif /// File format types. </pre><p> or, if you do not consider that a bug, silence the warning? </p> <p> note that SSL_CTX_set_options takes a long, if I am not mistaken </p> <p> Thanks in advance, Ramon </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7209 Trac 1.4.3 chris_kohlhoff Sun, 30 Dec 2012 23:17:22 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/7209#comment:1 https://svn.boost.org/trac10/ticket/7209#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/82290" title="Merge from trunk: * Fix some 64-to-32-bit conversion warnings. Fixes ...">[82290]</a>) Merge from trunk: </p> <ul><li>Fix some 64-to-32-bit conversion warnings. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7459" title="#7459: Bugs: warnings in boost::asio (closed: fixed)">#7459</a> </li></ul><ul><li>Fix typos in comments. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7761" title="#7761: Bugs: Minor comment typo in boost/asio/ssl/detail/stream_core.hpp (closed: fixed)">#7761</a> </li></ul><ul><li>Fix error in example embedded in basic_socket::get_option's documentation. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7562" title="#7562: Bugs: Old documentation for reading socket options (closed: fixed)">#7562</a> </li></ul><ul><li>Use long rather than int for SSL_CTX options, to match OpenSSL. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7209" title="#7209: Bugs: Asio SSL overflow in constant (closed: fixed)">#7209</a> </li></ul><ul><li>Use _snwprintf to address a compile error due to the changed swprintf signature in recent versions of MinGW. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7373" title="#7373: Bugs: Boost ASIO has a wrong swprintf interface definition for MinGW (closed: fixed)">#7373</a> </li></ul><ul><li>Fix deadlock that can occur on Windows when shutting down a pool of io_service threads due to running out of work. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7552" title="#7552: Bugs: win_iocp_io_service hangs due to a race condition (closed: fixed)">#7552</a> </li></ul><ul><li>Enable noexcept qualifier for error categories. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7797" title="#7797: Feature Requests: Add noexcept to conform with C++11 after #7278 (closed: fixed)">#7797</a> </li></ul><ul><li>Treat errors from accept as non-fatal. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7488" title="#7488: Bugs: Accept Errors (closed: fixed)">#7488</a> </li></ul><ul><li>Add a small block recycling optimisation. </li></ul><ul><li>Version bump. </li></ul><ul><li>Regenerate documentation. </li></ul> Ticket