diff mbox series

[v1,1/3] crypto: api - Adjust HASH_MAX_DESCSIZE for phmac context on s390

Message ID 20241030162235.363533-2-freude@linux.ibm.com
State New
Headers show
Series New s390 specific protected key hmac | expand

Commit Message

Harald Freudenberger Oct. 30, 2024, 4:22 p.m. UTC
From: Holger Dengler <dengler@linux.ibm.com>

The phmac context exceeds the generic "worst case".
Change this define to cover the s390 "worst case" but
only for arch s390 build.

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
---
 include/crypto/hash.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Herbert Xu Oct. 31, 2024, 4:13 a.m. UTC | #1
On Wed, Oct 30, 2024 at 05:22:33PM +0100, Harald Freudenberger wrote:
>
> +#ifdef CONFIG_S390
> +/*
> + * The descsize for phmac on s390 exceeds the generic "worst case".
> + */
> +#define HASH_MAX_DESCSIZE	384
> +#else
>  /*
>   * Worst case is hmac(sha3-224-generic).  Its context is a nested 'shash_desc'
>   * containing a 'struct sha3_state'.
>   */
>  #define HASH_MAX_DESCSIZE	(sizeof(struct shash_desc) + 360)
> +#endif

Why not just increase it everywhere? It's not a big difference.

Thanks,
diff mbox series

Patch

diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 2d5ea9f9ff43..92f878270a87 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -158,11 +158,18 @@  struct shash_desc {
 
 #define HASH_MAX_DIGESTSIZE	 64
 
+#ifdef CONFIG_S390
+/*
+ * The descsize for phmac on s390 exceeds the generic "worst case".
+ */
+#define HASH_MAX_DESCSIZE	384
+#else
 /*
  * Worst case is hmac(sha3-224-generic).  Its context is a nested 'shash_desc'
  * containing a 'struct sha3_state'.
  */
 #define HASH_MAX_DESCSIZE	(sizeof(struct shash_desc) + 360)
+#endif
 
 #define SHASH_DESC_ON_STACK(shash, ctx)					     \
 	char __##shash##_desc[sizeof(struct shash_desc) + HASH_MAX_DESCSIZE] \