From: Holger Dengler Date: Wed, 27 Sep 2023 13:37:29 +0000 (+0200) Subject: Fix state handling of shake_final for s390x. X-Git-Tag: openssl-3.3.0-alpha1~635 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=288fbb4b71343516cee6f6a44b9ec55d82fb1532;p=thirdparty%2Fopenssl.git Fix state handling of shake_final for s390x. The digest life-cycle state diagram has been updated for XOF. Fix the state handling in s390x_shake_final() according to the updated state diagram. Signed-off-by: Holger Dengler Reviewed-by: Shane Lontis Reviewed-by: Todd Short Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/22221) --- diff --git a/providers/implementations/digests/sha3_prov.c b/providers/implementations/digests/sha3_prov.c index 5cf9791bbf1..34620cf95a6 100644 --- a/providers/implementations/digests/sha3_prov.c +++ b/providers/implementations/digests/sha3_prov.c @@ -217,6 +217,10 @@ static int s390x_shake_final(void *vctx, unsigned char *out, size_t outlen) if (!ossl_prov_is_running()) return 0; + if (!(ctx->xof_state == XOF_STATE_INIT || + ctx->xof_state == XOF_STATE_ABSORB)) + return 0; + ctx->xof_state = XOF_STATE_FINAL; s390x_klmd(ctx->buf, ctx->bufsz, out, outlen, ctx->pad, ctx->A); return 1; }