Commit graph

48 commits

Author SHA1 Message Date
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
cinap_lenrek 9fccf1629e libmp: add mpvecadd()/mpvecsub() assembly versions for arm 2015-11-20 06:25:56 +01:00
cinap_lenrek 2559e19e19 libmp: 386/amd64 mpvec*(): replace conditional branches with ADC/SBB instructions 2015-11-20 06:25:01 +01:00
cinap_lenrek a4e32b43ea libmp: optimize case x/0xffffffff in mpdigdiv() (helps arm) 2015-11-01 12:12:41 +01:00
cinap_lenrek d901fbe4f1 libmp: add mpvecdigmuladd()/mpvecdigmulsub() assembly routines for arm 2015-11-01 12:10:10 +01:00
cinap_lenrek 844bbecadb libmp: simplify mpnrand(), as mpnew() cannot return nil 2015-08-26 05:44:26 +02:00
cinap_lenrek 8f2e408448 libmp: add mpnrand() function to generate uniform random number 0 ≤ x < n 2015-08-25 20:20:25 +02:00
cinap_lenrek acc4d8b8aa libmp: fix build for objtype=spim 2015-08-08 08:25:36 +02:00
cinap_lenrek ebe88f34cb fix library mkfiles for objtype=spim 2015-08-08 08:04:41 +02:00
cinap_lenrek fbe78d4687 mpdigdiv.s: aaaaand its gone! 2015-03-25 14:19:05 +01:00
cinap_lenrek a7925e3ecb libmp: use portable mpdigdiv routines for mips (causes invalid instruction trap on indy) 2015-03-25 13:55:37 +01:00
cinap_lenrek ed9e9f98e9 libc and ape support for amd64 2014-02-01 10:31:41 +01:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00