hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/linux/siphash.h
....@@ -136,4 +136,32 @@
136136 return ___hsiphash_aligned(data, len, key);
137137 }
138138
139
+/*
140
+ * These macros expose the raw SipHash and HalfSipHash permutations.
141
+ * Do not use them directly! If you think you have a use for them,
142
+ * be sure to CC the maintainer of this file explaining why.
143
+ */
144
+
145
+#define SIPHASH_PERMUTATION(a, b, c, d) ( \
146
+ (a) += (b), (b) = rol64((b), 13), (b) ^= (a), (a) = rol64((a), 32), \
147
+ (c) += (d), (d) = rol64((d), 16), (d) ^= (c), \
148
+ (a) += (d), (d) = rol64((d), 21), (d) ^= (a), \
149
+ (c) += (b), (b) = rol64((b), 17), (b) ^= (c), (c) = rol64((c), 32))
150
+
151
+#define SIPHASH_CONST_0 0x736f6d6570736575ULL
152
+#define SIPHASH_CONST_1 0x646f72616e646f6dULL
153
+#define SIPHASH_CONST_2 0x6c7967656e657261ULL
154
+#define SIPHASH_CONST_3 0x7465646279746573ULL
155
+
156
+#define HSIPHASH_PERMUTATION(a, b, c, d) ( \
157
+ (a) += (b), (b) = rol32((b), 5), (b) ^= (a), (a) = rol32((a), 16), \
158
+ (c) += (d), (d) = rol32((d), 8), (d) ^= (c), \
159
+ (a) += (d), (d) = rol32((d), 7), (d) ^= (a), \
160
+ (c) += (b), (b) = rol32((b), 13), (b) ^= (c), (c) = rol32((c), 16))
161
+
162
+#define HSIPHASH_CONST_0 0U
163
+#define HSIPHASH_CONST_1 0U
164
+#define HSIPHASH_CONST_2 0x6c796765U
165
+#define HSIPHASH_CONST_3 0x74656462U
166
+
139167 #endif /* _LINUX_SIPHASH_H */