aboutsummaryrefslogtreecommitdiffstats
path: root/module/icp
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-01-07 01:32:14 +0100
committerBrian Behlendorf <[email protected]>2022-02-15 16:26:04 -0800
commitbf8663868752e1f3a423307b00cdb589d561310f (patch)
tree4bad97bdb9f8d430e32992c01477ef5c2d37822a /module/icp
parente013057492c43cec6eb4b55bc06581c7113ed4f6 (diff)
module: icp: enforce KCF_{OPS_CLASSSIZE,MAXMECHTAB}
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12901
Diffstat (limited to 'module/icp')
-rw-r--r--module/icp/include/sys/crypto/impl.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/module/icp/include/sys/crypto/impl.h b/module/icp/include/sys/crypto/impl.h
index ce1075760..e440d5944 100644
--- a/module/icp/include/sys/crypto/impl.h
+++ b/module/icp/include/sys/crypto/impl.h
@@ -265,9 +265,12 @@ typedef struct kcf_mech_entry {
*/
#define KCF_MAXDIGEST 16 /* Digests */
-#define KCF_MAXCIPHER 64 /* Ciphers */
+#define KCF_MAXCIPHER 32 /* Ciphers */
#define KCF_MAXMAC 40 /* Message authentication codes */
+_Static_assert(KCF_MAXCIPHER == KCF_MAXMECHTAB,
+ "KCF_MAXCIPHER != KCF_MAXMECHTAB"); /* See KCF_MAXMECHTAB comment */
+
typedef enum {
KCF_DIGEST_CLASS = 1,
KCF_CIPHER_CLASS,
@@ -276,6 +279,9 @@ typedef enum {
#define KCF_FIRST_OPSCLASS KCF_DIGEST_CLASS
#define KCF_LAST_OPSCLASS KCF_MAC_CLASS
+_Static_assert(
+ KCF_OPS_CLASSSIZE == (KCF_LAST_OPSCLASS - KCF_FIRST_OPSCLASS + 2),
+ "KCF_OPS_CLASSSIZE doesn't match kcf_ops_class_t!");
/* The table of all the kcf_xxx_mech_tab[]s, indexed by kcf_ops_class */