Commit Graph

25 Commits

Author SHA1 Message Date
Luke Howard
c403b66082 hcrypto: import libtommath v1.2.0 2020-04-24 11:59:54 +10:00
Nicolas Williams
352ff15477 Use labs(rand()) instead of abs(rand()) in tommath
Originally by Christos Zoulas.
2017-03-13 18:39:41 -04:00
Nicolas Williams
4c64231430 Misc last newline fixes
Originally by Christos Zoulas.
2017-03-13 18:39:41 -04:00
Thorsten Glaser
005c8886d7 Do not detect x32 as 64-bit platform.
Fixes test failures due to ISO C Undefined Behaviour in MP_MASK macro.
2017-01-09 19:57:40 +00:00
Nicolas Williams
b4cf4de807 Fix warnings (clang 3.6) 2016-02-26 01:04:31 -06:00
Jeffrey Altman
e8d2100880 libtommath: fix typo in bn_mp_mod.c
Change-Id: Ieec5c01d5bd59b9268f41933389b1b32a4c4d0c6
2013-10-08 21:32:39 -05:00
Jeffrey Altman
8dc29ae1a0 libtommath: remove bn_mp_isprime.c
Now that mp_prime() is no longer used, remove bn_mp_isprime.c from
the source tree.

Change-Id: Ie0f7ce3184c000f27ae5b9dbe07b323c02ce7199
2013-10-08 17:02:07 -05:00
Moritz Lenz
b709d39aa5 libtommath: Fix mp_mod(a, b, c) if b < 0 and a = n * b, n integer
it used to return b, now it return 0.

From https://github.com/libtom/libtommath

Change-Id: I99f5d42c09a6fbddfb32b7dd0ed10ef04f1c08a5
2013-10-08 16:17:14 -05:00
Steffen Jaeckel
7fe018e418 libtommath: mp_error_to_string: return const char* instead of char*
From https://github.com/libtom/libtommath

Change-Id: Idd5cbab380f5d504fece93afb3a5fcc026309482
2013-10-08 16:17:13 -05:00
Steffen Jaeckel
5bc653f0ef libtommath: allow mp_shrink to shrink initialized, but empty MPI's
from https://github.com/libtom/libtommath

Change-Id: I5814caeb44db710957152a7d47b03f9beb6e5147
2013-10-07 17:20:57 -05:00
Jeffrey Altman
28051fa99c Convert mp_find_prime to use mp_prime_is_prime
Modify the signature of mp_find_prime() to permit the number of
Miller-Rabin rounds to be specified.  In addition, valid responses
now include MP_NO, MP_YES, and MP_VAL which is returned when
mp_prime_is_prime() fails.

Change-Id: I0195129a4dd75875e6dddb6d49a5ceb30afb1a17
2013-10-07 15:18:42 -05:00
Jeffrey Altman
1859a85350 libtommath: protect functions by tommath_class macros
libtommath protects the inclusion of functions by wrapping their
declarations by CPP #ifdef tests and defining the matching macros
within libtommath_class.h.

Add missing macros:

  BN_MP_FIND_PRIME_C
  BN_MP_ISPRIME_C

Change-Id: Ic577300114f8e88d7a3af3d9f717a249d57f03b1
2013-10-07 14:00:21 -05:00
Jeffrey Altman
b90732860a libtommath: remove unnecessary comparison
As pointed out by Steffen Jaeckel [https://github.com/sjaeckel],
within bn_mp_prime_next_prime() t <= PRIME_SIZE as per the check
at the top of the function.  Remove the unnecessary comparison in
a for loop conditional.

Change-Id: I868bee1a7a019e0ab06bf2b81cc71cf66ca9acff
2013-10-07 13:57:03 -05:00
Love Hornquist Astrand
8a0e0f9472 do m-r on more then one prime 2011-11-21 20:33:53 -08:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Jeffrey Altman
6850d6a65f avoid uninit variable and unreachable code warnings
most of these warnings are not problems because of ample
use of abort() calls.  However, the large number of warnings
makes it difficult to identify real problems.  Initialize
the variables to shut up the compilers.

Change-Id: I8477c11b17c7b6a7d9074c721fdd2d7303b186a8
2011-05-17 12:02:16 -04:00
Asanka Herath
4b8c523d28 Fix line endings 2010-09-14 08:04:10 -04:00
Asanka Herath
4b1fbabe68 Windows: Fix build rules and includes for libtommath 2010-08-20 16:55:53 -04:00
Love Hornquist Astrand
c6ed8b9a66 indent 2010-08-20 00:07:03 -07:00
Love Hornquist Astrand
90a605432e .c -> .obj 2010-08-20 00:05:16 -07:00
Love Hornquist Astrand
27c94fadca bits 2010-08-20 00:03:16 -07:00
Love Hornquist Astrand
1f226a37b9 try glue in ltm in NTMakefile 2010-08-19 23:55:33 -07:00
Love Hornquist Astrand
aaf598c2fd drop pregen 2010-07-18 14:10:55 -07:00
Love Hornquist Astrand
6c0c936595 select add libtommath 2010-07-18 13:04:03 -07:00
Love Hornquist Astrand
1a625c0908 ltm-0.41 2010-07-01 10:51:29 -07:00