aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/bigint
Commit message (Collapse)AuthorAgeFilesLines
* Shuffle things around. Add NIST X.509 test to build.lloyd2014-01-0110-1779/+0
|
* Give everything setting a feature test macro in build.h a version codelloyd2013-11-281-1/+1
| | | | | | so application code can check for the specific API it expects without having to keep track of what versions APIs x,y,z changed. Arbitrarily set all current API versions to 20131128.
* Rename mp_asm.h to mp_madd.hlloyd2013-07-301-1/+1
|
* Fix various issues flagged by cppcheck. Nothing too interesting.lloyd2012-08-131-1/+1
|
* Cleanup BigInt::cmplloyd2012-08-012-7/+38
| | | | | | Move bigint_divcore to divide.cpp which is the only place it is used. Probably not computationally intensive enough to really be worth optimizing in asm.
* Move all BigInt constructors to the top of the decllloyd2012-08-011-81/+82
|
* Remove BigInt::assignlloyd2012-08-011-10/+0
|
* Remove BigInt(NumberType type, size_t n) and replace it with a staticlloyd2012-08-014-30/+18
| | | | BigInt function power_of_2. (Power2 was the only available NumberType)
* Remove all support for octal BigInt conversions.lloyd2012-08-014-39/+25
|
* Remove BigInt::get_reglloyd2012-08-012-11/+4
|
* Remove BigInt::operator[]. Use BigInt::word_at, which checks sizeslloyd2012-08-012-11/+8
|
* Remove BigInt::operator[] returning a mutable word referencelloyd2012-08-012-12/+8
|
* Rename the version of BigInt::data returning a mutable pointerlloyd2012-08-013-32/+30
| | | | to BigInt::mutable_data. Update callers.
* Remove the mutable version of BigInt::get_reglloyd2012-07-313-11/+4
|
* m_ namespace BigInt memberslloyd2012-07-313-40/+40
|
* Remove BigInt::grow_reg which was only used by a few tests.lloyd2012-07-312-14/+4
|
* Be explicit about swap template specializationlloyd2012-06-261-1/+1
|
* Plain hex_decode now returns a std::vector, use hex_decode_locked tolloyd2012-05-261-6/+6
| | | | get a secure_vector.
* For block and stream ciphers, don't set the size of the key vectorslloyd2012-05-251-2/+1
| | | | | | | | | | | until we are actually setting a key. This avoids the problem of prototype objects consuming not just memory but the precious few bytes of mlock'able memory that we're given by Linux. Use clear_mem instead of a loop in BigInt::mask_bits If OS2ECP encounters an invalid format type, include what type it was in the exception message.
* Fairly huge update that replaces the old secmem types with std::vectorlloyd2012-05-187-73/+105
| | | | | | using a custom allocator. Currently our allocator just does new/delete with a memset before deletion, and the mmap and mlock allocators have been removed.
* Remove all uses of MemoryRegion::copy outside of internal uses inlloyd2012-05-181-13/+2
| | | | secmem.h. Mostly replaced by assign or copy_mem.
* Fixes for GCC 4.7.0 (r183974)lloyd2012-02-071-1/+3
|
* Inline BigInt move operators and swaplloyd2011-06-132-31/+21
| | | | Add move constructor and assignment to PointGFp
* propagate from branch 'net.randombit.botan' (head ↵lloyd2011-06-132-1/+29
|\ | | | | | | | | | | 150bd11dd8090559ee1e83394b8283bf93a018de) to branch 'net.randombit.botan.c++0x' (head 7480693bb3f1e8a4e039a3e7ba3d9a7007f9730e)
| * propagate from branch 'net.randombit.botan' (head ↵lloyd2011-02-112-1/+29
| |\ | | | | | | | | | | | | | | | 13a0d36dac3709f3cb88e830ed7f8cab9e7433ab) to branch 'net.randombit.botan.c++0x' (head 2221ad8796466e7e096645de77ba856a9c902d14)
| | * propagate from branch 'net.randombit.botan' (head ↵lloyd2010-11-042-1/+29
| | |\ | | | | | | | | | | | | | | | | | | | | 303b2518a80553214b1e5ab4d9b96ef54629cbc7) to branch 'net.randombit.botan.c++0x' (head d734eefabe4816be4dd3e3e6e7bb13b7ab5be148)
| | | * propagate from branch 'net.randombit.botan' (head ↵lloyd2010-10-282-4/+4
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | 2841fb518e20d2fe0a374e4f6b08bdbb14d5d158) to branch 'net.randombit.botan.c++0x' (head 0b9275139d6346bd3aa28d63bf8b8a03851d853d)
| | | * \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-10-132-1/+29
| | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2898d79f992f27a328a3e41d34b46eb1052da0de) to branch 'net.randombit.botan.c++0x' (head 6cba76268fd69a73195760c021b7f881b8a6552c)
| | | | * \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-09-032-1/+29
| | | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a29c41b4a949207b1544096c3afab668f8b5179e) to branch 'net.randombit.botan.c++0x' (head a9d0c2f805b3c20a4c648575d7256959db8329fe)
| | | | | * \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-08-132-1/+29
| | | | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0a3348f52bf558bc2282e1066c2913a72a1aeda5) to branch 'net.randombit.botan.c++0x' (head 552c20ae8874f12da779fc25ea368e36e71cbfe8)
| | | | | | * \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-07-092-1/+29
| | | | | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 161b5c0300b72baa746f101fda1e2b4a7c71818c) to branch 'net.randombit.botan.c++0x' (head 1fc3875bb8daf4ad0e90ba66db72642203cb9984)
| | | | | | | * \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-06-177-75/+186
| | | | | | | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 294e2082ce9231d6165276e2f2a4153a0116aca3) to branch 'net.randombit.botan.c++0x' (head 0b695fad10f924601e07b009fcd781191fafcb28)
| | | | | | | * \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-03-212-4/+36
| | | | | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 96d0a1885774b624812fd143d541c8bcda319217) to branch 'net.randombit.botan.c++0x' (head e14368ab9d7976f3e111c6bc0adf24eebeb7c114)
| | | | | | | | * \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-03-132-4/+36
| | | | | | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5e9c6107cbb15744c2edf2eb0e23f4bfe949f432) to branch 'net.randombit.botan.c++0x' (head 79e5920a8bba479b9e5734f8649b8c36d27d403c)
| | | | | | | | | * \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2010-02-142-4/+36
| | | | | | | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5bfc3e699003b86615c584f8ae40bd6e761f96c0) to branch 'net.randombit.botan.c++0x' (head 8c64a107b58d41f376bfffc69dfab4514d722c5c)
| | | | | | | | | | * \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2009-12-212-4/+36
| | | | | | | | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 14c1d4dc8696d2705a70ec3d2403e01d2ca95265) to branch 'net.randombit.botan.c++0x' (head c567fa7310ba082a837562092728c4b4b882bf82)
| | | | | | | | | | | * \ \ propagate from branch 'net.randombit.botan' (head ↵lloyd2009-12-1631-62/+68
| | | | | | | | | | | |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 744dccf92270cf16b80b50ee2759424c9866b256) to branch 'net.randombit.botan.c++0x' (head 2aa1acac1d05e8ea9991fe39015b1db9abc3b24e)
| | | | | | | | | | | * | | | Define move assignment and constructors in terms of std::swap (whichlloyd2009-11-191-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | boils down to BigInt::swap, which uses the memvec swap). Checking with g++ 4.5 -O3 shows it compiles down the same code as before.
| | | | | | | | | | | * | | | Add move assignment and constructor operators to BigInt. On macro benchmarkslloyd2009-11-192-4/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (timing the test suite) there doesn't seem to be much of a difference either way, but putting printfs in the implementations shows they are being used. Since they pretty much can't possibly hurt (right?) and might well help a lot in certain cases, it's worth including. Todo: adding overloads to binary operators taking move operations might be nice. Details in http://cpp-next.com/archive/2009/09/making-your-next-move/
* | | | | | | | | | | | | | | Add base64_decode. Seems to work OK, though incremental decoding islloyd2011-05-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | not well tested.
* | | | | | | | | | | | | | | Add back BigInt::to_u32bitlloyd2011-05-102-17/+45
|/ / / / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix BigInt::get_substring when length is equal to 32 - an overflow would cause the mask to be equal to 0 thus producing nothing at all. Disable CVC by default, it's not ready for prime time in any sense.
* / / / / / / / / / / / / / More VC warning fixeslloyd2011-02-091-2/+4
|/ / / / / / / / / / / / /
* | | | | | | | | | | | / Make MemoryRegion::set protected, change all callerslloyd2010-10-291-0/+9
| |_|_|_|_|_|_|_|_|_|_|/ |/| | | | | | | | | | |
* | | | | | | | | | | | BigInt::get_substring really shouldn't return size_t. Revert tolloyd2010-10-182-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | u32bit. Maybe should be word? But that would restrict window sizes more than might be desirable (we couldn't use more than 8 bit window on the assumption that the lib might be using byte limbs). Messy.
* | | | | | | | | | | | For const BigInt::operator[], return a const reference instead of alloyd2010-10-181-1/+1
|/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | value, so you can always safely capture the result by a const reference.
* | | | | | | | | | | Use size_t in all of math, remove to_u32bitlloyd2010-10-128-136/+111
| | | | | | | | | | |
* | | | | | | | | | | At some point I 'simplified' the divide code to always run thelloyd2010-09-261-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | division algorithm unless x == y, but this could result in n - t + 1 being negative which would cause an attempt to allocate about 4 gigabytes of memory. Fix this, and also add an assertion check in the code to ensure that can't happen in any other way. Never reproduced this with 32 bit digits but it would show up if the build used 8 or 16 bit words.
* | | | | | | | | | | Move the core MPI functions to src/math/mp, leaving src/math/bigint justlloyd2010-09-2427-3742/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for the implementation of the BigInt class
* | | | | | | | | | | Delete obsolete asm versionslloyd2010-09-247-781/+0
| | | | | | | | | | |
* | | | | | | | | | | Minor performance tweak, avoid zeroing things we'll immediately writelloyd2010-09-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to. Helps more than I would have thought.