XSalsa20: make hsalsa20 a public API function #728
No reviewers
Labels
No labels
bug
duplicate
enhancement
feature
help wanted
improve API
invalid
needs documentation
not-planned
rtfm
stale
support
wishlist
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libtom/libtomcrypt!728
Loading…
Reference in a new issue
No description provided.
Delete branch "pr/xsalsa20-hsalsa20"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
While checking the interoperability of libtomcrypt with NaCl/libsodium seal box, crypto box and secret box, I ended up with this patch.
HSalsa20 was a missing piece needed to implement NaCl's crypto_box (= authenticated public-key encryption using X25519 + HSalsa20 + XSalsa20-Poly1305).
Technically HSalsa20 was already implemented inside
xsalsa20_setup(..)- this PR simply exposes it asxsalsa20_hsalsa20(..)as part of the public API.NaCl sealed box (crypto_box_seal) needed unkeyed BLAKE2b. However,
blake2bmac_init()rejected (NULL, 0) even thoughblake2b_init()supports it. This PR allows NULL key when keylen is 0 (in line with the BLAKE2 specification).Checklist
If anybody is interested in how interoperability between libtomcrypt and libsodium works, here it is:
How about adding the libsodium API under an
ltc_prefix as suggested in your comment? I somehow like the idea.do you mean having something like this in our public API?
FYI here is how original libsodium api looks like:
I like that API proposal.
Not sure though if we should add it as an official API or as an inofficial one in demos, like the gcm-file one ... if we add it, we should also have it tested. (Which I will add now for the gcm-file one.)
for now, maybe
demos/libsodium-boxes.c?I'd prefer to directly separate the demo from the boxes and put the boxes to a separate folder ...
Maybe
demos/sodium/boxes.canddemos/libsodium.c?Basically LGTM
If we put the boxes into the library we should also have them in the docs. (That's also why I suggested to have the boxes in the demos instead of the library, but I'm fine with both.)
We should also run the demo in CI (or something like that ... maybe turn it into a testcase or so...) to ensure that this doesn't break, especially if the boxes API is provided as an official API.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.