module: icp: enforce KCF_{OPS_CLASSSIZE,MAXMECHTAB}

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12901
This commit is contained in:
наб 2022-01-07 01:32:14 +01:00 committed by Brian Behlendorf
parent e013057492
commit bf86638687

View File

@ -265,9 +265,12 @@ typedef struct kcf_mech_entry {
*/ */
#define KCF_MAXDIGEST 16 /* Digests */ #define KCF_MAXDIGEST 16 /* Digests */
#define KCF_MAXCIPHER 64 /* Ciphers */ #define KCF_MAXCIPHER 32 /* Ciphers */
#define KCF_MAXMAC 40 /* Message authentication codes */ #define KCF_MAXMAC 40 /* Message authentication codes */
_Static_assert(KCF_MAXCIPHER == KCF_MAXMECHTAB,
"KCF_MAXCIPHER != KCF_MAXMECHTAB"); /* See KCF_MAXMECHTAB comment */
typedef enum { typedef enum {
KCF_DIGEST_CLASS = 1, KCF_DIGEST_CLASS = 1,
KCF_CIPHER_CLASS, KCF_CIPHER_CLASS,
@ -276,6 +279,9 @@ typedef enum {
#define KCF_FIRST_OPSCLASS KCF_DIGEST_CLASS #define KCF_FIRST_OPSCLASS KCF_DIGEST_CLASS
#define KCF_LAST_OPSCLASS KCF_MAC_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 */ /* The table of all the kcf_xxx_mech_tab[]s, indexed by kcf_ops_class */