]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix state handling of shake_final for s390x.
authorHolger Dengler <dengler@linux.ibm.com>
Wed, 27 Sep 2023 13:37:29 +0000 (15:37 +0200)
committerHolger Dengler <dengler@linux.ibm.com>
Fri, 10 Nov 2023 13:26:27 +0000 (14:26 +0100)
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 <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)

providers/implementations/digests/sha3_prov.c

index 5cf9791bbf163ad09cb74392558f39c64d71a209..34620cf95a643571972bc02a6f2ae4bf4d993bf8 100644 (file)
@@ -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;
 }