diff --git a/module/icp/core/kcf_callprov.c b/module/icp/core/kcf_callprov.c index db8e33d5f..b5ef5f111 100644 --- a/module/icp/core/kcf_callprov.c +++ b/module/icp/core/kcf_callprov.c @@ -107,8 +107,6 @@ kcf_get_mech_provider(crypto_mech_type_t mech_type, kcf_mech_entry_t **mepp, if (mepp != NULL) *mepp = me; - mutex_enter(&me->me_mutex); - /* Is there a provider? */ if (pd == NULL && (mdesc = me->me_sw_prov) != NULL) { pd = mdesc->pm_prov_desc; @@ -130,6 +128,5 @@ kcf_get_mech_provider(crypto_mech_type_t mech_type, kcf_mech_entry_t **mepp, } else KCF_PROV_REFHOLD(pd); - mutex_exit(&me->me_mutex); return (pd); } diff --git a/module/icp/core/kcf_mech_tabs.c b/module/icp/core/kcf_mech_tabs.c index ab932ae0b..1cb19896a 100644 --- a/module/icp/core/kcf_mech_tabs.c +++ b/module/icp/core/kcf_mech_tabs.c @@ -146,8 +146,6 @@ kcf_destroy_mech_tabs(void) for (class = KCF_FIRST_OPSCLASS; class <= KCF_LAST_OPSCLASS; class++) { max = kcf_mech_tabs_tab[class].met_size; me_tab = kcf_mech_tabs_tab[class].met_tab; - for (i = 0; i < max; i++) - mutex_destroy(&(me_tab[i].me_mutex)); } } @@ -176,8 +174,6 @@ kcf_init_mech_tabs(void) 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++) { - mutex_init(&(me_tab[i].me_mutex), NULL, - MUTEX_DEFAULT, NULL); if (me_tab[i].me_name[0] != 0) { me_tab[i].me_mechid = KCF_MECHID(class, i); (void) mod_hash_insert(kcf_mech_hash, @@ -242,7 +238,6 @@ kcf_create_mech_entry(kcf_ops_class_t class, const char *mechname) size = kcf_mech_tabs_tab[class].met_size; while (i < size) { - mutex_enter(&(me_tab[i].me_mutex)); if (me_tab[i].me_name[0] == 0) { /* Found an empty spot */ (void) strlcpy(me_tab[i].me_name, mechname, @@ -250,14 +245,12 @@ kcf_create_mech_entry(kcf_ops_class_t class, const char *mechname) me_tab[i].me_name[CRYPTO_MAX_MECH_NAME-1] = '\0'; me_tab[i].me_mechid = KCF_MECHID(class, i); - mutex_exit(&(me_tab[i].me_mutex)); /* Add the new mechanism to the hash table */ (void) mod_hash_insert(kcf_mech_hash, (mod_hash_key_t)me_tab[i].me_name, (mod_hash_val_t)&(me_tab[i].me_mechid)); break; } - mutex_exit(&(me_tab[i].me_mutex)); i++; } @@ -353,7 +346,6 @@ kcf_add_mech_provider(short mech_indx, * Add new kcf_prov_mech_desc at the front of HW providers * chain. */ - mutex_enter(&mech_entry->me_mutex); if (mech_entry->me_sw_prov != NULL) { /* * There is already a provider for this mechanism. @@ -377,7 +369,6 @@ kcf_add_mech_provider(short mech_indx, */ mech_entry->me_sw_prov = prov_mech; } - mutex_exit(&mech_entry->me_mutex); *pmdpp = prov_mech; @@ -425,16 +416,13 @@ kcf_remove_mech_provider(const char *mech_name, kcf_provider_desc_t *prov_desc) return; } - mutex_enter(&mech_entry->me_mutex); if (mech_entry->me_sw_prov == NULL || mech_entry->me_sw_prov->pm_prov_desc != prov_desc) { /* not the provider for this mechanism */ - mutex_exit(&mech_entry->me_mutex); return; } prov_mech = mech_entry->me_sw_prov; mech_entry->me_sw_prov = NULL; - mutex_exit(&mech_entry->me_mutex); /* free entry */ KCF_PROV_REFRELE(prov_mech->pm_prov_desc); diff --git a/module/icp/core/kcf_prov_tabs.c b/module/icp/core/kcf_prov_tabs.c index 25d9908d1..b8016e0ce 100644 --- a/module/icp/core/kcf_prov_tabs.c +++ b/module/icp/core/kcf_prov_tabs.c @@ -290,24 +290,17 @@ kcf_get_sw_prov(crypto_mech_type_t mech_type, kcf_provider_desc_t **pd, if (kcf_get_mech_entry(mech_type, &me) != KCF_SUCCESS) return (CRYPTO_MECHANISM_INVALID); - /* - * Get the provider for this mechanism. - * Lock the mech_entry until we grab the 'pd'. - */ - mutex_enter(&me->me_mutex); - + /* Get the provider for this mechanism. */ if (me->me_sw_prov == NULL || (*pd = me->me_sw_prov->pm_prov_desc) == NULL) { /* no provider for this mechanism */ if (log_warn) cmn_err(CE_WARN, "no provider for \"%s\"\n", me->me_name); - mutex_exit(&me->me_mutex); return (CRYPTO_MECH_NOT_SUPPORTED); } KCF_PROV_REFHOLD(*pd); - mutex_exit(&me->me_mutex); if (mep != NULL) *mep = me; diff --git a/module/icp/include/sys/crypto/impl.h b/module/icp/include/sys/crypto/impl.h index 66ddcf43b..78fe7eb64 100644 --- a/module/icp/include/sys/crypto/impl.h +++ b/module/icp/include/sys/crypto/impl.h @@ -244,7 +244,6 @@ typedef struct kcf_prov_mech_desc { typedef struct kcf_mech_entry { crypto_mech_name_t me_name; /* mechanism name */ crypto_mech_type_t me_mechid; /* Internal id for mechanism */ - kmutex_t me_mutex; /* access protection */ kcf_prov_mech_desc_t *me_sw_prov; /* provider */ } kcf_mech_entry_t;