]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: s390/phmac - Do not modify the req->nbytes value
authorHarald Freudenberger <freude@linux.ibm.com>
Fri, 17 Oct 2025 12:32:54 +0000 (14:32 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 23 Oct 2025 04:53:23 +0000 (12:53 +0800)
commit3ac2939bc4341ac28700a2ed0c345ba7e7bdb6fd
treef385ec081f3c039d54a0e23598fc1c46df8693dc
parent3a8660878839faadb4f1a6dd72c3179c1df56787
crypto: s390/phmac - Do not modify the req->nbytes value

The phmac implementation used the req->nbytes field on combined
operations (finup, digest) to track the state:
with req->nbytes > 0 the update needs to be processed,
while req->nbytes == 0 means to do the final operation. For
this purpose the req->nbytes field was set to 0 after successful
update operation. However, aead uses the req->nbytes field after a
successful hash operation to determine the amount of data to
en/decrypt. So an implementation must not modify the nbytes field.

Fixed by a slight rework on the phmac implementation. There is
now a new field async_op in the request context which tracks
the (asynch) operation to process. So the 'state' via req->nbytes
is not needed any more and now this field is untouched and may
be evaluated even after a request is processed by the phmac
implementation.

Fixes: cbbc675506cc ("crypto: s390 - New s390 specific protected key hash phmac")
Reported-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Tested-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/s390/crypto/phmac_s390.c