diff options
author | Holger Dengler <dengler@linux.ibm.com> | 2023-09-27 21:54:34 +0200 |
---|---|---|
committer | Holger Dengler <dengler@linux.ibm.com> | 2023-11-10 14:25:44 +0100 |
commit | 1337b50936ed190a98af1ee6601d857b42a3d296 (patch) | |
tree | 9024346109ec0f345fb2a19b3b2ad76a405ac818 /providers | |
parent | bff62480333680463c82e88fdc67ed5ec14a0017 (diff) | |
download | openssl-1337b50936ed190a98af1ee6601d857b42a3d296.tar.gz |
Add xof state handing for generic sha3 absorb.
The digest life-cycle diagram specifies state transitions to `updated`
(aka XOF_STATE_ABSORB) only from `initialised` and `updated`. Add this
checking to the generic sha3 absorb implementation.
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22221)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/digests/sha3_prov.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/providers/implementations/digests/sha3_prov.c b/providers/implementations/digests/sha3_prov.c index 19576c7190..13735153f2 100644 --- a/providers/implementations/digests/sha3_prov.c +++ b/providers/implementations/digests/sha3_prov.c @@ -143,6 +143,10 @@ static size_t generic_sha3_absorb(void *vctx, const void *inp, size_t len) { KECCAK1600_CTX *ctx = vctx; + if (!(ctx->xof_state == XOF_STATE_INIT || + ctx->xof_state == XOF_STATE_ABSORB)) + return 0; + ctx->xof_state = XOF_STATE_ABSORB; return SHA3_absorb(ctx->A, inp, len, ctx->block_size); } |