Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH v1 0/1] s390/crypto: Generate iintermediate chaining value on export
@ 2026-08-14 14:20 Holger Dengler
  2026-08-14 14:20 ` [PATCH v1 1/1] s390/crypto: Generate intermediate CV for API partial block handling Holger Dengler
  0 siblings, 1 reply; 3+ messages in thread
From: Holger Dengler @ 2026-08-14 14:20 UTC (permalink / raw)
  To: Harald Freudenberger, Herbert Xu
  Cc: dengler, linux-s390, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Eric Biggers, linux-crypto, ifranzki

While exporting the state of the hmac chipher, the intermediate
chaining value (CV) has to be calculated. Calling the KIMD instruction
on s390 will generate the correct value. The code already sets the
correct function code for the instruction, but it calls the wrong
instruction (KLMD). The patch just fixes this.

This series applies on top of Linus' master branch.

Holger Dengler (1):
  s390/crypto: Generate intermediate CV for API partial block handling

 arch/s390/crypto/hmac_s390.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


base-commit: 2f1baf1fc8929e6c48370be543ad028ac7ad4131
-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1 1/1] s390/crypto: Generate intermediate CV for API partial block handling
  2026-08-14 14:20 [PATCH v1 0/1] s390/crypto: Generate iintermediate chaining value on export Holger Dengler
@ 2026-08-14 14:20 ` Holger Dengler
  2026-08-14 14:29   ` Harald Freudenberger
  0 siblings, 1 reply; 3+ messages in thread
From: Holger Dengler @ 2026-08-14 14:20 UTC (permalink / raw)
  To: Harald Freudenberger, Herbert Xu
  Cc: dengler, linux-s390, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Eric Biggers, linux-crypto, ifranzki

The API partial block handling requires a intermediate chaining
value (CV). The internal function hash_data() sets the function code
correctly, so also call cpacf_kimd() instruction for intermediate CV
generation, as cpacf_klmd() always generate the final hash value.

Cc: stable@vger.kernel.org # 6.15+
Fixes: 08811169ac01 ("crypto: s390/hmac - Use API partial block handling")
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
---
 arch/s390/crypto/hmac_s390.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/s390/crypto/hmac_s390.c b/arch/s390/crypto/hmac_s390.c
index f8cd09f341d4..445fa7bbd958 100644
--- a/arch/s390/crypto/hmac_s390.c
+++ b/arch/s390/crypto/hmac_s390.c
@@ -150,7 +150,10 @@ static int hash_data(const u8 *in, unsigned int inlen,
 
 #undef PARAM_INIT
 
-	cpacf_klmd(func, &param, in, inlen);
+	if (final)
+		cpacf_klmd(func, &param, in, inlen);
+	else
+		cpacf_kimd(func, &param, in, inlen);
 
 	memcpy(digest, &param, digestsize);
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] s390/crypto: Generate intermediate CV for API partial block handling
  2026-08-14 14:20 ` [PATCH v1 1/1] s390/crypto: Generate intermediate CV for API partial block handling Holger Dengler
@ 2026-08-14 14:29   ` Harald Freudenberger
  0 siblings, 0 replies; 3+ messages in thread
From: Harald Freudenberger @ 2026-08-14 14:29 UTC (permalink / raw)
  To: Holger Dengler
  Cc: Herbert Xu, linux-s390, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Eric Biggers, linux-crypto, ifranzki

On 2026-08-14 16:20, Holger Dengler wrote:
> The API partial block handling requires a intermediate chaining
> value (CV). The internal function hash_data() sets the function code
> correctly, so also call cpacf_kimd() instruction for intermediate CV
> generation, as cpacf_klmd() always generate the final hash value.
> 
> Cc: stable@vger.kernel.org # 6.15+
> Fixes: 08811169ac01 ("crypto: s390/hmac - Use API partial block 
> handling")
> Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
> ---
>  arch/s390/crypto/hmac_s390.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/s390/crypto/hmac_s390.c 
> b/arch/s390/crypto/hmac_s390.c
> index f8cd09f341d4..445fa7bbd958 100644
> --- a/arch/s390/crypto/hmac_s390.c
> +++ b/arch/s390/crypto/hmac_s390.c
> @@ -150,7 +150,10 @@ static int hash_data(const u8 *in, unsigned int 
> inlen,
> 
>  #undef PARAM_INIT
> 
> -	cpacf_klmd(func, &param, in, inlen);
> +	if (final)
> +		cpacf_klmd(func, &param, in, inlen);
> +	else
> +		cpacf_kimd(func, &param, in, inlen);
> 
>  	memcpy(digest, &param, digestsize);

Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-14 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 14:20 [PATCH v1 0/1] s390/crypto: Generate iintermediate chaining value on export Holger Dengler
2026-08-14 14:20 ` [PATCH v1 1/1] s390/crypto: Generate intermediate CV for API partial block handling Holger Dengler
2026-08-14 14:29   ` Harald Freudenberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox