aboutgitcodebugslistschat
path: root/checksum.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-09-28 11:20:56 +1000
committerStefano Brivio <sbrivio@redhat.com>2023-09-30 12:40:40 +0200
commit831067f483f68c88bce04a642e50ee6c8e632291 (patch)
treeabd1378a5f9c78311152797af6fec4d08deafba7 /checksum.c
parent7a3153cbfb72f603ae31269bdc11c9275dbd2319 (diff)
downloadpasst-831067f483f68c88bce04a642e50ee6c8e632291.tar
passt-831067f483f68c88bce04a642e50ee6c8e632291.tar.gz
passt-831067f483f68c88bce04a642e50ee6c8e632291.tar.bz2
passt-831067f483f68c88bce04a642e50ee6c8e632291.tar.lz
passt-831067f483f68c88bce04a642e50ee6c8e632291.tar.xz
passt-831067f483f68c88bce04a642e50ee6c8e632291.tar.zst
passt-831067f483f68c88bce04a642e50ee6c8e632291.zip
siphash: Clean up hash finalisation with posthash_final() function
The POSTAMBLE macro implements the finalisation steps of SipHash. It relies on some variables in the environment, including returning the final hash value that way. That isn't great hygeine. In addition the PREAMBLE macro takes a length parameter which is used only to initialize the 'b' value that's not used until the finalisation and is also sometimes modified in a non-obvious way by the callers. The 'b' value is always composed from the total length of the hash input plus up to 7 bytes of "tail" data - that is the remainder of the hash input after a multiple of 8 bytes has been consumed. Simplify all this by replacing the POSTAMBLE macro with a siphash_final() function which takes the length and tail data as parameters and returns the final hash value. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'checksum.c')
0 files changed, 0 insertions, 0 deletions