aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils
Commit message (Collapse)AuthorAgeFilesLines
* Make Montgomery reduction constant time.Jack Lloyd2015-10-241-71/+48
| | | | | | | | | | | | | | It was already close, but the carry loop would break early and selecting which value to copy out was indexed on the borrow bit. Have the carry loop run through, and add a const-time conditional copy operation and use that to copy the output. Convert ct_utils to CT namespace. Templatize the utils, which I was hesitant to do initially but is pretty useful when dealing with arbitrary word sizes. Remove the poison macros, replace with inline funcs which reads cleaner at the call site.
* Make OpenSSL ECDSA and RSA request only until they can be testedJack Lloyd2015-10-191-2/+2
|
* Break up openssl providerJack Lloyd2015-10-192-0/+51
| | | | | | For RSA, RC4, and ECDSA put the openssl versions in the same directory as the base version. They just rely on a macro check for the openssl module to test for the desire to use OpenSSL.
* Cleanups in ct and oaepJack Lloyd2015-10-171-87/+12
| | | | In OAEP expand the const time block to cover MGF1 also
* Make PKCS #1 and OAEP decoding constant time to avoid oracle attacksJack Lloyd2015-10-164-125/+209
| | | | | | | | via timing channels. Add annotations for checking constant-time code using ctgrind to PKCS #1 and OAEP, as well as IDEA and Curve25519 which were already written as constant time code.
* Merge pull request #298 from tiwoc/arm64Simon Warta2015-10-161-2/+2
|\ | | | | Support for 64 bit ARM
| * Initial support for 64 bit ARMDaniel Seither2015-10-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for 64 bit ARM cores as used in many high-end phones such as all iPhones beginning with the 5s. While these newer phones still run 32 bit ARM code, Apple doesn't allow apps to be submitted to the app store if they don't provide a 64 bit build. This commit adds a new arm64 arch and renames arm to arm32 to stay consistent with the other architectures. The name arm can still be used for configuring because it has been added as an alias for arm32. Additionally, the one piece of ARM inline assembly that can be found in Botan doesn't work on 64 bit ARM, so I use the solution that has been proposed in #180: Use __builtin_bswap32 instead of inline assembly.
* | Move DataSource to utils and rewrite PEM encoding to avoid filtersJack Lloyd2015-10-143-0/+393
|/ | | | | Removes filters as as an internal dependency pretty much entirely (outside of some dusty corners in misc).
* Avoid concatination of charsSimon Warta2015-09-221-1/+1
| | | | | | | Ever tried? auto str = "some long string"; auto str2 = str + '\n'; It's not with the brainfuck finding the bug.
* Move boost and sqlite3 to utilsJack Lloyd2015-09-224-0/+220
|
* Move check for SIMD instructions to CPUIDJack Lloyd2015-09-215-6/+15
| | | | | | Avoids needing to include simd_32 to see if SIMD is disabled. This had caused a build break on Linux x86-32 as SSE2 must be enabled on a per-file basis.
* Internal header cleanupsJack Lloyd2015-09-196-18/+143
| | | | Only user-visible change is the removal of get_byte.h
* Remove alloc module; move secmem.h to base and locking_allocator to utilsJack Lloyd2015-08-294-3/+358
|
* Refactor ./botan speedSimon Warta2015-08-211-0/+10
| | | | | | | * Add random_prime benchmark * Add is_prime benchmark * Respect runtime in benchmark_transform(). This sets default runtime from 2s to 0.5s per configuration
* Add stricter time parsing; Add more testsSimon Warta2015-08-111-0/+11
|
* Strict uint32 parsingSimon Warta2015-08-111-0/+10
|
* Avoid integer overlow in string->uint32 converterSimon Warta2015-08-101-3/+16
| | | | | | | On systems where unsigned long is uint64 (typically 64 bit systems), a string containing a number greater than 2^32-1 was sucessfully converted to a uint64 and than reduced to uint32, causing an overflow. E.g. to_u32bit("4294967296") was 0 and to_u32bit("4294967297") was 1.
* Merge pull request #232 from tiwoc/clang-cpuidSimon Warta2015-08-031-1/+1
|\ | | | | Enable use of cpuid.h with clang
| * Enable use of cpuid.h with clangDaniel Seither2015-07-301-1/+1
| |
* | utils: Add missing overridesDaniel Seither2015-07-301-1/+1
|/
* Add boost implementation of timegm()Simon Warta2015-07-271-0/+36
|
* Add mktime fallback for non-POSIX timegm()Simon Warta2015-07-271-5/+56
| | | | Closes #202
* Avoid 0 as nullpointer warning on MinGWSimon Warta2015-07-271-1/+1
|
* Remove the x86 asm versions of MD4, MD5, SHA-1 and SerpentJack Lloyd2015-07-254-305/+0
| | | | | | | With modern compilers, all are slower than the C++ and SSE2 versions of the same algos. GH #216
* Add Android OSDaniel Seither2015-07-173-0/+4
| | | | | | The android.txt is a copy of linux.txt minus the getsid feature (Android's libc, Bionic, doesn't support it) and the alias linux-gnu. It is supported anywhere where linux is supported.
* Add MSVC stl filesystem implementationSimon Warta2015-07-162-3/+31
| | | | Closes #199
* Refactor internal/filesystem.hSimon Warta2015-07-164-38/+61
| | | | Closes #198
* Add missing include <string> in calendar.hSimon Warta2015-07-161-0/+1
|
* Fix time range issue for 32 bit platformsSimon Warta2015-07-162-6/+39
|
* Fix round_upSimon Warta2015-07-153-10/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix to_string for BER_Object when debug STL is usedSimon Warta2015-07-071-0/+7
|
* Use <cstdint>; Remove unused namespace Botan_typesSimon Warta2015-07-031-22/+14
|
* lib/utils: Convert &vec[0] to vec.data()Simon Warta2015-06-235-13/+12
|
* Add missing headers fixing GCC 4.7 buildlloyd2015-06-171-0/+1
|
* Avoid 0-defining BOTAN_USE_GCC_INLINE_ASMsimon2015-05-312-4/+4
| | | | GH #103
* Fix code that triggers a strange MSVC 'performance warning'git2015-04-081-1/+1
| | | | Github pull 74 from Chris Desjardins
* Comile fixes for VC 2013. Based on github pull 56neusdan2015-03-101-0/+4
|
* Add BOTAN_NOEXCEPT macro to work around missing noexcept in VS 2013.rcdailey2015-03-081-1/+1
| | | | Based on github pull req 23 by Robert Daily.
* Fix macro checks for zero_mem. Github 55lloyd2015-03-061-2/+2
|
* Add missing includes, broke clanglloyd2015-03-041-0/+2
|
* Add specialized reducers for P-192, P-224, P-256 and P-384lloyd2015-02-261-0/+1
|
* Hide all uses of boost filesystem in fs.cpp. Use readdir as anlloyd2015-02-213-0/+102
| | | | | alternate implementation for Unix and add some feature checks so a boost-free build of the tests and command line are possible again.
* Add version_cstr (returns const char*) and move tag_size from AEAD tolloyd2015-02-112-0/+7
| | | | Cipher_Mode. Add missing includes in entropy sources, noticed by clang.
* Move Cipher_Mode enum out of types.h, move stream cipher mode to new headerlloyd2015-02-051-6/+0
|
* Enable OpenSSL for providing ciphers and hashes again.lloyd2015-02-054-217/+0
|
* Remove algo factory, engines, global RNG, global state, etc.lloyd2015-02-0414-13/+668
| | | | | | | | | | | | | | | 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-6/+6
| | | | Remove global PRNG.
* Add a runtime map of string->func() which when called returnlloyd2015-01-283-17/+34
| | | | | | | | | | | | | | | | | Transforms and BlockCiphers. Registration for all types is done at startup but is very cheap as just a std::function and a std::map entry are created, no actual objects are created until needed. This is a huge improvement over Algorithm_Factory which used T::clone() as the function and thus kept a prototype object of each type in memory. Replace existing lookup mechanisms for ciphers, AEADs, and compression to use the transform lookup. The existing Engine framework remains in place for BlockCipher, but the engines now just call to the registry instead of having hardcoded lookups. s/Transformation/Transform/ with typedefs for compatability. Remove lib/selftest code (for runtime selftesting): not the right approach.
* Reference memset via std namespacelloyd2015-01-271-1/+1
|
* Don't define overloads if there is no native uint128_t. Github 47lloyd2015-01-271-0/+2
|