Commit Graph

63 Commits (master)

Author SHA1 Message Date
cinap_lenrek a3b9243f71 libmp: add dummy mkfile for arm64 2019-05-03 21:02:13 +02:00
aiju 64d0d3b8ac libmp: fix mptouv behaviour to match mptoui 2018-12-06 09:32:20 +00:00
aiju 17b80cbcf1 libmp: add tests for integer conversions 2018-12-06 09:32:07 +00:00
aiju 7e477cc769 mptov: make it actually work 2018-12-05 10:26:52 +00:00
aiju ec60da4961 libmp: add awk-generated tests 2018-05-05 12:14:39 +00:00
aiju a7a07b2d43 mpdiv: get signs right... 2018-05-05 12:03:45 +00:00
aiju 0930daf295 mp: more tests 2018-05-05 08:49:38 +00:00
aiju 72ad2d1ee1 mpmagadd: oops... 2018-05-04 21:42:08 +00:00
aiju 35065b9127 mpmagadd: force output sign +1 always 2018-05-04 21:41:16 +00:00
aiju 8dc43a951c mpdiv: fix sign bug 2018-05-04 21:18:46 +00:00
aiju fa028a9352 libmp: add new tests 2018-05-04 00:42:59 +00:00
aiju cda7129cd2 mplogic: don't drop carry out 2018-05-03 23:31:24 +00:00
aiju e87ca8d976 mpdiv: fix dividing 0 by a small power of two 2018-04-26 14:55:02 +01:00
aiju b9a08958e2 mp: add mptod and dtomp 2018-03-09 20:51:28 +00:00
cinap_lenrek 5cf5f6e9ac libmp: use constant time encode(2) routines instead of lookup tables
the encode(2) routines are constant time now, so
use them instead of using lookup table that can
leak information through cache timing side channel.
2017-12-31 10:59:01 +01:00
cinap_lenrek 96769e0476 libmp: fix mpmod() aliasing bug when n == r and x < 0 (thanks aiju, mischief)
mischief found this in rsafill()'s call mpmod(c2, x, x), where
d parameter is negative (rsagen created a rsa key with negative dk).
2017-02-05 02:48:13 +01:00
cinap_lenrek 45512020d2 libmp: avoid temporary buffer allocation in mprand() 2016-12-28 18:19:52 +01:00
aiju a37a13074c mpxor: sign should be 1/-1, not 0/-1 2016-12-20 18:33:58 +01:00
aiju d552fed385 mptrunc: don't write to r->p[r->top] 2016-09-01 10:46:37 +00:00
cinap_lenrek a08bf6831f libmp: remove unused mpeuclid.c 2016-08-29 02:09:34 +02:00
cinap_lenrek 5852f8a144 libmp: allow passing nil to v,x,y results of mpextendedgcd(), simplify mpinvert() 2016-08-29 02:07:52 +02:00
cinap_lenrek 33862ff793 libmp: mpnrand(), what was i *THINKING*
the prior implementation was unneccesarily complicated for
no good reason due to me misunderstanding how libc's nrand()
works. in contrast to libc, we already generate the *closest*
power-of-2 random number with mprand() in the sampling loop.
2016-08-29 00:45:16 +02:00
cinap_lenrek 1f9bdb6f5d libmp: mpdiv(): fix divisor==quotient case (again) 2016-08-28 16:46:32 +02:00
cinap_lenrek bdc87e17bd libmp: timingsafe sign flip for small power-of-two negative divisor for mpdiv() 2016-08-28 16:33:52 +02:00
aiju 43bb71c8cc mpdiv: negative divisor has to flip sign of quotient 2016-08-28 12:00:25 +02:00
aiju 344ff48512 mp: fix mptov and mptouv 2016-08-28 11:38:29 +02:00
aiju cf2f2a8841 mp: fix mpnot and add mpasr 2016-08-28 10:49:41 +02:00
aiju 913ce62cfc strtomp: update the returned char* even if there were no characters parsed 2016-08-28 01:08:26 +02:00
aiju 261ec9fe0e strtomp: fix mpbits() call in octal code 2016-08-28 01:07:34 +02:00
aiju c6318ecb17 mptrunc: normalize after mpassign to handle the case b==r 2016-08-08 00:54:45 +02:00
cinap_lenrek 986886f2b8 retire the dec alpha port 2016-05-04 16:11:48 +02:00
cinap_lenrek 1069d018c9 libmp: fix build for spim, reduce by the mips assembly files 2016-04-10 20:20:53 +02:00
cinap_lenrek 3ba1197aeb libmp: make includes consistent, make test program compile under ape (work in progress) 2016-04-10 02:35:01 +02:00
mischief ad637845a8 libmp: remove include of libsec.h 2016-02-05 19:29:55 -08:00
cinap_lenrek f1254da64d libmp: handle out of memory case in gmfield() 2016-02-04 03:11:46 +01:00
cinap_lenrek e064752dd4 libmp: silence compiler warning for strtomp 2016-01-06 01:19:05 +01:00
cinap_lenrek 5aeddd6788 libmp: check nil return value of strtomp() in test program 2016-01-04 19:09:25 +01:00
cinap_lenrek f5fcf6688b libmp: mistake in strtomp() 2016-01-04 18:33:06 +01:00
cinap_lenrek d30b160fe3 libmp: support for c-style base prefixes for strtomp(), octal support 2016-01-03 22:43:44 +01:00
aiju bdc2b75568 mpfmt: handle base 2, 4 2015-12-20 13:45:28 +01:00
cinap_lenrek efd3ac8a23 libmp: add mpfield() function for fast field arithmetic
instead of testing for special field primes each time in mpmod(),
make it explicit with a mpfiled() function that tests a modulus N
to be of some special form that can be reduced more efficiently with
some precalculation, and replaces N with a Mfield* when it can. the
Mfield*'s are recognized by mpmod() as they have the MPfield flag
set and provide a function pointer that executes the fast reduction.
2015-12-16 21:18:20 +01:00
aiju 15c6cd7555 mp: strtomp support for bases 2,4,8 2015-12-08 20:26:17 +01:00
aiju 609a9922ad mp: fix bug in mplogic.c; update mkfile 2015-12-08 19:43:22 +01:00
aiju 87abbc649f mp: add logic operations; mpfmt: include 0x with # 2015-12-08 18:29:22 +01:00
cinap_lenrek 01afe9328b libmp: fix assert() for mpexp() with nil modulus 2015-12-06 20:53:54 +01:00
cinap_lenrek 1a5c8430d2 libmp: fix wrong move instruction for arm vector operations 2015-12-06 20:52:15 +01:00
cinap_lenrek 8d16e980c2 libmp: mpmod() fix typo 2015-12-01 11:25:08 +01:00
cinap_lenrek ffdfc17cee libmp: with mpmod() m = 2^a - c ensure that digits(c) < digits(m) 2015-12-01 11:13:52 +01:00
cinap_lenrek 38e1e5272f libmp: initial attempt at constant time code, faster reductions for special primes (for ecc)
introduce MPtimesafe flag to request time invariant computation
disables normalization so significant digits are not leaked.
2015-11-21 09:39:59 +01:00
cinap_lenrek 51bedde447 libmp: fix test program 2015-11-20 06:28:17 +01:00