Lines Matching +full:key +full:- +full:2
1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /* Copyright (C) 2016-2022 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
4 * SipHash: a fast short-input PRF
7 * This implementation is specifically for SipHash2-4 for a secure PRF
8 * and HalfSipHash1-3/SipHash1-3 for an insecure PRF only suitable for
20 u64 key[2]; member
25 static inline bool siphash_key_is_zero(const siphash_key_t *key) in siphash_key_is_zero() argument
27 return !(key->key[0] | key->key[1]); in siphash_key_is_zero()
30 u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key);
31 u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key);
33 u64 siphash_1u64(const u64 a, const siphash_key_t *key);
34 u64 siphash_2u64(const u64 a, const u64 b, const siphash_key_t *key);
36 const siphash_key_t *key);
38 const siphash_key_t *key);
39 u64 siphash_1u32(const u32 a, const siphash_key_t *key);
41 const siphash_key_t *key);
44 const siphash_key_t *key) in siphash_2u32() argument
46 return siphash_1u64((u64)b << 32 | a, key); in siphash_2u32()
49 const u32 d, const siphash_key_t *key) in siphash_4u32() argument
51 return siphash_2u64((u64)b << 32 | a, (u64)d << 32 | c, key); in siphash_4u32()
56 const siphash_key_t *key) in ___siphash_aligned() argument
59 return siphash_1u32(le32_to_cpup((const __le32 *)data), key); in ___siphash_aligned()
61 return siphash_1u64(le64_to_cpu(data[0]), key); in ___siphash_aligned()
64 key); in ___siphash_aligned()
67 le64_to_cpu(data[2]), key); in ___siphash_aligned()
70 le64_to_cpu(data[2]), le64_to_cpu(data[3]), in ___siphash_aligned()
71 key); in ___siphash_aligned()
72 return __siphash_aligned(data, len, key); in ___siphash_aligned()
76 * siphash - compute 64-bit siphash PRF value
79 * @key: the siphash key
82 const siphash_key_t *key) in siphash() argument
86 return __siphash_unaligned(data, len, key); in siphash()
87 return ___siphash_aligned(data, len, key); in siphash()
92 unsigned long key[2]; member
96 const hsiphash_key_t *key);
98 const hsiphash_key_t *key);
100 u32 hsiphash_1u32(const u32 a, const hsiphash_key_t *key);
101 u32 hsiphash_2u32(const u32 a, const u32 b, const hsiphash_key_t *key);
103 const hsiphash_key_t *key);
105 const hsiphash_key_t *key);
108 const hsiphash_key_t *key) in ___hsiphash_aligned() argument
111 return hsiphash_1u32(le32_to_cpu(data[0]), key); in ___hsiphash_aligned()
114 key); in ___hsiphash_aligned()
117 le32_to_cpu(data[2]), key); in ___hsiphash_aligned()
120 le32_to_cpu(data[2]), le32_to_cpu(data[3]), in ___hsiphash_aligned()
121 key); in ___hsiphash_aligned()
122 return __hsiphash_aligned(data, len, key); in ___hsiphash_aligned()
126 * hsiphash - compute 32-bit hsiphash PRF value
129 * @key: the hsiphash key
132 const hsiphash_key_t *key) in hsiphash() argument
136 return __hsiphash_unaligned(data, len, key); in hsiphash()
137 return ___hsiphash_aligned(data, len, key); in hsiphash()