aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/loadstor.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo [ci skip]Jack Lloyd2018-11-271-1/+1
|
* Add typecast_copyJack Lloyd2018-11-171-16/+18
| | | | | Wraps memcpy in the cases where we really are doing a type conversion using memcpy
* Make a few simple functions constexprJack Lloyd2018-10-011-5/+5
| | | | This is primarily just to verify that C++11 constexpr works.
* Remove unaligned mem checkJack Lloyd2017-12-021-29/+22
| | | | | | | | | | This previously enabled doing something unsafe (misaligned reads), but it turns out even on hardware that supports this, it is not safe to do because the compiler may do something unfortunate. Now memcpy is used, which is safe on any platform. Should provide a noticable speedup for ARM and PPC64, which previously used the byte-at-a-time fallback code.
* Address various GCC warningsJack Lloyd2017-10-061-2/+2
| | | | | Things like -Wconversion and -Wuseless-cast that are noisy and not on by default.
* Change header guard format to BOTAN_FOO_H_Jack Lloyd2017-09-201-2/+2
| | | | | | ISO C++ reserves names with double underscores in them Closes #512
* Convert to using standard uintN_t integer typesJack Lloyd2016-12-181-102/+102
| | | | | | Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
* Add compiler.h macro header extracted from build.hJack Lloyd2016-11-261-10/+6
| | | | | | | | All this is just standard C that the user should not touch, so it doesn't really make sense to have it in the build.h template file. Remove BOTAN_TARGET_CPU_HAS_KNOWN_ENDIANESS - only used twice (in loadstor.h) and that code is clearer without it.
* Remove constexpr use introduced in 20f7e4ecJack Lloyd2016-10-161-5/+5
| | | | Turns out MSVC 2013 doesn't have constexpr at all (!!)
* util: Some simple constexpr usesJack Lloyd2016-10-131-5/+5
| | | | Remove unused and empty get_byte.h
* Change calls to 'get_byte' to explicitly cast parameters and eliminate ↵Dan Brown2016-04-271-1/+1
| | | | compiler warnings
* Use memcpy instead of misaligned pointer casts for reading words.Jack Lloyd2015-12-311-19/+39
| | | | | | | | | | | | | | | | | | | | | | It works on x86, but C says it is undefined and it makes UBSan unhappy. Happily, this memcpy approach probably also works fine under processors which previously used the byte-at-a-time approach such as ARM. But for right now using memcpy here is still gated under the processor alignment flags. In my tests recent GCC and Clang seemed to produce basically identical code for either approach when using -O3; I imagine most compilers these days are very good at analyzing/inlining/unrolling memcpys. Also remove the manually unrolled versions of xor_buf, which caused problems with GCC and -O3 due to it vectorizing the loads into (aligned) SSE2 loads, which would fail when a misaligned pointer was passed. Which always seemed kind of bogus to me, but I guess that's what undefined behavior is for. Enable -O3 for GCC. With this change the test suite is clean under GCC ASan+UBSan and Clang ASan+UBSan, with the exception of one failure due to a bug in libstdc++ (GCC bug 60734) when compiled by Clang.
* Guard all std::mem* ops against any call with zero length.Jack Lloyd2015-12-251-18/+24
| | | | | | | | | | Calling memset, memmove, memcpy with an undefined or null pointer, even with length zero, causes undefined behavior. Prevent that from happening within the functions that call these dangerous things since allowing a caller to pass length == 0 with null or just past the end and not have things explode is nice. Oh C, you so crazy.
* Internal header cleanupsJack Lloyd2015-09-191-1/+13
| | | | Only user-visible change is the removal of get_byte.h
* lib/utils: Convert &vec[0] to vec.data()Simon Warta2015-06-231-2/+2
|
* Centralize where string.h/cstring is included to mem_ops.hlloyd2015-01-231-1/+1
| | | | See github 42 for background
* Ensure all files have copyright and license info.lloyd2015-01-101-1/+1
| | | | | Update license header line to specify the terms and refer to the file, neither of which it included before.
* Add missing includelloyd2015-01-081-0/+1
|
* Add SHA-512/256lloyd2015-01-081-0/+42
| | | | | Define some new functions for copying out arrays of words and use them across hashes.
* Move lib into srclloyd2014-01-101-0/+627