Page MenuHomeFreeBSD

crypto: Add an API supporting curve25519.
ClosedPublic

Authored by jhb on Jan 18 2022, 10:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 20, 8:11 AM
Unknown Object (File)
Mar 7 2024, 8:42 PM
Unknown Object (File)
Feb 9 2024, 4:53 PM
Unknown Object (File)
Jan 6 2024, 6:28 AM
Unknown Object (File)
Dec 20 2023, 4:00 PM
Unknown Object (File)
Dec 20 2023, 3:42 AM
Unknown Object (File)
Dec 12 2023, 2:55 PM
Unknown Object (File)
Nov 10 2023, 10:38 AM
Subscribers

Details

Summary

This adds a wrapper around libsodium's curve25519 support matching
Linux's curve25519 API. The intended use case for this is WireGuard.

Note that this is not integrated with OCF as it is not related to
symmetric operations on data.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Jan 18 2022, 10:51 PM
sys/crypto/curve25519.h
19

"REGENTS"?

sys/crypto/libsodium/utils.c
1–20

I wonder if we shouldn't use just the ISC license, with perhaps a special comment on sodium_memzero - I imagine that if we needed to extend what we support over time we'd just bring in more of libsodium's utils.c?

markj added inline comments.
sys/crypto/curve25519.c
46

I noticed that the Linux implementations check for an all-zeros secret, presumably as a seatbelt against programming errors? A clamped secret can't be all-zeros...

sys/crypto/curve25519.h
49

libsodium handles clamping for you, but I guess it doesn't hurt to be sure.

This revision is now accepted and ready to land.Jan 19 2022, 5:05 PM
sys/crypto/curve25519.c
19

Similarly.

sys/crypto/curve25519.h
19

Sigh, I must have copied this from the wrong file, I will fix.

49

WireGuard expects to use this function directly, but yes, I noticed libsodium already does this.

sys/crypto/libsodium/utils.c
1–20

Mmm, yeah.

jhb marked 3 inline comments as done.Jan 20 2022, 10:33 PM
sys/crypto/curve25519.c
46

It also checks the computed value, perhaps as a seatbelt against broken backends (since they support MD backends)? I could add the check against all zeroes if you think it's warranted.

sys/crypto/curve25519.c
46

I think the change is fine as-is.

This revision now requires review to proceed.Jan 21 2022, 1:01 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 24 2022, 11:29 PM
This revision was automatically updated to reflect the committed changes.