summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2023-09-02 01:57:40 -0400
committerPaul Duncan <pabs@pablotron.org>2023-09-02 01:57:40 -0400
commitcdd3961d4a370041176d27d97129f998d2c1f549 (patch)
tree2450764abbaf751b572ec4625cf103e34d2f9db8 /main.c
parent5f0124c4923dc44a6f2bf1666fafcecc0c90306b (diff)
downloadsha3-cdd3961d4a370041176d27d97129f998d2c1f549.tar.bz2
sha3-cdd3961d4a370041176d27d97129f998d2c1f549.zip
sha3.[hc], main.c: remove absorb_done(), make squeeze always succeed
Diffstat (limited to 'main.c')
-rw-r--r--main.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/main.c b/main.c
index febf001..97cf0b4 100644
--- a/main.c
+++ b/main.c
@@ -15,21 +15,11 @@ static void run_shake128_xof(const uint8_t *msg, const size_t msg_len, const siz
exit(-1);
}
- // finalize
- if (!shake128_xof_absorb_done(&xof)) {
- fprintf(stderr, "Error: shake128_xof_absorb_done() failed\n");
- exit(-1);
- }
-
// squeeze
uint8_t buf[64];
for (size_t i = 0; i < out_len; i += sizeof(buf)) {
const size_t len = (out_len - i < sizeof(buf)) ? out_len - i : sizeof(buf);
-
- if (!shake128_xof_squeeze(&xof, buf, len)) {
- fprintf(stderr, "Error: shake128_xof_absorb_done() failed\n");
- exit(-1);
- }
+ shake128_xof_squeeze(&xof, buf, len);
// print result
for (size_t j = 0; j < len; j++) {
@@ -51,21 +41,11 @@ static void run_shake256_xof(const uint8_t * const msg, const size_t msg_len, co
exit(-1);
}
- // finalize
- if (!shake256_xof_absorb_done(&xof)) {
- fprintf(stderr, "Error: shake256_xof_absorb_done() failed\n");
- exit(-1);
- }
-
// squeeze
uint8_t buf[64];
for (size_t i = 0; i < out_len; i += sizeof(buf)) {
const size_t len = (out_len - i < sizeof(buf)) ? out_len - i : sizeof(buf);
-
- if (!shake256_xof_squeeze(&xof, buf, len)) {
- fprintf(stderr, "Error: shake256_xof_absorb_done() failed\n");
- exit(-1);
- }
+ shake256_xof_squeeze(&xof, buf, len);
// print result
for (size_t j = 0; j < len; j++) {