aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/bigint/divide.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Some math deprecationsJack Lloyd2020-11-051-1/+1
| | | | | | | | | | | | | Mostly things that shouldn't be used (like almost Montgomery inverse, which isn't even constant time) or are very much just for internals (like the word-wise Montgomery inverse computation used for reduction). Make variable time division explicit; leaves plain divide as a call but it forwards to ct_divide now. All callers within the library are now explicitly consttime or vartime. Add a shortcut for modulus by one word - this hits quite often especially in the ECC code
* Fix bug and avoid allocations in left shiftJack Lloyd2018-12-071-1/+2
|
* Use BigInt::cond_flip_signJack Lloyd2018-12-051-2/+1
|
* Don't leak if x is zero eitherJack Lloyd2018-12-051-39/+37
|
* Remove some conditional branches from divisionJack Lloyd2018-12-051-20/+20
|
* Extend ct_modulo to handle negative inputsJack Lloyd2018-12-031-8/+17
| | | | Unfortunately Barrett reductions API allows negative inputs
* Add ct_modulo and BigInt::ct_cond_swapJack Lloyd2018-12-031-5/+32
|
* Merge GH #1759 Add constant time divide by uint8_tJack Lloyd2018-12-031-0/+37
|\
| * Add a constant time divide variant for dividing by uint8_tJack Lloyd2018-12-021-0/+37
| | | | | | | | | | | | | | | | | | Originally wrote it for div-by-word but that ends up requiring a dword type which we don't always have. And uint8_t covers the most important cases of n = 10 and n = 58 (whenever I get around to writing base58). We could portably support up to div-by-uint32, but I don't think we need it. Nicely for n = 10, this is actually faster than the variable time division.
* | Make variable time division less branchyJack Lloyd2018-12-021-53/+46
|/ | | | This is still leaky, but better than nothing.
* Add a const-time division algorithmJack Lloyd2018-12-021-2/+34
| | | | | | | | It is stupid and slow (~50-100x slower than variable time version) but still useful for protecting critical algorithms. Not currently used, waiting for OSS-Fuzz to test it for a while before we commit to it.
* Remove MP_WORD_BITS constantJack Lloyd2018-03-011-3/+3
| | | | Use the BOTAN_MP_WORD_BITS consistently
* Convert to using standard uintN_t integer typesJack Lloyd2016-12-181-1/+1
| | | | | | Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
* Ensure all files have copyright and license info.lloyd2015-01-101-1/+1
| | | | | Update license header line to specify the terms and refer to the file, neither of which it included before.
* Move lib into srclloyd2014-01-101-0/+140