oss-sec mailing list archives
Re: Asserts considered harmful (or GMP spills its sensitive information)
From: Jeffrey Walton <noloader () gmail com>
Date: Sun, 6 Jan 2019 10:39:50 -0500
On Sun, Jan 6, 2019 at 5:31 AM Niels Möller <nisse () lysator liu se> wrote:
tg () gmplib org (Torbjörn Granlund) writes:Let's move on. No bug to be found here.Just FYI: There was a bug in Nettle's test code, a line assert (mpz_invert(key->d, pub->e, phi)); Obviously not working with -DNDEBUG. Fix in commit https://git.lysator.liu.se/nettle/nettle/commit/73d3c6d5586cc0fd81eab081078144d621de07b4
A small suggestion to remove the sharp edge. If using -DNDEBUG is not supported, then fail configure when it is present. Something like the following in configure.ac should work well: BAD_OPT=`echo $CFLAGS | $EGREP -c '\-DNDEBUG` if test "$BAD_OPT" != "0"; then AC_MSG_ERROR (...) fi And as a safety net, maybe something in the source code like: #if defined(NDEBUG) || defined(_NDEBUG) # error NDEBUG is not supported #endif There are two reasons for the suggestion. First, RTFM does not work. If it was going to work, then it should have happened in the last 50 years or so. Gutmann provides the user psychology behind it in his Security Engineering book, https://www.cs.auckland.ac.nz/~pgut001/pubs/book.pdf . Second, folks who have a Windows programming background use -NDEBUG. It is a standard practice and not a one-off problem. The issue should surface again for two use cases. First, Windows programmers working on Unix and Linux. Second, Windows programmers who are porting projects to Windows. Jeff
Current thread:
- Re: Re: Asserts considered harmful (or GMP spills its sensitive information), (continued)
- Re: Re: Asserts considered harmful (or GMP spills its sensitive information) Simon McVittie (Jan 01)
- Re: Re: Asserts considered harmful (or GMP spills its sensitive information) halfdog (Jan 01)
- Re: Re: Asserts considered harmful (or GMP spills its sensitive information) Jeffrey Walton (Jan 02)
- Re: Re: Asserts considered harmful (or GMP spills its sensitive information) halfdog (Jan 02)
- Re: Re: Asserts considered harmful (or GMP spills its sensitive information) Simon McVittie (Jan 01)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Vincent Lefevre (Jan 01)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Niels Möller (Jan 01)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Torbjörn Granlund (Jan 01)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Jeffrey Walton (Jan 01)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Jeffrey Walton (Jan 01)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Niels Möller (Jan 06)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Jeffrey Walton (Jan 06)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Niels Möller (Jan 01)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Jeffrey Walton (Jan 03)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Torbjörn Granlund (Jan 03)
- Re: Asserts considered harmful (or GMP spills its sensitive information) Jeffrey Walton (Jan 03)