/src/systemd/src/basic/siphash24.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* SPDX-License-Identifier: CC0-1.0 */ |
2 | | |
3 | | #pragma once |
4 | | |
5 | | #include <inttypes.h> |
6 | | #include <stddef.h> |
7 | | #include <stdint.h> |
8 | | #include <sys/types.h> |
9 | | |
10 | | #include "string-util.h" |
11 | | #include "time-util.h" |
12 | | |
13 | | struct siphash { |
14 | | uint64_t v0; |
15 | | uint64_t v1; |
16 | | uint64_t v2; |
17 | | uint64_t v3; |
18 | | uint64_t padding; |
19 | | size_t inlen; |
20 | | }; |
21 | | |
22 | | void siphash24_init(struct siphash *state, const uint8_t k[static 16]); |
23 | | void siphash24_compress(const void *in, size_t inlen, struct siphash *state); |
24 | | #define siphash24_compress_byte(byte, state) siphash24_compress((const uint8_t[]) { (byte) }, 1, (state)) |
25 | | |
26 | 0 | static inline void siphash24_compress_boolean(bool in, struct siphash *state) { |
27 | 0 | uint8_t i = in; |
28 | 0 |
|
29 | 0 | siphash24_compress(&i, sizeof i, state); |
30 | 0 | } Unexecuted instantiation: fuzz-link-parser.c:siphash24_compress_boolean Unexecuted instantiation: link-config.c:siphash24_compress_boolean Unexecuted instantiation: link-config-gperf.c:siphash24_compress_boolean |
31 | | |
32 | 0 | static inline void siphash24_compress_usec_t(usec_t in, struct siphash *state) { |
33 | 0 | siphash24_compress(&in, sizeof in, state); |
34 | 0 | } Unexecuted instantiation: fuzz-link-parser.c:siphash24_compress_usec_t Unexecuted instantiation: link-config.c:siphash24_compress_usec_t Unexecuted instantiation: link-config-gperf.c:siphash24_compress_usec_t |
35 | | |
36 | 0 | static inline void siphash24_compress_safe(const void *in, size_t inlen, struct siphash *state) { |
37 | 0 | if (inlen == 0) |
38 | 0 | return; |
39 | 0 |
|
40 | 0 | siphash24_compress(in, inlen, state); |
41 | 0 | } Unexecuted instantiation: fuzz-link-parser.c:siphash24_compress_safe Unexecuted instantiation: link-config.c:siphash24_compress_safe Unexecuted instantiation: link-config-gperf.c:siphash24_compress_safe |
42 | | |
43 | 0 | static inline void siphash24_compress_string(const char *in, struct siphash *state) { |
44 | 0 | siphash24_compress_safe(in, strlen_ptr(in), state); |
45 | 0 | } Unexecuted instantiation: fuzz-link-parser.c:siphash24_compress_string Unexecuted instantiation: link-config.c:siphash24_compress_string Unexecuted instantiation: link-config-gperf.c:siphash24_compress_string |
46 | | |
47 | | uint64_t siphash24_finalize(struct siphash *state); |
48 | | |
49 | | uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[static 16]); |
50 | | |
51 | 0 | static inline uint64_t siphash24_string(const char *s, const uint8_t k[static 16]) { |
52 | 0 | return siphash24(s, strlen(s) + 1, k); |
53 | 0 | } Unexecuted instantiation: fuzz-link-parser.c:siphash24_string Unexecuted instantiation: link-config.c:siphash24_string Unexecuted instantiation: link-config-gperf.c:siphash24_string |