Commit Graph

14 Commits

Author SHA1 Message Date
Lucas Gabriel Vuotto 8766827b49 auth/hmac: save lc_hash_ctx for scrub 2024-06-19 14:07:36 +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 24ef318572 Move *_impl to their returning functions 2024-06-16 01:51:00 +00:00
Lucas Gabriel Vuotto 230dedac16 Rename all algorithm-specific ctx to state 2024-06-15 21:13:31 +00:00
Lucas Gabriel Vuotto 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
Lucas Gabriel Vuotto 666b833b98 auth/hmac: complete overhaul
Now that there are dedicated struct for initial parameters, make the
HMAC params provide a lc_hash_ctx to be used internally. This makes HMAC
less special and allows it to work with any hash, instead of needing
dedicated inits and ctx_news. As an upside, now it's possible to have a
one-pass HMAC.
2024-06-10 17:29:29 +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 8f1b773e5f auth/hmac: rename BLOCKSZ to BLOCKLEN 2024-06-09 14:25:05 +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 b26a9c7274 auth: replace init args with a implementation-specific params struct
This allows for more flexibility in the future.

This commit breaks ChaCha20-Poly1305. It'll be fixed in a subsequent
commit.
2024-06-07 18:40:14 +00:00
Lucas Gabriel Vuotto 1a8f813442 hash: implement SHA-{224,256}
Add the HMAC and Wycheproof bits for HMAC while at it.
2024-06-07 03:14:21 +00:00
Lucas Gabriel Vuotto 11b86db9db auth/hmac: 0-pad the hashed key in longer-than-blocksize case 2024-06-06 17:14:30 +00:00
Lucas Gabriel Vuotto ad42d99e0b auth: add HMAC implementation
This allows for checking the SHA-512 implementation against Wycheproof
via the HMAC tests.
2024-06-06 12:41:44 +00:00