[all-commits] [llvm/llvm-project] 69e07b: [Support] Add SipHash-based 16/64-bit ptrauth stab...
Ahmed Bougacha via All-commits
all-commits at lists.llvm.org
Tue May 28 22:34:24 PDT 2024
Branch: refs/heads/users/ahmedbougacha/ptrauth-siphash
Home: https://github.com/llvm/llvm-project
Commit: 69e07b081b4c43db41696c1cb9b423fc81464dc2
https://github.com/llvm/llvm-project/commit/69e07b081b4c43db41696c1cb9b423fc81464dc2
Author: Ahmed Bougacha <ahmed at bougacha.org>
Date: 2024-05-28 (Tue, 28 May 2024)
Changed paths:
A llvm/include/llvm/Support/SipHash.h
M llvm/lib/Support/CMakeLists.txt
A llvm/lib/Support/SipHash.cpp
Log Message:
-----------
[Support] Add SipHash-based 16/64-bit ptrauth stable hash.
Based on the SipHash reference implementation:
https://github.com/veorq/SipHash
which has very graciously been licensed under our llvm license
(Apache-2.0 WITH LLVM-exception) by Jean-Philippe Aumasson.
This lightly modifies it to fit into libSupport, and wraps it for
the two main interfaces we're interested in (16/64-bit).
This intentionally doesn't expose a raw interface beyond that to
encourage others to carefully consider their use.
The exact algorithm is the little-endian interpretation of the
non-doubled (i.e. 64-bit) result of applying a SipHash-2-4 using
a specific key value which can be found in the source.
By "stable" we mean that the result of this hash algorithm will
the same across different compiler versions and target platforms.
The 16-bit variant is used extensively for the AArch64 ptrauth ABI,
because AArch64 can efficiently load a 16-bit immediate into the high
bits of a register without disturbing the remainder of the value, which
serves as a nice blend operation.
16 bits is also sufficiently compact to not inflate a loader relocation.
We disallow zero to guarantee a different discriminator from the places
in the ABI that use a constant zero.
Co-Authored-By: John McCall <rjmccall at apple.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list