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 <noloader@...il.com>
To: Niels Möller <nisse@...ator.liu.se>
Cc: oss-security@...ts.openwall.com, gmp-bugs@...lib.org
Subject: Re: Asserts considered harmful (or GMP spills its sensitive information)

On Sun, Jan 6, 2019 at 5:31 AM Niels Möller <nisse@...ator.liu.se> wrote:
>
> tg@...lib.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

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.