aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils
Commit message (Collapse)AuthorAgeFilesLines
* Add checks that keyed algorithms are actually keyed before useJack Lloyd2017-10-262-0/+10
| | | | | Previously calling update or encrypt without calling set_key first would result in invalid outputs or else crashing.
* Skip ARM32 specific byteswap code, enable MSVC byteswap intrinsicsJack Lloyd2017-10-242-34/+15
| | | | | | | | | | While older versions of GCC did very badly with __builtin_bswap on ARM, I checked GCC 4.8 and it behaves correctly, emitting either rev or else the same optimal sequence as was used in the inline asm (depending on if ARMv7 is enabled or not.) Enable MSVC byteswap intrinsics, which (hopefully) work on all platforms. Drop the x86-32 specific asm for byteswap.
* Convert http:// links to https:// where possibleJack Lloyd2017-10-241-1/+1
|
* deprecate exceptionsDaniel Neus2017-10-211-3/+3
|
* Undeprecate these exceptionsJack Lloyd2017-10-192-5/+7
| | | | Cannot figure out how to get MSVC to shut up
* Another attempt at silencing MSVC warningJack Lloyd2017-10-192-6/+2
|
* Add a destructor to Policy_ViolationJack Lloyd2017-10-191-3/+4
| | | | | MSVC produces a deranged warning that the compiler generated destructor is deprecated, try to shut it up.
* Use conditional include in demaphore.hSimon Warta2017-10-191-1/+1
|
* Additional final annotationsJack Lloyd2017-10-152-3/+3
|
* De-inline bodies of exception classesJack Lloyd2017-10-153-67/+133
| | | | | | | | | This leads to a rather shocking decrease in binary sizes, especially the static library (~1.5 MB reduction). Saves 60KB in the shared lib. Since throwing or catching an exception is relatively expensive these not being inlined is not a problem in that sense. It had simply not occured to me that it would take up so much extra space in the binary.
* Use memcpy trick in 3-arg xor_buf alsoJack Lloyd2017-10-131-23/+17
|
* Somewhat faster xor_bufJack Lloyd2017-10-121-18/+15
| | | | Avoids the cast alignment problems of yesteryear
* OCB optimizationsJack Lloyd2017-10-123-68/+70
| | | | From ~5 cbp to ~2.5 cbp on Skylake
* Merge GH #1247 Improve bit rotation functionsJack Lloyd2017-10-123-56/+122
|\
| * Ugh, the GCC/Clang trick triggers C4146 under MSVCJack Lloyd2017-10-121-8/+25
| | | | | | | | | | | | And rotate.h is a visible header. Blerg. Inline asm it is.
| * Add compile-time rotation functionsJack Lloyd2017-10-123-72/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem with asm rol/ror is the compiler can't schedule effectively. But we only need asm in the case when the rotation is variable, so distinguish the two cases. If a compile time constant, then static_assert that the rotation is in the correct range and do the straightforward expression knowing the compiler will probably do the right thing. Otherwise do a tricky expression that both GCC and Clang happen to have recognize. Avoid the reduction case; instead require that the rotation be in range (this reverts 2b37c13dcf). Remove the asm rotations (making this branch illnamed), because now both Clang and GCC will create a roll without any extra help. Remove the reduction/mask by the word size for the variable case. The compiler can't optimize that it out well, but it's easy to ensure it is valid in the callers, especially now that the variable input cases are easy to grep for.
| * Use rol/ror x86 instructions on GCC/ClangJack Lloyd2017-10-111-2/+24
| | | | | | | | | | | | | | Neither is very good at recognizing rotate sequences. For cases where the rotation value is a constant they do fine, but for variable rotations they do horribly. Using inline asm here improved performance of both CAST-128 and CAST-256 by ~20% on my system with both GCC and Clang.
* | Avoid std::count to skip a signed overflow warningJack Lloyd2017-10-122-3/+13
| | | | | | | | | | | | Couldn't figure out a way to silence this otherwise. Deprecate replace_char, erase_chars, replace_chars
* | Merge GH #1245 Restructure Barrier/Semaphore to avoid signed overflow warningsJack Lloyd2017-10-122-11/+9
|\ \ | |/ |/|
| * #1220 - fixed fixes of integer overflowHubert Bugaj2017-10-102-7/+3
| |
| * #1220 - fixed signed overflow warningsHubert Bugaj2017-10-092-10/+12
| |
* | Remove SSE2 bswap_4Jack Lloyd2017-10-111-24/+0
| | | | | | | | | | It was disabled anyway (bad macro check) and with recent GCC turned out to be slower than just using bswap.
* | getenv is in standard C++Jack Lloyd2017-10-091-1/+1
| |
* | Include cstdlib to make os_utils compile with clang.Alexander Bluhm2017-10-091-0/+2
|/
* Address some bool/int conversion warnings from SonarJack Lloyd2017-10-061-2/+5
| | | | Nothing major but probably good to clean these up.
* Address various GCC warningsJack Lloyd2017-10-063-8/+10
| | | | | Things like -Wconversion and -Wuseless-cast that are noisy and not on by default.
* Add missing includeJack Lloyd2017-10-051-0/+1
| | | | | In filesystem free build, we weren't including any definition of std::istream. GH #1238
* Simplify header includes in socket.cppJack Lloyd2017-10-031-9/+3
| | | | | | This got a little contorted in os_utils.cpp because of need to support Boost asio along with system dependent interfaces. Here it's simple: Boost or Unix or Winsock.
* Merge GH #1232 Only require socket code if http_util is loadedJack Lloyd2017-10-037-305/+368
|\
| * Add missing windows.h include in os_utils.cppSimon Warta2017-10-031-0/+3
| |
| * Add missing include mem_ops.h in socket.cppSimon Warta2017-10-031-0/+2
| | | | | | | | cast_uint8_ptr_to_char is required by Winsock_Socket
| * Move socket implementation into module http_utilSimon Warta2017-10-037-308/+366
| | | | | | | | | | This removes the requirement of linking socket libraries for applications that do not use http_util
* | Avoid empty methods, use =default or add a commentJack Lloyd2017-10-031-2/+2
|/ | | | Sonar
* Force expand_mask to be on T instead of intJack Lloyd2017-10-031-1/+1
| | | | Which is what the expression evaluates to. Caught by MSVC warning.
* MSVC wants __declspec(restrict) on both declaration and definitionJack Lloyd2017-10-031-1/+1
| | | | Thankfully GCC doesn't mind it being on the definition.
* Add wrappers for reinterpret_cast between char* and uint8_t*Jack Lloyd2017-10-035-15/+35
| | | | | | | 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.
* sigemptyset is a macro on OS XJack Lloyd2017-10-021-1/+1
|
* Remove needless blockJack Lloyd2017-10-021-11/+7
|
* Prefix names in global namespace with ::Jack Lloyd2017-10-023-7/+7
|
* Use explicit_bzero on OpenBSDJack Lloyd2017-09-301-2/+7
| | | | [ci skip]
* Address some MSVC warningsJack Lloyd2017-09-302-20/+24
|
* Use class instead of struct for objects with member functionsJack Lloyd2017-09-303-119/+137
| | | | Flagged by Sonar and quite reasonable
* Add annotation so GCC/Clang/MSVC know it is an allocation function.Jack Lloyd2017-09-302-1/+12
|
* Missing include, noticed by OS XJack Lloyd2017-09-291-0/+1
|
* In secure_allocator, hide mlock/new usage in a function in mem_opsJack Lloyd2017-09-294-2/+52
| | | | | | | Switch to calloc/free instead of new/delete - shouldn't matter since we are only allocate integral types. This change reduces the size of libbotan-2.so by ~300 Kb on my system.
* Avoid throwing in pool allocator deallocation pathJack Lloyd2017-09-291-8/+1
| | | | | | std::terminate can ruin your day Coverity find
* Make poly_dbl.h a submodule of utilsJack Lloyd2017-09-274-1/+7
| | | | | Only required by a few modules and if none of them are in use then the whole thing can just be skipped from the build.
* Apply final annotations to the library alsoJack Lloyd2017-09-2213-32/+32
| | | | | Done by a perl script which converted all classes to final, followed by selective reversion where it caused compilation failures.
* Another missing includeJack Lloyd2017-09-211-0/+1
| | | | Again hitting on Kullo OS X
* Move Doxygen mainpage content to types.hJack Lloyd2017-09-211-2/+55
|