Re: nettle-stdint.h (was: Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize)

2019-01-30 Thread Dmitry Eremin-Solenikov
Hello,

ср, 23 янв. 2019 г. в 01:01, Niels Möller :
>
> Dmitry Eremin-Solenikov  writes:
>
> > This file needs just uint8_t/uint64_t, so it might be easier to fix gnutls
> > to just include  there. I'll open a MR.

I'm sorry for the delay. I've opened
https://gitlab.com/gnutls/gnutls/merge_requests/901 .

-- 
With best wishes
Dmitry
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2019-01-22 Thread Dmitry Eremin-Solenikov
Hello,

ср, 23 янв. 2019 г. в 00:45, Niels Möller :
>
> ni...@lysator.liu.se (Niels Möller) writes:
>
> > That said, I'm about to delete nettle-stdint.h, and require that the
> > compiler supplies a  (as was discussed quite a while ago).
>
> I've now merged changes to do that to the master-updates branch. It
> breaks the gnutls build, see
> https://gitlab.com/gnutls/nettle/-/jobs/149522724,
>
>   In file included from gost/gost28147.c:40:
>   gost/nettle-write.h:40:10: fatal error: nettle/nettle-stdint.h: No such
>   file or directory
>#include 
> ^~~~

This file needs just uint8_t/uint64_t, so it might be easier to fix gnutls
to just include  there. I'll open a MR.

-- 
With best wishes
Dmitry
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2019-01-22 Thread Niels Möller
ni...@lysator.liu.se (Niels Möller) writes:

> That said, I'm about to delete nettle-stdint.h, and require that the
> compiler supplies a  (as was discussed quite a while ago).

I've now merged changes to do that to the master-updates branch. It
breaks the gnutls build, see
https://gitlab.com/gnutls/nettle/-/jobs/149522724,

  In file included from gost/gost28147.c:40:
  gost/nettle-write.h:40:10: fatal error: nettle/nettle-stdint.h: No such
  file or directory
   #include 
^~~~

Is this easy to fix (e.g., include nettle-types.h instead?), or should I
add an installed header nettle/nettle-stdint.h containing only

#include 

?

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2019-01-07 Thread Niels Möller
Simo Sorce  writes:

> I have a question though, why C89 support ?

Code was written for c89 aka ansi-c. So it's not difficult to keep
supporting it, and it might help for some (embedded mainly, I imagine)
compilers.

That said, I'm about to delete nettle-stdint.h, and require that the
compiler supplies a  (as was discussed quite a while ago).

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2019-01-07 Thread Tim Rühsen
On 07.01.19 19:24, Simo Sorce wrote:
> They seem minor enough not to really need a new release IMO, people can
> get them from master as needed. Or maybe you can commit patches on the
> 3.4 branch so people can find them more easily if they really care.
> 
> I have a question though, why C89 support ?
> C99 is already almost 20y old already ...

There are still modern compilers that lack full C99 support.
I am not sure about embedded systems with special C compilers...

Regards, Tim

> On Sun, 2019-01-06 at 11:25 +0100, Niels Möller wrote:
>> Jeffrey Walton  writes:
>>
>>> I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched).
>>> Self tests are failing at:
>>>
>>> PASS: rsa-sec-decrypt
>>> sec_powm.c:293: GNU MP assertion failed: enb >= windowsize
>>> ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags
>>> FAIL: rsa-compute-root
>>> PASS: dsa
>>> PASS: dsa-keygen
>>
>> (This was a test with -DNDEBUG, a configuration not covered by the
>> gitlab ci testers). Turned out to be a bug in the test code,
>>
>>   assert (mpz_invert(key->d, pub->e, phi));
>>
>> Fixed (on the release-3.4-fixes branch) with commit
>> https://git.lysator.liu.se/nettle/nettle/commit/73d3c6d5586cc0fd81eab081078144d621de07b4
>>
>> There was another -DNDEBUG breakage in examples/nettle-openssl.c, which
>> was fixed on master long ago, but which I overlooked when cherry-picking
>> bugfixes for nettle-3.4.1. Also fixed now.
>>
>> Question for the list: I'm now aware of two bugs in nettle-3.4.1:
>>
>> 1. Accidental use of c99 loops, breaking builds with c89 compilers.
>>
>> 2. Incorrect asserts, affecting tests and benchmark code when compield
>>with -DNDEBUG, but not the libraries themselves.
>>
>> Should I make a 3.4.2 release fixing these problems?
>>
>> Regards,
>> /Niels
>>
> 



signature.asc
Description: OpenPGP digital signature
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2019-01-07 Thread Simo Sorce
They seem minor enough not to really need a new release IMO, people can
get them from master as needed. Or maybe you can commit patches on the
3.4 branch so people can find them more easily if they really care.

I have a question though, why C89 support ?
C99 is already almost 20y old already ...

Regards,
Simo.

On Sun, 2019-01-06 at 11:25 +0100, Niels Möller wrote:
> Jeffrey Walton  writes:
> 
> > I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched).
> > Self tests are failing at:
> > 
> > PASS: rsa-sec-decrypt
> > sec_powm.c:293: GNU MP assertion failed: enb >= windowsize
> > ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags
> > FAIL: rsa-compute-root
> > PASS: dsa
> > PASS: dsa-keygen
> 
> (This was a test with -DNDEBUG, a configuration not covered by the
> gitlab ci testers). Turned out to be a bug in the test code,
> 
>   assert (mpz_invert(key->d, pub->e, phi));
> 
> Fixed (on the release-3.4-fixes branch) with commit
> https://git.lysator.liu.se/nettle/nettle/commit/73d3c6d5586cc0fd81eab081078144d621de07b4
> 
> There was another -DNDEBUG breakage in examples/nettle-openssl.c, which
> was fixed on master long ago, but which I overlooked when cherry-picking
> bugfixes for nettle-3.4.1. Also fixed now.
> 
> Question for the list: I'm now aware of two bugs in nettle-3.4.1:
> 
> 1. Accidental use of c99 loops, breaking builds with c89 compilers.
> 
> 2. Incorrect asserts, affecting tests and benchmark code when compield
>with -DNDEBUG, but not the libraries themselves.
> 
> Should I make a 3.4.2 release fixing these problems?
> 
> Regards,
> /Niels
> 

-- 
Simo Sorce
Sr. Principal Software Engineer
Red Hat, Inc


___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2019-01-06 Thread Niels Möller
Jeffrey Walton  writes:

> I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched).
> Self tests are failing at:
>
> PASS: rsa-sec-decrypt
> sec_powm.c:293: GNU MP assertion failed: enb >= windowsize
> ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags
> FAIL: rsa-compute-root
> PASS: dsa
> PASS: dsa-keygen

(This was a test with -DNDEBUG, a configuration not covered by the
gitlab ci testers). Turned out to be a bug in the test code,

  assert (mpz_invert(key->d, pub->e, phi));

Fixed (on the release-3.4-fixes branch) with commit
https://git.lysator.liu.se/nettle/nettle/commit/73d3c6d5586cc0fd81eab081078144d621de07b4

There was another -DNDEBUG breakage in examples/nettle-openssl.c, which
was fixed on master long ago, but which I overlooked when cherry-picking
bugfixes for nettle-3.4.1. Also fixed now.

Question for the list: I'm now aware of two bugs in nettle-3.4.1:

1. Accidental use of c99 loops, breaking builds with c89 compilers.

2. Incorrect asserts, affecting tests and benchmark code when compield
   with -DNDEBUG, but not the libraries themselves.

Should I make a 3.4.2 release fixing these problems?

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2018-12-30 Thread Jeffrey Walton
On Sat, Dec 29, 2018 at 9:07 PM Jeffrey Walton  wrote:
>
> On Sat, Dec 29, 2018 at 2:17 PM Jeffrey Walton  wrote:
> >
> > I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched).
> > Self tests are failing at:
> >
> > PASS: rsa-sec-decrypt
> > sec_powm.c:293: GNU MP assertion failed: enb >= windowsize
> > ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags
> > FAIL: rsa-compute-root
> > PASS: dsa
> > PASS: dsa-keygen
> >
> > GMP is 6.1.2, which is the latest version.
>
> This is failing on Aarch64, too.

And I just duplicated with 32-bit code on Solaris. I have not been
able to test ARM A-32. GMP build is broken.

Jeff
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2018-12-30 Thread Jeffrey Walton
On Sun, Dec 30, 2018 at 5:27 PM Niels Möller  wrote:
>
> It might also be a bug in the book-keeping of scratch space, leading to
> some memory overwrite. Try running the test program under valgrind
> and/or asan?

Hey Niels,

What is the test name and how do I run it?

Given I've built the library and the test suite, what are the next
steps? (I'm guessing cd somewhere and and valgrind ).

Jeff
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2018-12-30 Thread Jeffrey Walton
On Sun, Dec 30, 2018 at 5:27 PM Niels Möller  wrote:
>
> Jeffrey Walton  writes:
>
> > I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched).
> > Self tests are failing at:
> >
> > PASS: rsa-sec-decrypt
> > sec_powm.c:293: GNU MP assertion failed: enb >= windowsize
> > ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags
> > FAIL: rsa-compute-root
> > PASS: dsa
> > PASS: dsa-keygen
>
> This is an ASSERT_ALWAYS in gmp's mpn/generic/sec_powm.c, checking the
> return value from the win_size function. To debug, it would be helpful
> to know

Here are the options I used to build GMP 6.1.2 and Nettle 3.1.4. It
looks fairly easy to duplicate on 64-bit platforms.

   BUILD_BITS: 64-bits
 INSTX_PREFIX: /usr/local
 INSTX_LIBDIR: /usr/local/lib64

  PKGCONFPATH: /usr/local/lib64/pkgconfig
 CPPFLAGS: -I/usr/local/include -DNDEBUG
   CFLAGS: -g2 -O2 -march=native -fPIC
 CXXFLAGS: -g2 -O2 -march=native -fPIC
  LDFLAGS: -L/usr/local/lib64 -Wl,-R,/usr/local/lib64 -Wl,--enable-new-dtags
   LDLIBS: -ldl -lpthread

Then, I run configure. There's nothing special about what I am doing.
I'm just getting into a Release Build state.

> 1. The value of enb and windowsize at the crash.
>
> 2. The definition of POWM_SEC_TABLE (defined in the platform specific
>gmp-mparam.h), and used by the win_size function in this file.
>
> To me, it looks like the assert validates that POWM_SEC_TABLE conforms
> to expectations.
>
> It might also be a bug in the book-keeping of scratch space, leading to
> some memory overwrite. Try running the test program under valgrind
> and/or asan?

Thanks Niels.

I'll try to get to it later tonight or tomorrow.

In the meantime you might provide your test data to GMP. It looks like
it would make a good test case for them.

Jeff
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2018-12-30 Thread Niels Möller
Jeffrey Walton  writes:

> I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched).
> Self tests are failing at:
>
> PASS: rsa-sec-decrypt
> sec_powm.c:293: GNU MP assertion failed: enb >= windowsize
> ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags
> FAIL: rsa-compute-root
> PASS: dsa
> PASS: dsa-keygen

This is an ASSERT_ALWAYS in gmp's mpn/generic/sec_powm.c, checking the
return value from the win_size function. To debug, it would be helpful
to know

1. The value of enb and windowsize at the crash.

2. The definition of POWM_SEC_TABLE (defined in the platform specific
   gmp-mparam.h), and used by the win_size function in this file.

To me, it looks like the assert validates that POWM_SEC_TABLE confoems
to expectations.

It might also be a bug in the book-keeping of scratch space, leading to
some memory overwrite. Try running the test program under valgrind
and/or asan?

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs


Re: sec_powm.c:293: GNU MP assertion failed: enb >= windowsize

2018-12-29 Thread Jeffrey Walton
On Sat, Dec 29, 2018 at 2:17 PM Jeffrey Walton  wrote:
>
> I'm trying to build Nettle 3.4.1 on Fedora 29, x64 (fully patched).
> Self tests are failing at:
>
> PASS: rsa-sec-decrypt
> sec_powm.c:293: GNU MP assertion failed: enb >= windowsize
> ../run-tests: line 57: 22997 Aborted (core dumped) "$1" $testflags
> FAIL: rsa-compute-root
> PASS: dsa
> PASS: dsa-keygen
>
> GMP is 6.1.2, which is the latest version.

This is failing on Aarch64, too.

Jeff
___
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs