Skip to content

Commit

Permalink
module: icp: enforce KCF_{OPS_CLASSSIZE,MAXMECHTAB}
Browse files Browse the repository at this point in the history
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
  • Loading branch information
nabijaczleweli committed Jan 13, 2022
1 parent 7d94f58 commit 6a49073
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion module/icp/include/sys/crypto/impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 */

Expand Down

0 comments on commit 6a49073

Please sign in to comment.