From b5d92d6e01a9df199c352a3e542ad1fadb74d0c2 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 2 Mar 2024 01:33:50 -0500 Subject: sha3.[hc]: update comments --- sha3.c | 6 ++++-- sha3.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sha3.c b/sha3.c index 34499f3..f238b91 100644 --- a/sha3.c +++ b/sha3.c @@ -9,8 +9,8 @@ * following SHA-3 hash functions, XOFs, and HMACs: * * - SHA3-224, SHA3-256, SHA3-384, and SHA3-512 - * - HMAC-SHA3-224, HMAC-SHA3-256, HMAC-SHA3-384, and HMAC-SHA3-512 * - SHAKE128 and SHAKE256 + * - HMAC-SHA3-224, HMAC-SHA3-256, HMAC-SHA3-384, and HMAC-SHA3-512 * - cSHAKE128, cSHAKE128-XOF, cSHAKE256, and cSHAKE256-XOF * - KMAC128, KMAC128-XOF, KMAC256, and KMAC256-XOF * - TupleHash128, TupleHash128-XOF, TupleHash256, and TupleHash256-XOF @@ -552,7 +552,7 @@ static inline void hash_final(sha3_t * const hash, const size_t rate, uint8_t * memcpy(dst, hash->a.u8, dst_len); } -// define sha3 one shot and iterative context functions +// define hash one-shot and iterative context functions #define DEF_HASH(BITS) \ /* one-shot hash */ \ void sha3_ ## BITS(const uint8_t *m, size_t m_len, uint8_t dst[static SHA3_ ## BITS ## _LEN]) { \ @@ -734,6 +734,7 @@ static inline void xof_squeeze_raw(sha3_xof_t * const xof, const size_t rate, co } } +// squeeze data from xof static inline void xof_squeeze(sha3_xof_t * const xof, const size_t rate, const size_t num_rounds, const uint8_t pad, uint8_t * const dst, const size_t dst_len) { // check state if (!xof->squeezing) { @@ -744,6 +745,7 @@ static inline void xof_squeeze(sha3_xof_t * const xof, const size_t rate, const xof_squeeze_raw(xof, rate, num_rounds, dst, dst_len); } +// one-shot xof absorb and squeeze static inline void xof_once(const size_t rate, const size_t num_rounds, const uint8_t pad, const uint8_t * const src, const size_t src_len, uint8_t * const dst, const size_t dst_len) { // init sha3_xof_t xof; diff --git a/sha3.h b/sha3.h index 2453982..f189ed2 100644 --- a/sha3.h +++ b/sha3.h @@ -14,8 +14,8 @@ * following SHA-3 hash functions, XOFs, and HMACs: * * - SHA3-224, SHA3-256, SHA3-384, and SHA3-512 - * - HMAC-SHA3-224, HMAC-SHA3-256, HMAC-SHA3-384, and HMAC-SHA3-512 * - SHAKE128 and SHAKE256 + * - HMAC-SHA3-224, HMAC-SHA3-256, HMAC-SHA3-384, and HMAC-SHA3-512 * - cSHAKE128, cSHAKE128-XOF, cSHAKE256, and cSHAKE256-XOF * - KMAC128, KMAC128-XOF, KMAC256, and KMAC256-XOF * - TupleHash128, TupleHash128-XOF, TupleHash256, and TupleHash256-XOF -- cgit v1.2.3