Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Fix some Doxygen warnings | Jack Lloyd | 2018-08-15 | 1 | -1/+0 |
| | |||||
* | Fix BigInt::to_{dec,hex}_string for zero | Jack Lloyd | 2018-08-15 | 1 | -1/+8 |
| | | | | They returned an empty string instead | ||||
* | Cleanup of BigInt encoding/decoding functions | Jack Lloyd | 2018-08-14 | 3 | -16/+138 |
| | | | | | | | | | | | | | Instigated by finding a bug where BigInt::encode with decimal output would often have a leading '0' char. Which is papered over in the IO operator, but was exposed by botan_mp_to_str which called BigInt::encode directly. Split BigInt::encode/decode into two versions, one taking the Base argument and the other using the (previously default) binary base. With a view of eventually deprecating the versions taking a base. Add BigInt::to_dec_string() and BigInt::to_hex_string() | ||||
* | Add Lucas test from FIPS 186-4 | Jack Lloyd | 2018-07-31 | 2 | -0/+21 |
| | | | | | | | | | | This eliminates an issue identified in the paper "Prime and Prejudice: Primality Testing Under Adversarial Conditions" by Albrecht, Massimo, Paterson and Somorovsky where DL_Group::verify_group with strong=false would accept a composite q with probability 1/4096, which is exactly as the error bound is documented, but still unfortunate. | ||||
* | Check arguments to BigInt::random_integer | Jack Lloyd | 2018-06-29 | 2 | -2/+5 |
| | |||||
* | Document preconditions of BigInt::mod_add/mod_sub | Jack Lloyd | 2018-06-23 | 1 | -0/+2 |
| | |||||
* | Avoid needless alloc and copy | Jack Lloyd | 2018-06-21 | 1 | -0/+6 |
| | |||||
* | Avoid unnecessary realloc in BigInt::mod_sub | Jack Lloyd | 2018-06-17 | 1 | -2/+7 |
| | |||||
* | Fix a bug in Barrett reduction | Jack Lloyd | 2018-06-05 | 1 | -4/+3 |
| | | | | | | -x*n % n would reduce to n instead of zero. Also some small optimizations and cleanups. | ||||
* | Inline BigInt::shrink_to_fit | Jack Lloyd | 2018-05-09 | 2 | -7/+5 |
| | | | | Improves P-256 a bit | ||||
* | Inline this operator+ [ci skip] | Jack Lloyd | 2018-04-26 | 2 | -6/+1 |
| | |||||
* | Add BigInt functions for adding, subtracting and comparing with words | Jack Lloyd | 2018-04-26 | 4 | -51/+142 |
| | | | | Avoids needless allocations for expressions like x - 1 or y <= 4. | ||||
* | Add BigInt::mod_sub | Jack Lloyd | 2018-04-23 | 2 | -0/+65 |
| | |||||
* | Add const time annotations | Jack Lloyd | 2018-04-15 | 2 | -0/+20 |
| | |||||
* | Square is always positive | Jack Lloyd | 2018-04-08 | 1 | -0/+1 |
| | |||||
* | Add BigInt::square plus a speed test for BigInt multiply | Jack Lloyd | 2018-04-08 | 2 | -0/+22 |
| | |||||
* | Fix some Doxygen errors | Jack Lloyd | 2018-03-28 | 1 | -1/+2 |
| | |||||
* | Shift ECDSA inputs to match OpenSSL behavior | Jack Lloyd | 2018-03-21 | 2 | -0/+21 |
| | | | | See also GH #986 | ||||
* | Simplify a common case BigInt constructor | Jack Lloyd | 2018-03-21 | 2 | -1/+13 |
| | |||||
* | Store base point multiplies in a single std::vector | Jack Lloyd | 2018-03-20 | 2 | -0/+17 |
| | | | | | | | | | | | Since the point is public all the values are also, so this reduces pressure on the mlock allocator and may (slightly) help perf through cache read-ahead. Downside is cache based side channels are slightly easier (vs the data being stored in discontigious vectors). But we shouldn't rely on that in any case. And having it be in an array makes a masked table lookup easier to arrange. | ||||
* | Improve memory handling for PointGFp | Jack Lloyd | 2018-03-14 | 1 | -5/+0 |
| | |||||
* | Move declaration of word to types.h | Jack Lloyd | 2018-03-01 | 1 | -1/+1 |
| | |||||
* | Remove MP_WORD_BITS constant | Jack Lloyd | 2018-03-01 | 4 | -17/+17 |
| | | | | Use the BOTAN_MP_WORD_BITS consistently | ||||
* | Remove BigInt using functions from mp layer | Jack Lloyd | 2018-03-01 | 1 | -1/+5 |
| | |||||
* | Inline some simple BigInt sign handling functions | Jack Lloyd | 2018-03-01 | 2 | -32/+17 |
| | |||||
* | Avoid needless allocation in BigInt operator+= | Jack Lloyd | 2018-02-28 | 1 | -4/+2 |
| | | | | Kind of amazing what a difference that made for overall ECDSA perf | ||||
* | Optimize P-256 and P-384 reduction | Jack Lloyd | 2018-02-26 | 2 | -4/+14 |
| | | | | Precompute the multiples of the prime and then subtract directly. | ||||
* | Avoid some needless allocations | Jack Lloyd | 2018-02-26 | 1 | -11/+27 |
| | |||||
* | Optimize Barrett reduction | Jack Lloyd | 2018-02-26 | 3 | -4/+79 |
| | | | | | | | | | | OSS-Fuzz 6570 flagged an issue with slow modular exponentation. It turned out the problem was not in the library version but the simple square-and-multiply algorithm. Computing g^x % p with all three integers being dense (high Hamming weight) numbers took about 1.5 seconds on a fast machine with almost all of the time taken by the Barrett reductions. With these changes, same testcase now takes only a tiny fraction of a second. | ||||
* | Add BigInt::operator*= taking a word | Jack Lloyd | 2018-02-26 | 2 | -2/+23 |
| | | | | Avoids memory allocation when multiplying by a small constant. | ||||
* | Use reduce_below in PointGFp | Jack Lloyd | 2018-02-25 | 1 | -0/+2 |
| | | | | Improves ECDSA times by 2-3% | ||||
* | Add BigInt::reduce_below | Jack Lloyd | 2018-02-25 | 2 | -0/+33 |
| | |||||
* | Pass workspace size to various bigint_ functions | Jack Lloyd | 2018-02-25 | 2 | -2/+2 |
| | | | | | | These functions made assumptions about the workspace size available, which if incorrect would cause memory corruption. Since the length is always available at the caller, just provide it and avoid problems. | ||||
* | Minor optimizations in BigInt memory handling | Jack Lloyd | 2018-02-23 | 2 | -2/+4 |
| | | | | Makes 4-6% difference for ECDSA | ||||
* | Fix an error in BigInt operator- | Jack Lloyd | 2018-02-23 | 1 | -0/+1 |
| | | | | (x) - (-x) would result in -2x instead of the correct 2x | ||||
* | In PointGFp add/double avoid creating temporaries | Jack Lloyd | 2018-02-23 | 1 | -1/+7 |
| | | | | | | | We already had the temp workspace passed in but did not use it effectively... :/ Improves ECDSA sign and verify by 5-15% | ||||
* | New API for blinded ECC point multiplication | Jack Lloyd | 2018-02-21 | 1 | -1/+1 |
| | | | | No shared state | ||||
* | Minor optimizations for BigInt operator/ | Jack Lloyd | 2018-02-19 | 1 | -0/+6 |
| | | | | Detect divisions by small powers of 2 | ||||
* | Tiny optimization in BigInt::const_time_lookup | Jack Lloyd | 2018-02-13 | 1 | -1/+3 |
| | |||||
* | Remove needless variable | Jack Lloyd | 2017-10-06 | 1 | -2/+0 |
| | |||||
* | Add wrappers for reinterpret_cast between char* and uint8_t* | Jack Lloyd | 2017-10-03 | 3 | -5/+5 |
| | | | | | | | Generally speaking reinterpret_cast is sketchy stuff. But the special case of char*/uint8_t* is both common and safe. By isolating those, the remaining (likely sketchy) cases are easier to grep for. | ||||
* | Remove redundant parens | Jack Lloyd | 2017-10-03 | 1 | -1/+1 |
| | | | | Sonar | ||||
* | Use class for exception types | Jack Lloyd | 2017-10-02 | 1 | -2/+5 |
| | |||||
* | Use explicit on more single-argument constructors | Jack Lloyd | 2017-09-30 | 1 | -1/+1 |
| | |||||
* | Add valgrind annotations to check const_time_lookup | Jack Lloyd | 2017-09-26 | 1 | -0/+5 |
| | |||||
* | Use a side channel silent table look up in the Montgomery exponentiation | Jack Lloyd | 2017-09-25 | 2 | -0/+35 |
| | |||||
* | Apply final annotations to the library also | Jack Lloyd | 2017-09-22 | 1 | -2/+2 |
| | | | | | Done by a perl script which converted all classes to final, followed by selective reversion where it caused compilation failures. | ||||
* | Header file cleanups | Jack Lloyd | 2017-09-21 | 3 | -4/+4 |
| | | | | Some help from include-what-you-use | ||||
* | Change header guard format to BOTAN_FOO_H_ | Jack Lloyd | 2017-09-20 | 2 | -4/+4 |
| | | | | | | ISO C++ reserves names with double underscores in them Closes #512 | ||||
* | Add API stability annotations. | Jack Lloyd | 2017-09-19 | 2 | -13/+13 |
| | | | | | Defined in build.h, all equal to BOTAN_DLL so ties into existing system for exporting symbols. |