Commit Graph

19 Commits

Author SHA1 Message Date
Lucas Gabriel Vuotto 5c1325ed11 aead: rewrite api
Decouple the authentication tag from the ciphertext and add streaming
interfaces.

Tests will be fixed in the next commit.
2024-06-20 15:52:58 +00:00
Lucas Gabriel Vuotto 9da7685779 aead/{,x}chacha20-poly1305: simplify
Use one-pass interfaces for encryption and decryption and rename the
Poly1305 key setup to the more correct poly1305_keysetup.
2024-06-19 14:02:54 +00:00
Lucas Gabriel Vuotto 3c5e296178 Use a single zero buffer 2024-06-19 13:18:25 +00:00
Lucas Gabriel Vuotto 9cc4c6863e Move aead_impl_*chacha20_poly1305 into their returning function
Missed in 24ef318572 .
2024-06-18 14:32:35 +00:00
Lucas Gabriel Vuotto cef67c9f09 Merge most of internal headers into internal.h
Fix the includes accordingly and get rid of some unused ones.
2024-06-17 21:52:07 +00:00
Lucas Gabriel Vuotto f6bddfcd70 fold 2024-06-10 17:23:48 +00:00
Lucas Gabriel Vuotto 2b3e390bbf Make params struct non-const
Upcoming changes will push lc_*_ctx into the params struct for higher
order constructions like HMAC or HKDF.
2024-06-09 15:09:15 +00:00
Lucas Gabriel Vuotto f1c4ceea84 Make the block lengths part of the public interface 2024-06-09 14:16:18 +00:00
Lucas Gabriel Vuotto 06e9c5ec67 Rename *_CHUNK* to *_BLOCKLEN* 2024-06-09 14:05:52 +00:00
Lucas Gabriel Vuotto 62eb1ea6f8 aead/chacha20-poly1305: reflect that the keysetup is only for {,X}ChaCha20 2024-06-09 02:21:06 +00:00
Lucas Gabriel Vuotto d2817487e8 aead/chacha20-poly1305: inline anycrypt
Also use decrypt for the decryption path instead of relying on ChaCha20
using the same stream for encryption and decryption.
2024-06-09 02:19:51 +00:00
Lucas Gabriel Vuotto a6208487e4 aead: replace init args with implementation-specific params struct
This unbreaks {,X}ChaCha20-Poly1305. Thanks to the use of params, the
{,X}ChaCha20-Poly1305 doesn't need to reach into the guts of ChaCha20
state. Move {en,de}cryption and key setup into its own functions.

This breaks the tests, which will be fixed in the following commit.
2024-06-07 23:29:29 +00:00
Lucas Gabriel Vuotto 67d4de1657 Move all inout parameters to the front of the arguments list 2024-06-07 17:47:42 +00:00
Lucas Gabriel Vuotto 0605d10bb3 Implement XChaCha20 and XChaCha20-Poly1305 2024-06-07 02:18:50 +00:00
Lucas Gabriel Vuotto b793cb5b69 cipher/chacha20: rename chacha20_x to chacha20_common 2024-06-07 00:29:25 +00:00
Lucas Gabriel Vuotto 5bd46fffa6 aead/chacha20-poly1305: use chacha20_x_final instead of reaching into chacha20_ctx guts 2024-06-07 00:29:17 +00:00
Lucas Gabriel Vuotto 52ab9ca179 ct/lc_ct_cmp: improve interface
Return 0xffffffff if arguments compare equal, 0 otherwise. Change all
consumers accordingly.
2024-06-06 13:49:25 +00:00
Lucas Gabriel Vuotto 217145edc0 aead: implement ChaCha20-Poly1305 open 2024-05-31 16:46:05 +00:00
Lucas Gabriel Vuotto 7bc527c769 initial import 2024-05-31 10:59:58 +00:00