Commit Graph

22 Commits

Author SHA1 Message Date
Yu Watanabe d6601495be meson: also add option for debugging siphash 2018-11-23 00:36:35 +09:00
Shawn Landden 4831981d89 tree-wide: adjust fall through comments so that gcc is happy
Distcc removes comments, making the comment silencing
not work.

I know there was a decision against a macro in commit
ec251fe7d5
2017-11-20 13:06:25 -08:00
Zbigniew Jędrzejewski-Szmek ec251fe7d5 tree-wide: adjust fall through comments so that gcc is happy
gcc 7 adds -Wimplicit-fallthrough=3 to -Wextra. There are a few ways
we could deal with that. After we take into account the need to stay compatible
with older versions of the compiler (and other compilers), I don't think adding
__attribute__((fallthrough)), even as a macro, is worth the trouble. It sticks
out too much, a comment is just as good. But gcc has some very specific
requiremnts how the comment should look. Adjust it the specific form that it
likes. I don't think the extra stuff we had in those comments was adding much
value.

(Note: the documentation seems to be wrong, and seems to describe a different
pattern from the one that is actually used. I guess either the docs or the code
will have to change before gcc 7 is finalized.)
2017-01-31 14:04:55 -05:00
Tobias Jungel ac9b215d0c missing include added for build with -DDEBUG (#3424) 2016-06-03 12:33:12 +02:00
Thomas Hindoe Paaboel Andersen 93cc7779e0 basic: re-sort includes
My previous patch to only include what we use accidentially placed
the added inlcudes in non-sorted order.
2015-12-01 23:40:17 +01:00
Thomas Hindoe Paaboel Andersen 11c3a36649 basic: include only what we use
This is a cleaned up result of running iwyu but without forward
declarations on src/basic.
2015-11-30 21:51:03 +01:00
Lennart Poettering 6059dab889 siphash: minor coding style fixes and modernizations
Only cosmetics really, doesn't change any actual logic.
2015-11-17 01:08:44 +01:00
Lennart Poettering 4de91d7eaf siphash: fix another alignment issue 2015-11-17 00:56:05 +01:00
Lennart Poettering 357bc17975 Merge pull request #1923 from zonque/siphash
siphash24: let siphash24_finalize() and siphash24() return the result…
2015-11-17 00:32:06 +01:00
Daniel Mack 933f9caeeb siphash24: let siphash24_finalize() and siphash24() return the result directly
Rather than passing a pointer to return the result, return it directly
from the function calls.

Also, return the result in native endianess, and let the callers care
about the conversion. For hash tables and bloom filters, we don't care,
but in order to keep MAC addresses and DHCP client IDs stable, we
explicitly convert to LE.
2015-11-16 23:17:52 +01:00
Thomas Hindoe Paaboel Andersen cf0fbc49e6 tree-wide: sort includes
Sort the includes accoding to the new coding style.
2015-11-16 22:09:36 +01:00
Martin Pitt dbe81cbd2a siphash24: change result argument to uint64_t
Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which
enforce pointer alignment this fixes crashes when we previously cast an
unaligned array to uint64_t*, and on others this should at least improve
performance as the compiler now aligns these properly.

This also simplifies the code in most cases by getting rid of typecasts. The
only place which we can't change is struct duid's en.id, as that is _packed_
and public API, so we can't enforce alignment of the "id" field and have to
use memcpy instead.
2015-11-16 15:20:29 +01:00
Daniel Mack 8dd85afe76 siphash24: fix memory alignment
Use unaligned_read_le64() to access input buffer when reading complete
64-bit words.

This should fix memory traps on platforms with strict aliasing.
2015-11-16 15:19:23 +01:00
Tom Gundersen 17010c230e siphash24: coding-style fixes
Drop custom types. Drop unnecessary macros. Fix whitespace. Add asserts.
2015-10-06 17:47:00 +02:00
Tom Gundersen 0cb3c28688 siphash24: unify API
Make the API of the new helpers more similar to the old wrapper.

In particular we now return the hash as a byte string to avoid
any endianness problems.
2015-10-06 17:47:00 +02:00
Tom Gundersen 7c57f504c9 siphash24: expose the internal helper functions 2015-10-05 17:33:58 +02:00
Tom Gundersen 2c4cc3bdcd siphash24: make siphash24_compress decomposable
This allows the input to siphash24_compress to be decomposed into
smaller chunks and the function to be called on each individual
chunk.
2015-10-05 17:33:58 +02:00
Tom Gundersen f2936011c5 siphash24: move last compression iteration from compression step to finalization step
The last compression is special as it deals with the length byte, and padding. Move
it to the finalization step in preparation for making compression decomposable.
2015-10-05 17:33:58 +02:00
Tom Gundersen c7b68d84e4 siphash24: split out the compression step 2015-10-05 17:33:58 +02:00
Tom Gundersen 9e77e048d4 siphash24: split out the finalization step 2015-10-05 17:33:58 +02:00
Tom Gundersen 708684ef22 siphash24: introduce state struct
Encapsulate the four state variables in a struct so we can more easily pass
them around.
2015-10-05 17:33:58 +02:00
Kay Sievers a095315b3c build-sys: split internal basic/ library from shared/
basic/      can be used by everything
            cannot use anything outside of basic/

libsystemd/ can use basic/
            cannot use shared/

shared/     can use libsystemd/
2015-06-11 10:52:46 +02:00
Renamed from src/shared/siphash24.c (Browse further)