Commit Graph

12 Commits

Author SHA1 Message Date
Mathias Tausig
3eaee499a4 Add missing include (prevent compiler warning) 2016-10-25 11:13:07 +02:00
Steffen Jaeckel
3cabe12a21 mul generator: update preamble not to compile the code if it's not required 2014-06-12 18:08:34 +02:00
Steffen Jaeckel
8c8d763389 sqr generator: update preamble not to compile the code if it's not required 2014-06-12 18:08:10 +02:00
Steffen Jaeckel
540e3ecbc1 Realign mult generators with existing files in repo.
NB: fp_mul_comba32() is hand-optimized and has to be hand-crafted after
re-generation
2014-06-12 17:40:58 +02:00
Steffen Jaeckel
86e7c59ff4 trim trailing spaces/clean-up 2014-06-12 17:35:54 +02:00
Steffen Jaeckel
6673bd99ce minor fixes to really reproduce original files 2014-06-12 10:58:54 +02:00
Steffen Jaeckel
f8227a0dd9 trim trailing spaces 2014-06-12 10:58:39 +02:00
Steffen Jaeckel
f5b5bc09fb Revert "Bugfix: clear the exceeding destination digits."
This reverts commit 50f587c36f.
2014-06-12 10:50:19 +02:00
Giovanni Bajo
782c6e52de Realign generators with existing files in repo. 2011-09-20 11:36:41 +02:00
Giovanni Bajo
8f059cd52f Add makefile for sqr generators 2011-09-20 11:35:51 +02:00
Giovanni Bajo
50f587c36f Bugfix: clear the exceeding destination digits.
Currently, the fp_sqr_comba_* functions do not fully clear the destination
number, but only overwrites the digits they care about. Eg: if
you call a comba4, it will overwrite the first 8 digits and leave
the others unchanged.

On the other hand, fp_mul_comba_* functions do *not* check incoming
unused digits (relying on the guarantee that they must be zero),
so they will happily compute the wrong result if those digits
are not empty. Testcase for a 32-bit system:

   char buf[64];
   fp_int num, num2, d;

   memset(buf, 0xFF, sizeof(buf);
   fp_read_unsigned_bin(&num, buf);
   fp_set(&d, 1);

   fp_sqr_comba_3(&d, &num);
   // now num is { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0,
   //              0xFFFFFFFF, 0xFFFFFFFF ... }
   // only first 6 digits have been written, but even
   // if num.used is correctly set to 6, this can trigger
   // bugs.

   // Create a number larger than 6 digits
   fp_2expt(&num2, 8*32+4);

   fp_mul_comba_8(&num, &num2, &num2);
   // wrong result has been computed, because the first 8
   // digits of num have been read and multiplied
   // even if num->used == 6, relying on the fact that
   // they should be zero.
2011-09-20 11:02:53 +02:00
Tom St Denis
da88c2d42f added tomsfastmath-0.12 2010-07-22 10:06:30 +02:00