module: icp: use original mechanisms
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12901
This commit is contained in:
parent
bcee18d4e0
commit
167ced3fb1
|
@ -159,7 +159,7 @@ crypto_cipher_init_prov(crypto_provider_t provider, crypto_session_id_t sid,
|
|||
KCF_CAN_SHARE_OPSTATE(pd, mech->cm_type)) {
|
||||
kcf_context_t *tctxp = (kcf_context_t *)ctx;
|
||||
kcf_provider_desc_t *tpd = NULL;
|
||||
crypto_mech_info_t *sinfo;
|
||||
const crypto_mech_info_t *sinfo;
|
||||
|
||||
if ((kcf_get_sw_prov(mech->cm_type, &tpd, &tctxp->kc_mech,
|
||||
B_FALSE) == CRYPTO_SUCCESS)) {
|
||||
|
|
|
@ -280,7 +280,7 @@ kcf_init_mech_tabs(void)
|
|||
* KCF_SUCCESS otherwise.
|
||||
*/
|
||||
static int
|
||||
kcf_create_mech_entry(kcf_ops_class_t class, char *mechname)
|
||||
kcf_create_mech_entry(kcf_ops_class_t class, const char *mechname)
|
||||
{
|
||||
crypto_mech_type_t mt;
|
||||
kcf_mech_entry_t *me_tab;
|
||||
|
@ -365,7 +365,7 @@ kcf_add_mech_provider(short mech_indx,
|
|||
{
|
||||
int error;
|
||||
kcf_mech_entry_t *mech_entry = NULL;
|
||||
crypto_mech_info_t *mech_info;
|
||||
const crypto_mech_info_t *mech_info;
|
||||
crypto_mech_type_t kcf_mech_type;
|
||||
kcf_prov_mech_desc_t *prov_mech;
|
||||
|
||||
|
@ -491,7 +491,7 @@ kcf_add_mech_provider(short mech_indx,
|
|||
* User context only.
|
||||
*/
|
||||
void
|
||||
kcf_remove_mech_provider(char *mech_name, kcf_provider_desc_t *prov_desc)
|
||||
kcf_remove_mech_provider(const char *mech_name, kcf_provider_desc_t *prov_desc)
|
||||
{
|
||||
crypto_mech_type_t mech_type;
|
||||
kcf_prov_mech_desc_t *prov_mech = NULL, *prov_chain;
|
||||
|
|
|
@ -206,9 +206,6 @@ kcf_alloc_provider_desc(const crypto_provider_info_t *info)
|
|||
kcf_provider_desc_t *desc =
|
||||
kmem_zalloc(sizeof (kcf_provider_desc_t), KM_SLEEP);
|
||||
|
||||
desc->pd_mech_list_count = info->pi_mech_list_count;
|
||||
desc->pd_mechanisms = kmem_zalloc(sizeof (crypto_mech_info_t) *
|
||||
info->pi_mech_list_count, KM_SLEEP);
|
||||
for (int i = 0; i < KCF_OPS_CLASSSIZE; i++)
|
||||
for (int j = 0; j < KCF_MAXMECHTAB; j++)
|
||||
desc->pd_mech_indx[i][j] = KCF_INVALID_INDX;
|
||||
|
@ -272,11 +269,6 @@ kcf_free_provider_desc(kcf_provider_desc_t *desc)
|
|||
|
||||
/* free the kernel memory associated with the provider descriptor */
|
||||
|
||||
if (desc->pd_mechanisms != NULL)
|
||||
/* free the memory associated with the mechanism info's */
|
||||
kmem_free(desc->pd_mechanisms, sizeof (crypto_mech_info_t) *
|
||||
desc->pd_mech_list_count);
|
||||
|
||||
if (desc->pd_sched_info.ks_taskq != NULL)
|
||||
taskq_destroy(desc->pd_sched_info.ks_taskq);
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ typedef struct kcf_provider_desc {
|
|||
const crypto_ops_t *pd_ops_vector;
|
||||
ushort_t pd_mech_indx[KCF_OPS_CLASSSIZE]\
|
||||
[KCF_MAXMECHTAB];
|
||||
crypto_mech_info_t *pd_mechanisms;
|
||||
const crypto_mech_info_t *pd_mechanisms;
|
||||
kcf_sched_info_t pd_sched_info;
|
||||
uint_t pd_mech_list_count;
|
||||
// char *pd_name;
|
||||
|
@ -669,7 +669,7 @@ extern void kcf_destroy_mech_tabs(void);
|
|||
extern void kcf_init_mech_tabs(void);
|
||||
extern int kcf_add_mech_provider(short, kcf_provider_desc_t *,
|
||||
kcf_prov_mech_desc_t **);
|
||||
extern void kcf_remove_mech_provider(char *, kcf_provider_desc_t *);
|
||||
extern void kcf_remove_mech_provider(const char *, kcf_provider_desc_t *);
|
||||
extern int kcf_get_mech_entry(crypto_mech_type_t, kcf_mech_entry_t **);
|
||||
extern kcf_provider_desc_t *kcf_alloc_provider_desc(
|
||||
const crypto_provider_info_t *);
|
||||
|
|
|
@ -338,13 +338,12 @@ init_prov_mechs(const crypto_provider_info_t *info, kcf_provider_desc_t *desc)
|
|||
int err = CRYPTO_SUCCESS;
|
||||
kcf_prov_mech_desc_t *pmd;
|
||||
int desc_use_count = 0;
|
||||
int mcount = desc->pd_mech_list_count;
|
||||
|
||||
if (desc->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
|
||||
if (info != NULL) {
|
||||
ASSERT(info->pi_mechanisms != NULL);
|
||||
bcopy(info->pi_mechanisms, desc->pd_mechanisms,
|
||||
sizeof (crypto_mech_info_t) * mcount);
|
||||
desc->pd_mech_list_count = info->pi_mech_list_count;
|
||||
desc->pd_mechanisms = info->pi_mechanisms;
|
||||
}
|
||||
return (CRYPTO_SUCCESS);
|
||||
}
|
||||
|
@ -357,8 +356,8 @@ init_prov_mechs(const crypto_provider_info_t *info, kcf_provider_desc_t *desc)
|
|||
*/
|
||||
if (info != NULL) {
|
||||
ASSERT(info->pi_mechanisms != NULL);
|
||||
bcopy(info->pi_mechanisms, desc->pd_mechanisms,
|
||||
sizeof (crypto_mech_info_t) * mcount);
|
||||
desc->pd_mech_list_count = info->pi_mech_list_count;
|
||||
desc->pd_mechanisms = info->pi_mechanisms;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -366,7 +365,7 @@ init_prov_mechs(const crypto_provider_info_t *info, kcf_provider_desc_t *desc)
|
|||
* to the corresponding KCF mechanism mech_entry chain.
|
||||
*/
|
||||
for (mech_idx = 0; mech_idx < desc->pd_mech_list_count; mech_idx++) {
|
||||
crypto_mech_info_t *mi = &desc->pd_mechanisms[mech_idx];
|
||||
const crypto_mech_info_t *mi = &desc->pd_mechanisms[mech_idx];
|
||||
|
||||
if ((mi->cm_mech_flags & CRYPTO_KEYSIZE_UNIT_IN_BITS) &&
|
||||
(mi->cm_mech_flags & CRYPTO_KEYSIZE_UNIT_IN_BYTES)) {
|
||||
|
|
Loading…
Reference in New Issue