public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Harald Freudenberger <freude@linux.ibm.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Holger Dengler <dengler@linux.ibm.com>,
	linux-s390@vger.kernel.org,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: s390 hmac
Date: Mon, 24 Mar 2025 11:04:56 +0100	[thread overview]
Message-ID: <1aa33386ca1c39438fd17ea651a21903@linux.ibm.com> (raw)
In-Reply-To: <Z-AJFwndherQBH2W@gondor.apana.org.au>

On 2025-03-23 14:13, Herbert Xu wrote:
> Hi Harald:
> 
> I'm working on making the export format of hash algorithms compatible
> so that you can switch between implementations seamlessly.
> 
> I've got a question about the s390 hmac implementation.  How does
> the hardware tell if it's the first update (where the cv from the
> param block contains undefined state) or not? Is it a bit in
> s390_kmac_gr0 or is it the imbl?
> 
> Thanks,

Hi Herbert

that is the ikp bit in the s390_kmac_gr0 struct:

union s390_kmac_gr0 {
	unsigned long reg;
	struct {
		unsigned long		: 48;
		unsigned long ikp	:  1;
		unsigned long iimp	:  1;
		unsigned long ccup	:  1;
		unsigned long		:  6;
		unsigned long fc	:  7;
	};
};

It needs to be initial 0 and the firmware sets it to 1 with
the inner key padding and the hashing done.

Holger's implementation in hmac_s390.c of the clear key hmac
holds this gr0 value as part of the running hash context:

struct s390_kmac_sha2_ctx {
	u8 param[MAX_DIGEST_SIZE + MAX_IMBL_SIZE + MAX_BLOCK_SIZE];
	union s390_kmac_gr0 gr0;
	u8 buf[MAX_BLOCK_SIZE];
	unsigned int buflen;
};

  parent reply	other threads:[~2025-03-24 10:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-23 13:13 s390 hmac Herbert Xu
2025-03-24  7:50 ` Holger Dengler
2025-03-24  8:07   ` Herbert Xu
2025-03-24 10:04 ` Harald Freudenberger [this message]
2025-03-25  8:22   ` Herbert Xu
2025-03-25 18:10     ` Holger Dengler
2025-03-26  0:54       ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1aa33386ca1c39438fd17ea651a21903@linux.ibm.com \
    --to=freude@linux.ibm.com \
    --cc=dengler@linux.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox