linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* s390: CI failures on all sha kernel modules on linux-next
@ 2025-04-29  8:57 Harald Freudenberger
  2025-04-29  9:12 ` [PATCH] crypto: s390/sha512 - Fix sha512 state size Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Harald Freudenberger @ 2025-04-29  8:57 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Ingo Franzki, Holger Dengler, linux-crypto

Hello Herbert
since commit 572b5c4682c7 "crypto: s390/sha512 - Use API partial block 
handling"
all CI tests related to sha kernel modules on the next kernel fail.

Some investigations shows that modprobe fails with -EINVAL, caused
in shash.c line 477. After some reading through the commit I get the
impression that the root cause is in the sudden increase of the
alg.descsize from 213 bytes to 536 bytes. This is caused by the
modifications of the s390_sha_ctx:

...
  struct s390_sha_ctx {
  	u64 count;		/* message length in bytes */
-	u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)];
+	union {
+		u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)];
+		struct {
+			u64 state[SHA512_DIGEST_SIZE];                  <- really big
+			u64 count_hi;
+		} sha512;
+	};
  	int func;		/* KIMD function to use */
  	bool first_message_part;
-	u8 buf[SHA_MAX_BLOCK_SIZE];
  };
...

as part of the patch. Having a close look here gives me the strong
impression that the state here is way too big and it should be:

...
  struct s390_sha_ctx {
  	u64 count;		/* message length in bytes */
-	u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)];
+	union {
+		u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)];
+		struct {
+			u64 state[SHA512_DIGEST_SIZE / sizeof(u64)];
+			u64 count_hi;
+		} sha512;
+	};
  	int func;		/* KIMD function to use */
  	bool first_message_part;
-	u8 buf[SHA_MAX_BLOCK_SIZE];
  };
...

instead. With this modifications all our sha modules do load perfect
and the CI tests succeed. Please check and maybe improve your patch.

Thanks and have a nice day
Harald Freudenberger


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

end of thread, other threads:[~2025-05-05 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29  8:57 s390: CI failures on all sha kernel modules on linux-next Harald Freudenberger
2025-04-29  9:12 ` [PATCH] crypto: s390/sha512 - Fix sha512 state size Herbert Xu
2025-05-05 12:45   ` Ingo Franzki
2025-05-05 12:54     ` [PATCH] crypto: s390/sha512 - Initialise upper counter to zero for sha384 Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).