summaryrefslogtreecommitdiff
path: root/src/basic/siphash24.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-2/+1
|
* headers: add spdx tags to imported files with a known licenseZbigniew Jędrzejewski-Szmek2020-10-291-1/+3
| | | | | | | | | | | | | | | I added the header in the cases where the license text is present and it is easy to find the appropriate SPDX header. For "public domain" stuff: SDPX treats each "public domain" license as unique [1], but luckily the one in siphash24.c is one of the identified variants. There are some other cases which specify "public domain" but there doesn't seem to be a SPDX identifier. [1] https://wiki.spdx.org/view/Legal_Team/Decisions/Dealing_with_Public_Domain_within_SPDX_Files gunicode.[ch] are imported from glib, which is licensed as LGPL2.1+, see https://gitlab.gnome.org/GNOME/glib/-/blob/master/glib/gunicode.h.
* util: make siphash24_compress_boolean() inlineYu Watanabe2020-07-221-6/+0
| | | | | This also changes the stored type from int to uint8_t in order to make hash value endianness independent.
* util: introduce siphash24_compress_boolean()Yu Watanabe2019-06-191-0/+6
|
* Remove 'inline' attributes from static functions in .c files (#11426)Topi Miettinen2019-01-151-2/+2
| | | Let the compiler perform inlining (see #11397).
* tree-wide: use c99 static for array size declarationsZbigniew Jędrzejewski-Szmek2019-01-041-2/+2
| | | | | | | | | | | | | | | | https://hamberg.no/erlend/posts/2013-02-18-static-array-indices.html This only works with clang, unfortunately gcc doesn't seem to implement the check (tested with gcc-8.2.1-5.fc29.x86_64). Simulated error: [2/3] Compiling C object 'systemd-nspawn@exe/src_nspawn_nspawn.c.o'. ../src/nspawn/nspawn.c:3179:45: warning: array argument is too small; contains 15 elements, callee requires at least 16 [-Warray-bounds] candidate = (uid_t) siphash24(arg_machine, strlen(arg_machine), hash_key); ^ ~~~~~~~~ ../src/basic/siphash24.h:24:64: note: callee declares array parameter as static here uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[static 16]); ^~~~~~~~~~~~
* meson: also add option for debugging siphashYu Watanabe2018-11-231-4/+4
|
* tree-wide: adjust fall through comments so that gcc is happyShawn Landden2017-11-201-7/+7
| | | | | | | | Distcc removes comments, making the comment silencing not work. I know there was a decision against a macro in commit ec251fe7d5bc24b5d38b0853bc5969f3a0ba06e2
* tree-wide: adjust fall through comments so that gcc is happyZbigniew Jędrzejewski-Szmek2017-01-311-0/+7
| | | | | | | | | | | | | | | 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.)
* missing include added for build with -DDEBUG (#3424)Tobias Jungel2016-06-031-0/+2
|
* basic: re-sort includesThomas Hindoe Paaboel Andersen2015-12-011-1/+1
| | | | | My previous patch to only include what we use accidentially placed the added inlcudes in non-sorted order.
* basic: include only what we useThomas Hindoe Paaboel Andersen2015-11-301-2/+1
| | | | | This is a cleaned up result of running iwyu but without forward declarations on src/basic.
* siphash: minor coding style fixes and modernizationsLennart Poettering2015-11-171-42/+51
| | | | Only cosmetics really, doesn't change any actual logic.
* siphash: fix another alignment issueLennart Poettering2015-11-171-2/+2
|
* Merge pull request #1923 from zonque/siphashLennart Poettering2015-11-171-4/+5
|\ | | | | siphash24: let siphash24_finalize() and siphash24() return the result…
| * siphash24: let siphash24_finalize() and siphash24() return the result directlyDaniel Mack2015-11-161-4/+5
| | | | | | | | | | | | | | | | | | | | 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.
* | tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-2/+1
|/ | | | Sort the includes accoding to the new coding style.
* siphash24: change result argument to uint64_tMartin Pitt2015-11-161-2/+2
| | | | | | | | | | | | 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.
* siphash24: fix memory alignmentDaniel Mack2015-11-161-1/+2
| | | | | | | Use unaligned_read_le64() to access input buffer when reading complete 64-bit words. This should fix memory traps on platforms with strict aliasing.
* siphash24: coding-style fixesTom Gundersen2015-10-061-126/+122
| | | | Drop custom types. Drop unnecessary macros. Fix whitespace. Add asserts.
* siphash24: unify APITom Gundersen2015-10-061-8/+7
| | | | | | | 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.
* siphash24: expose the internal helper functionsTom Gundersen2015-10-051-12/+3
|
* siphash24: make siphash24_compress decomposableTom Gundersen2015-10-051-4/+33
| | | | | | This allows the input to siphash24_compress to be decomposed into smaller chunks and the function to be called on each individual chunk.
* siphash24: move last compression iteration from compression step to ↵Tom Gundersen2015-10-051-26/+32
| | | | | | | 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.
* siphash24: split out the compression stepTom Gundersen2015-10-051-36/+43
|
* siphash24: split out the finalization stepTom Gundersen2015-10-051-6/+13
|
* siphash24: introduce state structTom Gundersen2015-10-051-42/+54
| | | | | Encapsulate the four state variables in a struct so we can more easily pass them around.
* build-sys: split internal basic/ library from shared/Kay Sievers2015-06-111-0/+135
basic/ can be used by everything cannot use anything outside of basic/ libsystemd/ can use basic/ cannot use shared/ shared/ can use libsystemd/