Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 6 Jan 2019 10:39:50 -0500
From: Jeffrey Walton <>
To: Niels Möller <>
Subject: Re: Asserts considered harmful (or GMP spills its sensitive information)

On Sun, Jan 6, 2019 at 5:31 AM Niels Möller <> wrote:
> (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

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 should work well:

    BAD_OPT=`echo $CFLAGS | $EGREP -c '\-DNDEBUG`
    if test "$BAD_OPT" != "0"; then
        AC_MSG_ERROR (...)

And as a safety net, maybe something in the source code like:

    #if defined(NDEBUG) || defined(_NDEBUG)
    # error NDEBUG is not supported

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, .

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.


Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.