Skip to content

Commit

Permalink
module: icp: remove algorithm name defines used only in the default m…
Browse files Browse the repository at this point in the history
…echtab

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12901

Squashed with to ensure compile still works.

module: icp: remove pre-set entries from mechtabs

They don't do anything except clogging up the AVL tree

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12901
  • Loading branch information
nabijaczleweli authored and andrewc12 committed Sep 23, 2022
1 parent f0e05e1 commit bb489fc
Showing 2 changed files with 3 additions and 49 deletions.
13 changes: 0 additions & 13 deletions include/sys/crypto/common.h
Original file line number Diff line number Diff line change
@@ -170,12 +170,6 @@ typedef uint32_t crypto_keysize_unit_t;


/* Mechanisms supported out-of-the-box */
#define SUN_CKM_MD5 "CKM_MD5"
#define SUN_CKM_MD5_HMAC "CKM_MD5_HMAC"
#define SUN_CKM_MD5_HMAC_GENERAL "CKM_MD5_HMAC_GENERAL"
#define SUN_CKM_SHA1 "CKM_SHA_1"
#define SUN_CKM_SHA1_HMAC "CKM_SHA_1_HMAC"
#define SUN_CKM_SHA1_HMAC_GENERAL "CKM_SHA_1_HMAC_GENERAL"
#define SUN_CKM_SHA256 "CKM_SHA256"
#define SUN_CKM_SHA256_HMAC "CKM_SHA256_HMAC"
#define SUN_CKM_SHA256_HMAC_GENERAL "CKM_SHA256_HMAC_GENERAL"
@@ -187,19 +181,12 @@ typedef uint32_t crypto_keysize_unit_t;
#define SUN_CKM_SHA512_HMAC_GENERAL "CKM_SHA512_HMAC_GENERAL"
#define SUN_CKM_SHA512_224 "CKM_SHA512_224"
#define SUN_CKM_SHA512_256 "CKM_SHA512_256"
#define SUN_CKM_DES_CBC "CKM_DES_CBC"
#define SUN_CKM_DES3_CBC "CKM_DES3_CBC"
#define SUN_CKM_DES_ECB "CKM_DES_ECB"
#define SUN_CKM_DES3_ECB "CKM_DES3_ECB"
#define SUN_CKM_BLOWFISH_CBC "CKM_BLOWFISH_CBC"
#define SUN_CKM_BLOWFISH_ECB "CKM_BLOWFISH_ECB"
#define SUN_CKM_AES_CBC "CKM_AES_CBC"
#define SUN_CKM_AES_ECB "CKM_AES_ECB"
#define SUN_CKM_AES_CTR "CKM_AES_CTR"
#define SUN_CKM_AES_CCM "CKM_AES_CCM"
#define SUN_CKM_AES_GCM "CKM_AES_GCM"
#define SUN_CKM_AES_GMAC "CKM_AES_GMAC"
#define SUN_CKM_RC4 "CKM_RC4"

/* Data arguments of cryptographic operations */

39 changes: 3 additions & 36 deletions module/icp/core/kcf_mech_tabs.c
Original file line number Diff line number Diff line change
@@ -75,27 +75,9 @@

/* RFE 4687834 Will deal with the extensibility of these tables later */

static kcf_mech_entry_t kcf_digest_mechs_tab[KCF_MAXDIGEST] = {
{ SUN_CKM_MD5 },
{ SUN_CKM_SHA1 },
};
static kcf_mech_entry_t kcf_cipher_mechs_tab[KCF_MAXCIPHER] = {
{ SUN_CKM_DES_CBC },
{ SUN_CKM_DES3_CBC },
{ SUN_CKM_DES_ECB },
{ SUN_CKM_DES3_ECB },
{ SUN_CKM_BLOWFISH_CBC },
{ SUN_CKM_BLOWFISH_ECB },
{ SUN_CKM_AES_CBC },
{ SUN_CKM_AES_ECB },
{ SUN_CKM_RC4 },
};
static kcf_mech_entry_t kcf_mac_mechs_tab[KCF_MAXMAC] = {
{ SUN_CKM_MD5_HMAC },
{ SUN_CKM_MD5_HMAC_GENERAL },
{ SUN_CKM_SHA1_HMAC },
{ SUN_CKM_SHA1_HMAC_GENERAL },
};
static kcf_mech_entry_t kcf_digest_mechs_tab[KCF_MAXDIGEST];
static kcf_mech_entry_t kcf_cipher_mechs_tab[KCF_MAXCIPHER];
static kcf_mech_entry_t kcf_mac_mechs_tab[KCF_MAXMAC];

const kcf_mech_entry_tab_t kcf_mech_tabs_tab[KCF_LAST_OPSCLASS + 1] = {
{0, NULL}, /* No class zero */
@@ -131,23 +113,8 @@ kcf_destroy_mech_tabs(void)
void
kcf_init_mech_tabs(void)
{
kcf_ops_class_t class;
kcf_mech_entry_t *me_tab;

/* Then the pre-defined mechanism entries */
avl_create(&kcf_mech_hash, kcf_mech_hash_compar,
sizeof (kcf_mech_entry_t), offsetof(kcf_mech_entry_t, me_node));

for (class = KCF_FIRST_OPSCLASS; class <= KCF_LAST_OPSCLASS; class++) {
int max = kcf_mech_tabs_tab[class].met_size;
me_tab = kcf_mech_tabs_tab[class].met_tab;
for (int i = 0; i < max; i++) {
if (me_tab[i].me_name[0] != 0) {
me_tab[i].me_mechid = KCF_MECHID(class, i);
avl_add(&kcf_mech_hash, &me_tab[i]);
}
}
}
}

/*

0 comments on commit bb489fc

Please sign in to comment.