android_kernel_samsung_a7y1.../lib
Jason A. Donenfeld a760cbc5c1 siphash: implement HalfSipHash1-3 for hash tables
commit 1ae2324f732c9c4e2fa4ebd885fa1001b70d52e1 upstream.

HalfSipHash, or hsiphash, is a shortened version of SipHash, which
generates 32-bit outputs using a weaker 64-bit key. It has *much* lower
security margins, and shouldn't be used for anything too sensitive, but
it could be used as a hashtable key function replacement, if the output
is never exposed, and if the security requirement is not too high.

The goal is to make this something that performance-critical jhash users
would be willing to use.

On 64-bit machines, HalfSipHash1-3 is slower than SipHash1-3, so we alias
SipHash1-3 to HalfSipHash1-3 on those systems.

64-bit x86_64:
[    0.509409] test_siphash:     SipHash2-4 cycles: 4049181
[    0.510650] test_siphash:     SipHash1-3 cycles: 2512884
[    0.512205] test_siphash: HalfSipHash1-3 cycles: 3429920
[    0.512904] test_siphash:    JenkinsHash cycles:  978267
So, we map hsiphash() -> SipHash1-3

32-bit x86:
[    0.509868] test_siphash:     SipHash2-4 cycles: 14812892
[    0.513601] test_siphash:     SipHash1-3 cycles:  9510710
[    0.515263] test_siphash: HalfSipHash1-3 cycles:  3856157
[    0.515952] test_siphash:    JenkinsHash cycles:  1148567
So, we map hsiphash() -> HalfSipHash1-3

hsiphash() is roughly 3 times slower than jhash(), but comes with a
considerable security improvement.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 4.4 to avoid regression for WireGuard with only half
 the siphash API present]
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-06 21:32:43 +02:00
..
842 A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fonts A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lz4 A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lzo A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mpi lib/mpi: Fix karactx leak in mpi_powm 2020-04-06 19:21:06 +02:00
raid6 ARM: 8833/1: Ensure that NEON code always compiles with Clang 2020-04-06 14:51:24 +02:00
reed_solomon rslib: Fix handling of of caller provided syndrome 2020-04-06 19:55:29 +02:00
xz A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
zlib_deflate A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
zlib_inflate A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
zstd A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
argv_split.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
asn1_decoder.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
assoc_array.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
atomic64_test.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
atomic64.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
audit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bcd.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bch.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bitmap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bitrev.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bsearch.c kprobes: Prohibit probing on bsearch() 2020-04-06 14:51:19 +02:00
btree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bug.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
build_OID_registry A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bust_spinlocks.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
check_signature.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checksum.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
clz_ctz.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
clz_tab.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cmdline.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
compat_audit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cordic.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpu_rmap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpu-notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cpumask.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc-ccitt.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc-itu-t.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc-t10dif.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc7.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc8.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc16.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc32.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crc32defs.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ctype.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
debug_info.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
debug_locks.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
debugobjects.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dec_and_lock.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_bunzip2.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_inflate.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_unlz4.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_unlzma.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_unlzo.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress_unxz.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decompress.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
devres.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
digsig.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
div64.c lib/div64.c: off by one in shift 2020-04-06 15:20:42 +02:00
dma-debug.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dump_stack.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dynamic_debug.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dynamic_queue_limits.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
earlycpio.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fault-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_empty_tree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_ro.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_rw.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_strerror.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_sw.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt_wip.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fdt.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
find_bit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
flex_array.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
flex_proportions.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcd.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gen_crc32table.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
genalloc.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
glob.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
halfmd4.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
hexdump.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
hweight.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
idr.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
inflate.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
int_sqrt.c lib/int_sqrt: optimize initial value compute 2020-04-06 13:43:46 +02:00
interval_tree_test.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
interval_tree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iomap_copy.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iomap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iommu-common.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iommu-helper.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ioremap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iov_iter.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
irq_regs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
is_single_threaded.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
jedec_ddr_data.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kasprintf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.debug siphash: add cryptographically secure PRF 2020-04-06 21:32:41 +02:00
Kconfig.kasan A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.kgdb A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig.kmemcheck A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kfifo.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
klist.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kobject_uevent.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kobject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kstrtox.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kstrtox.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lcm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
libcrc32c.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
list_debug.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
list_sort.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
llist.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-hardirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-mutex.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-rlock-hardirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-rlock-softirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-rlock.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-rsem.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-softirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-spin-hardirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-spin-softirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-spin.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-wlock-hardirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-wlock-softirq.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-wlock.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest-wsem.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
locking-selftest.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lockref.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lru_cache.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile siphash: add cryptographically secure PRF 2020-04-06 21:32:41 +02:00
md5.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
memory-notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
memweight.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
net_utils.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
nlattr.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
nmi_backtrace.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
notifier-error-inject.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
of-reconfig-notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
oid_registry.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
once.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
parser.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
pci_iomap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
percpu_counter.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
percpu_ida.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
percpu_test.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
percpu-refcount.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
plist.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
pm-notifier-error-inject.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
proportions.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
radix-tree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
random32.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ratelimit.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rational.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rbtree_test.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rbtree.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
reciprocal_div.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rhashtable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
scatterlist.c lib/scatterlist: Fix mapping iterator when sg->offset is greater than PAGE_SIZE 2020-04-06 20:04:15 +02:00
seq_buf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sg_split.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sha1.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
show_mem.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
siphash.c siphash: implement HalfSipHash1-3 for hash tables 2020-04-06 21:32:43 +02:00
smp_processor_id.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sort.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stackdepot.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stmp_device.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
string_helpers.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
string.c lib/string.c: implement a basic bcmp 2020-04-06 15:07:18 +02:00
strncpy_from_user.c mm/uaccess: Use 'unsigned long' to placate UBSAN warnings on older GCC versions 2020-04-06 18:18:29 +02:00
strnlen_user.c mm/uaccess: Use 'unsigned long' to placate UBSAN warnings on older GCC versions 2020-04-06 18:18:29 +02:00
swiotlb.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
syscall.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_bpf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_firmware.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_kasan.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_module.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_printf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_rhashtable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_siphash.c siphash: implement HalfSipHash1-3 for hash tables 2020-04-06 21:32:43 +02:00
test_static_key_base.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_static_keys.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test_user_copy.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test-hexdump.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test-kstrtox.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
test-string_helpers.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
textsearch.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
timerqueue.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ts_bm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ts_fsm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ts_kmp.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ucs2_string.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
usercopy.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
uuid.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
vsprintf.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xxhash.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30