aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math
Commit message (Collapse)AuthorAgeFilesLines
* Fix typosSimon Warta2015-07-241-1/+1
| | | | Thanks to @vlajos https://github.com/vlajos/misspell_fixer
* Fix BigInt random_integer() distribution issue.Simon Warta2015-07-243-10/+31
| | | | Fixes #108
* Refactor BigIntSimon Warta2015-07-243-9/+20
|
* BigInt::to_u32bit failed on 32-bit integers. GH #220Jack Lloyd2015-07-231-1/+1
|
* Fix round_upSimon Warta2015-07-152-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. src/lib/codec/base64/base64.cpp: : (round_up<size_t>(input_length, 3) / 3) * 4; 2. src/lib/codec/base64/base64.cpp: : (round_up<size_t>(input_length, 4) * 3) / 4; 3. src/lib/filters/transform_filter.cpp: return round_up(target_size, update_granularity); 4. src/lib/math/bigint/bigint.cpp: m_reg.resize(round_up<size_t>(size, 8)); 5. src/lib/math/bigint/bigint.cpp: m_reg.resize(round_up<size_t>((length / WORD_BYTES) + 1, 8)); 6. src/lib/math/numbertheory/mp_numth.cpp: BigInt z(BigInt::Positive, round_up<size_t>(2*x_sw, 16)); 7. src/lib/modes/cbc/cbc.cpp: return round_up(input_length, cipher().block_size()); 8. src/lib/modes/ecb/ecb.cpp: return round_up(input_length, cipher().block_size()); 9. src/lib/modes/xts/xts.cpp: return round_up(input_length, cipher().block_size()); 10. src/lib/pbkdf/pbkdf2/pbkdf2.cpp: const size_t blocks_needed = round_up(out_len, prf_sz) / prf_sz; 11. src/lib/tls/tls_record.cpp: const size_t buf_size = round_up( 12. src/lib/utils/rounding.h:inline T round_up(T n, T align_to) 1. Reason for change 2. Reason for change 3. first argument cannot be 0 (`target_size = 1024`) 4. Is a bug in the current implementation iff `size = 0` 5. first argument cannot be 0 6. round_up should return 0 if `x_sw = 0` 7. ? 8. ? 9. ? 10. first argument cannot be 0 (`if(out_len == 0) return 0;`) 11. first argument is unlikely to be 0 (`iv_size + msg_length + mac_size + (block_size ? 1 : 0)`) 12. Implementation
* Make Botan compile when only some modules are enabledSimon Warta2015-07-031-1/+1
| | | | Fixes #146.
* s/auto/size_t/Simon Warta2015-07-031-1/+1
|
* More changes for use with debug STLSimon Warta2015-06-301-1/+5
|
* lib/math: Convert &vec[0] to vec.data()Daniel Seither2015-06-2012-35/+35
|
* Add missing includelloyd2015-05-311-0/+1
|
* Fix various bugs found by Coverity scanner.lloyd2015-05-153-0/+7
| | | | | | | Uninitialized variables, missing divide by zero checks, missing virtual destructor, etc. Only thing serious is bug in TLS maximum fragment decoder; missing breaks in switch statement meant receiver would treat any negotiated max frament as 4k limit.
* Fixlloyd2015-04-121-1/+1
|
* Remove the stray binary character making Python3 unhappy, removelloyd2015-04-121-3/+2
| | | | encoding= flags since they are not needed anymore and broke Python2.
* Cleanupslloyd2015-03-231-1/+1
|
* Specify class name for static functionlloyd2015-03-131-1/+1
|
* Add BigInt::encode_1363 writing to specified bufferlloyd2015-03-112-3/+10
|
* Add BOTAN_DLL back to LibraryInitializer and move some of the implementation tolloyd2015-03-111-1/+3
| | | | | | | a source file. Without BOTAN_DLL the LibraryInitializer was removed entirely from the list of symbols which is not desired. Add some casts to avoid scary sounding but (upon review) harmless warnings from MSVC
* Comile fixes for VC 2013. Based on github pull 56neusdan2015-03-101-1/+1
|
* Add specialized reducers for P-192, P-224, P-256 and P-384lloyd2015-02-266-55/+667
|
* Remove algo factory, engines, global RNG, global state, etc.lloyd2015-02-041-2/+0
| | | | | | | | | | | | | | | Convert all uses of Algorithm_Factory and the engines to using Algo_Registry The shared pool of entropy sources remains but is moved to EntropySource. With that and few remaining initializations (default OIDs and aliases) moved elsewhere, the global state is empty and init and shutdown are no-ops. Remove almost all of the headers and code for handling the global state, except LibraryInitializer which remains as a compatability stub. Update seeding for blinding so only one hacky almost-global RNG instance needs to be setup instead of across all pubkey uses (it uses either the system RNG or an AutoSeeded_RNG if the system RNG is not available).
* Convert PK operations to using Algo_Registry instead of Engine.lloyd2015-02-031-18/+6
| | | | Remove global PRNG.
* Add missing files. Remove cipher lookup from engine code.lloyd2015-02-012-10/+3
|
* Reference the EC point add and double algorithms usedlloyd2015-01-241-0/+8
|
* Ensure all files have copyright and license info.lloyd2015-01-1046-46/+46
| | | | | Update license header line to specify the terms and refer to the file, neither of which it included before.
* This assumed other headers it did not includelloyd2015-01-081-1/+2
|
* Side channel commentarylloyd2015-01-082-0/+26
|
* Inline BigInt::get_bit and byte_atlloyd2015-01-082-23/+9
|
* Switch to using Montgomery ladder for EC point multiplication.lloyd2014-12-101-48/+4
| | | | | The test function create_random_point did not actually create a point on the curve - fix.
* Add specialized reduction for P-521 along with 9x9 Comba routines.lloyd2014-11-1511-12/+461
| | | | | Roughly 35-50% faster on my laptop (depending on if mlock is enabled, the overhead in that allocator is becoming much more of a hotspot).
* Use noexcept on swaplloyd2014-11-041-1/+1
|
* Handle new source filelloyd2014-10-061-4/+0
|
* Asserts here are nicelloyd2014-08-091-2/+7
|
* Move mul and square operations on a elliptic curve to CurveGFp so welloyd2014-08-094-213/+279
| | | | | can use different representations/operations depending on the curve (eg, using a specialized version for P-256 reduction)
* Avoid GCC 4.9 strict-overflow warninglloyd2014-05-031-3/+2
|
* Any fixed MR iterations is probably wrong for somebody. Allow the userlloyd2014-04-254-7/+49
| | | | | | to specify a probability as well as if n was randomly chosen or not. If the input is random use a better bounds to reduce the number of needed tests.
* Use 20 Miller-Rabin iterations regardless of the size of the integer. Thislloyd2014-04-134-186/+42
| | | | | provides a much better worst-case error bound. Also take the nonce from anywhere in the usable range rather than limiting the bit size.
* Fix a bug in Miller-Rabin primality testing introduced in 1.8.3lloyd2014-04-101-5/+6
| | | | | | | | where we chose a single random nonce and tested it repeatedly, rather than choosing new nonces each time. Reported by Jeff Marrison. Also remove a pointless comparison (also pointed out by Jeff) and add an initial test using a witness of 2.
* Avoid a ubsan warning on GCC 4.9 due uninitialized sign enum beinglloyd2014-03-302-5/+1
| | | | read during swap (in the move constructor)
* Clang fixeslloyd2014-02-091-1/+0
|
* Guess I won't be needing theselloyd2014-01-181-1/+0
|
* Move lib into srclloyd2014-01-1051-0/+8875