aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block
Commit message (Collapse)AuthorAgeFilesLines
* Threefish-512 AVX2 optimizationsJack Lloyd2016-08-101-76/+165
| | | | | | | | | | | Remove loop variable R, instead derive from macro param constant Support 2 block parallel decrypt, improves raw perf from 456 MB/s to 710 MB/s for decrypt. Switch to alternate key schedule for encrypt. Uses 3 ymm registers instead of 9 at the cost of more computation. Not much faster on Skylake, unclear if this is worthwhile.
* Empty the key/tweak containers which is used to signal the key was setJack Lloyd2016-04-151-3/+3
| | | | Fix exception message
* Merge branch 'master' into clang-analyzerDaniel Neus2016-03-065-6/+6
|\
| * cppcheck fixes: Class 'X' has a constructor with 1 argument that is not ↵Daniel Neus2016-03-055-6/+6
| | | | | | | | explicit.
* | added an assert for aes key length >= 4 in aes_key_schedule to prevent ↵Daniel Neus2016-03-021-0/+6
| | | | | | | | division by zero found by clang-analyzer
* | fix dead assignment / redundant computation in block/aes_ssse3/aes_ssse3.cpp ↵Daniel Neus2016-03-021-2/+0
|/ | | | in aes_schedule_transform found by clang-analyzer
* Avoid some Wshadows in GCC 4.8Jack Lloyd2016-02-201-2/+2
| | | | | | | | | | | | | | | In GCC 4.7 and 4.8, Wshadow also warns if a local variable conflicts with a member function. This was changed in GCC 4.9 (GCC bugzilla 57709) but causes a lot of warnings on Travis which is on 4.8. Clang's Wshadow behaves like GCC 4.9 The worst offendor was Exception's constructor argument being named `what` which conflicts with the member function of the same name, being in a public header this causes so many warnings the Travis log files are truncated. This fixes Exception and a couple of others. Fixing all cases would be a slog that I'm not up for right at the moment.
* Add final attribute to many classesJack Lloyd2016-01-1027-36/+36
| | | | | | | In some cases this can offer better optimization, via devirtualization. And it lets the user know the class is not intended for derivation. Some discussion in GH #402
* Mass-prefix member vars with m_René Korthaus2016-01-0848-666/+666
|
* Use valgrind's memcheck API for checking const time annotationsJack Lloyd2016-01-031-1/+32
| | | | | | | Has the same effect as using ctgrind, but without requiring a custom-compiled valgrind binary. Add ct checking annotations to the SSSE3 AES code.
* Add cast to a suspcious looking (but actually ok in this case) shift in MARSJack Lloyd2016-01-011-1/+1
| | | | j is never more than 30 in this loop
* Drop seed_tabJack Lloyd2016-01-011-192/+0
| | | | | (Two part commit with 64caa9a to work around git's insane implied rename system)
* Inline SEED's sbox tablesJack Lloyd2016-01-012-33/+203
| | | | Simpler, and a bit faster also it seems (but not fast)
* Merge the openssl code together.Jack Lloyd2015-12-192-219/+0
| | | | | | | Having the code diffused all over the place was ugly and would not scale well to multiple alternative providers. GH #368
* Reroot the exception hierarchy into a toplevel Exception classJack Lloyd2015-12-112-3/+3
| | | | | | | | As the alternatives are unfortunate for applications trying to catch all library errors, and it seems deriving from std::runtime_error causes problems with MSVC DLLs (GH #340) Effectively reverts 2837e915d82e43
* Improve side channel attack resistance of table based AES implJack Lloyd2015-11-291-414/+147
|
* Make Montgomery reduction constant time.Jack Lloyd2015-10-242-20/+20
| | | | | | | | | | | | | | 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.
* Break up openssl providerJack Lloyd2015-10-192-0/+219
| | | | | | 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.
* Make PKCS #1 and OAEP decoding constant time to avoid oracle attacksJack Lloyd2015-10-162-13/+34
| | | | | | | | 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.
* Delete Camellia sbox header.Jack Lloyd2015-09-222-550/+1
| | | | Two part commit with bd99a4f to work around git's insane rename system.
* Inline Camellia sbox tables to source fileJack Lloyd2015-09-221-3/+530
|
* Move check for SIMD instructions to CPUIDJack Lloyd2015-09-211-7/+3
| | | | | | 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.
* Remove use of lookup.h in favor of new T::create API.Jack Lloyd2015-09-212-6/+4
|
* Address some review comments by Simon. GH #279Jack Lloyd2015-09-212-2/+2
|
* Internal header cleanupsJack Lloyd2015-09-195-40/+16
| | | | Only user-visible change is the removal of get_byte.h
* Handle dependencies re static linking. GH #279Jack Lloyd2015-09-172-0/+24
| | | | | | | | | | | | | | Previously we were hanging on the type destructors to pull in the relevant objects. However that fails in many simple cases where the object is never deleted. For every type involved in the algo registry add static create and providers functions to access the algo registry. Modify lookup.h to be inline and call those functions, and move a few to sub-headers (eg, get_pbkdf going to pbkdf.h). So accessing the registry involves going through the same file that handles the initialization, so there is no way to end up with missing objs.
* Fix for minimized buildsJack Lloyd2015-09-111-1/+4
|
* Fix static lib registration for block, hash, mac, stream, kdfJack Lloyd2015-09-1036-126/+326
| | | | | | | | | | | The support problems from having static libraries not work in the obvious way will be endless trouble. Instead have each set of registrations tag along in a source file for the basic type, at the cost of some extra ifdefs. On shared libs this is harmless - everything is going into the shared object anyway. With static libs, this means pulling in a single block cipher pulls in the text of all the them. But that's still strictly better than the amalgamation (which is really pulling in everything), and it works (unlike status quo).
* Reverse the algorithm priority orderingJack Lloyd2015-08-297-11/+19
| | | | | | Previously 0 was the highest priority and 255 was the lowest. But this is really quite confusing, instead treat 0 as lowest and 255 as highest so normal integer intuitions apply.
* block: Add missing overridesDaniel Seither2015-07-3031-228/+228
|
* Remove the x86 asm versions of MD4, MD5, SHA-1 and SerpentJack Lloyd2015-07-254-802/+0
| | | | | | | With modern compilers, all are slower than the C++ and SSE2 versions of the same algos. GH #216
* Silence some extra ';' warningsSimon Warta2015-07-221-2/+3
|
* Fix module combi: adler32,threefish_avx2Simon Warta2015-07-081-0/+4
|
* Fix compilation by Clang with _LIBCPP_DEBUGLSK2015-07-081-4/+4
|
* More changes for use with debug STLSimon Warta2015-06-301-1/+1
|
* lib/block: Convert &vec[0] to vec.data()Simon Warta2015-06-2713-59/+59
|
* Hide Algorithm_Factory and use the functions in lookup.h internally.lloyd2015-03-042-5/+4
| | | | | | Fix two memory leaks (in TLS and modes) caused by calling get_foo and then cloning the result before saving it (leaking the original object), a holdover from the conversion between construction techniques in 1.11.14
* Clean up root dir, remove some unneeded dependencieslloyd2015-02-051-5/+0
|
* Enable OpenSSL for providing ciphers and hashes again.lloyd2015-02-051-0/+1
|
* Remove algo factory, engines, global RNG, global state, etc.lloyd2015-02-0414-31/+16
| | | | | | | | | | | | | | | 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).
* Add missing files. Remove cipher lookup from engine code.lloyd2015-02-011-0/+36
|
* Use registry for streams and MACs. Start updating callers.lloyd2015-01-311-6/+4
|
* Use Algo_Registry also for hashes.lloyd2015-01-283-8/+5
|
* Add a runtime map of string->func() which when called returnlloyd2015-01-2838-68/+175
| | | | | | | | | | | | | | | | | 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.
* Ensure all files have copyright and license info.lloyd2015-01-1075-75/+75
| | | | | Update license header line to specify the terms and refer to the file, neither of which it included before.
* Fix various warnings from VC++ 2014 and add missing includelloyd2014-10-311-1/+1
|
* Remove Square, Skipjack, Luby-Rackoff, and Blue Midnight Wish.lloyd2014-02-0810-1147/+0
|
* Have Skein call Threefish, rather than duplicating the code.lloyd2014-02-082-8/+60
|
* Guess I won't be needing theselloyd2014-01-183-3/+0
|
* Use unique_ptr instead of bare pointers and explicit delete in block, mac, hash.lloyd2014-01-186-145/+133
| | | | m_ namespaced everything while I'm in there. Changed CMAC poly_double signature.