crypto: Add SipHash MAC support#11242
Open
ausimian wants to merge 1 commit into
Open
Conversation
Add the siphash and siphash128 MAC types, available through the
crypto:mac/3,4, crypto:macN/4,5 and the streaming crypto:mac_init/2,3
functions:
siphash - SipHash-2-4, 64-bit MAC
siphash128 - SipHash-2-4, 128-bit MAC
SipHash is a fast keyed MAC widely used for hash-table keying and for
authenticating short messages. Both variants take a 16 byte key and go
through the cryptolib EVP_MAC interface, like the other MACs.
The output size is selected with the EVP_MAC "size" parameter. As
siphash128 is not a truncation of siphash (they differ in finalization),
the two are exposed as separate algorithms rather than derived from each
other with macN.
Requires OpenSSL 3.0.
Contributor
CT Test Results 2 files 14 suites 5m 5s ⏱️ Results for commit f504609. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds SipHash as a MAC in the
cryptoapplication, exposed through the existingMAC API (
crypto:mac/3,4,crypto:macN/4,5, and the streamingcrypto:mac_init/2,3+mac_update/2+mac_final/1).Two algorithm atoms are added, following crypto's size-in-the-name convention
and the SipHash reference implementation's own naming:
siphashsiphash128Design
EVP_MACinterface, like the otherMACs.
poly1305is the closest analog: a key-only MAC with noSubType.EVP_MAC"size"parameter.siphash128isnot a truncation of
siphash(they differ in finalization), so the two areexposed as separate algorithms rather than derived from each other with
macN.crypto:supports(macs)and returnnotsup.Testing
New
crypto_SUITEgroupssiphashandsiphash128check one-shot andstreaming computation against the SipHash-2-4 reference vectors, with FIPS
negative groups. The existing MACs are unaffected, and
Build and check Erlang/OTPpasses.