aboutsummaryrefslogtreecommitdiffstats
path: root/src/crypto.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* crypto: inline blake2s convenience functionJason A. Donenfeld2022-06-141-14/+0
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* wg_noise: import hmac from cryptoJason A. Donenfeld2022-06-141-36/+0
| | | | | | | This is weird and no library should implement it. Bring it into wg_noise instead. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* crypto: harmonize with compat and clean upJason A. Donenfeld2022-06-141-121/+106
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* crypto: use curve25519 API from the kernel when availableJohn Baldwin2022-06-141-0/+5
| | | | Signed-off-by: John Baldwin <jhb@FreeBSD.org>
* crypto: use <crypto/chacha20_poly1305.h> when presentJohn Baldwin2022-06-141-0/+10
| | | | Signed-off-by: John Baldwin <jhb@FreeBSD.org>
* crypto: use OCF to encrypt/decrypt packets when supportedJohn Baldwin2022-06-141-0/+93
| | | | | | | | This requires the the recent changes in FreeBSD to support the Chacha20-Poly1305 AEAD cipher with support for an 8 byte nonce (vs the 12 byte nonce used by TLS and IPsec). Signed-off-by: John Baldwin <jhb@FreeBSD.org>
* crypto: return an error code from mbuf crypt routinesJohn Baldwin2022-06-101-7/+7
| | | | | | This permits returning different error codes for different conditions. Signed-off-by: John Baldwin <jhb@FreeBSD.org>
* crypto: optimize out `if (encrypt)`Jason A. Donenfeld2021-04-241-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* crypto: chacha and poly in same loopMatt Dunwoodie2021-04-191-92/+58
| | | | | | | | | | This is a fixup of f685f466, where previously we chacha'd in a different loop to poly'ing. Now we do in the same loop to keep the cache hot. In practice this didn't result in an (easily) observable change, which could be due to only having 1-2 mbufs in a chain. However this is still the preferred way to do it. Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
* crypto: encrypt mbuf in placeMatt Dunwoodie2021-04-191-0/+126
| | | | | | | | | | | This introduces a couple of routines to encrypt the mbufs in place. It is likely that these will be replaced by something in opencrypto, however for the time being this fixes a heap overflow and sets up wg_noise for the "correct" API. When the time comes, this should make it easier to drop in new crypto. It should be noted, this was written at 0500. Signed-off-by: Matt Dunwoodie <ncon@noconroy.net>
* Initial importJason A. Donenfeld2021-03-171-0/+1694
There's still more to do with wiring this up properly. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>