Commit Graph

22 Commits

Author SHA1 Message Date
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
24ef318572 Move *_impl to their returning functions 2024-06-16 01:51:00 +00:00
21251045f4 Rename the state block buffers from m{,len} to b{,len} 2024-06-15 21:22:12 +00:00
230dedac16 Rename all algorithm-specific ctx to state 2024-06-15 21:13:31 +00:00
2b76f3df5b cipher/xchacha20: add one-pass implementation
Fix the function pointers while at it.
2024-06-11 03:07:53 +00:00
6677c6cab3 Remove ctx_new and ctx_free function pointers
Now that HMAC isn't special anymore, and with the help of init params,
this isn't needed anymore as we only allocate memory for the state.

This effectively reverts e9bcc64e62 .
2024-06-10 17:44:05 +00:00
f6bddfcd70 fold 2024-06-10 17:23:48 +00:00
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
f1c4ceea84 Make the block lengths part of the public interface 2024-06-09 14:16:18 +00:00
06e9c5ec67 Rename *_CHUNK* to *_BLOCKLEN* 2024-06-09 14:05:52 +00:00
9c76a90301 cipher/chacha20: rename _common to _anycrypt 2024-06-08 13:39:49 +00:00
623dd16dc2 cipher: replace init args with a implementation-specific params struct
This allows for more flexibility in the future. While at it, do note
that the RFC and draft implementations are followed. In particular, in
XChaCha20, hardcode the high word of the counter to 0.

This commit breaks ChaCha20-Poly1305. It'll be fixed in a subsequent
commit.
stash
2024-06-07 18:52:46 +00:00
23735c2902 cipher/chacha20: rename *_IVLEN to *_NONCELEN 2024-06-07 18:40:14 +00:00
67d4de1657 Move all inout parameters to the front of the arguments list 2024-06-07 17:47:42 +00:00
7b539ccdcd cipher/chacha20: logical AND is && 2024-06-07 17:34:03 +00:00
0605d10bb3 Implement XChaCha20 and XChaCha20-Poly1305 2024-06-07 02:18:50 +00:00
06f835e27c cipher/chacha20: treat the counter as part of the nonce 2024-06-07 00:29:25 +00:00
b793cb5b69 cipher/chacha20: rename chacha20_x to chacha20_common 2024-06-07 00:29:25 +00:00
e5215ac18e cipher/chacha20: buffer the full input block
The final implementation is simpler, at the cost of doing work in
chacha20_x_final.
2024-06-07 00:29:17 +00:00
f511cddf0d Fix *_ctx_new and *_ctx_free implementations
They both will only alloc and free the internal *_ctx structs. Get rid
of the void * argument for new and only pass arg to *_free instead of
the whole lc_*_ctx struct.
2024-06-06 11:45:30 +00:00
e9bcc64e62 Make all *_impl provide ctx_new and ctx_free functions 2024-06-05 22:05:37 +00:00
7bc527c769 initial import 2024-05-31 10:59:58 +00:00