mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
module: icp: drop software provider generation numbers
We register all providers at once, before anything happens Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12901
This commit is contained in:
@@ -90,22 +90,8 @@ retry:
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the validity of the context template
|
||||
* It is very rare that the generation number mis-matches, so
|
||||
* is acceptable to fail here, and let the consumer recover by
|
||||
* freeing this tmpl and create a new one for the key and new provider
|
||||
*/
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL)) {
|
||||
if (ctx_tmpl->ct_generation != me->me_gen_swprov) {
|
||||
if (list != NULL)
|
||||
kcf_free_triedlist(list);
|
||||
KCF_PROV_REFRELE(pd);
|
||||
return (CRYPTO_OLD_CTX_TEMPLATE);
|
||||
} else {
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
}
|
||||
}
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL))
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
|
||||
/* The fast path for SW providers. */
|
||||
if (CHECK_FASTPATH(crq, pd)) {
|
||||
@@ -193,22 +179,8 @@ retry:
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the validity of the context template
|
||||
* It is very rare that the generation number mis-matches, so
|
||||
* is acceptable to fail here, and let the consumer recover by
|
||||
* freeing this tmpl and create a new one for the key and new provider
|
||||
*/
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL)) {
|
||||
if (ctx_tmpl->ct_generation != me->me_gen_swprov) {
|
||||
if (list != NULL)
|
||||
kcf_free_triedlist(list);
|
||||
KCF_PROV_REFRELE(pd);
|
||||
return (CRYPTO_OLD_CTX_TEMPLATE);
|
||||
} else {
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
}
|
||||
}
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL))
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
|
||||
/* The fast path for SW providers. */
|
||||
if (CHECK_FASTPATH(crq, pd)) {
|
||||
|
||||
@@ -104,7 +104,6 @@ crypto_create_ctx_template(crypto_mechanism_t *mech, crypto_key_t *key,
|
||||
&(ctx_tmpl->ct_prov_tmpl), &(ctx_tmpl->ct_size), KCF_RHNDL(kmflag));
|
||||
|
||||
if (error == CRYPTO_SUCCESS) {
|
||||
ctx_tmpl->ct_generation = me->me_gen_swprov;
|
||||
*ptmpl = ctx_tmpl;
|
||||
} else {
|
||||
kmem_free(ctx_tmpl, sizeof (kcf_ctx_template_t));
|
||||
|
||||
@@ -109,22 +109,8 @@ retry:
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the validity of the context template
|
||||
* It is very rare that the generation number mis-matches, so
|
||||
* is acceptable to fail here, and let the consumer recover by
|
||||
* freeing this tmpl and create a new one for the key and new provider
|
||||
*/
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL)) {
|
||||
if (ctx_tmpl->ct_generation != me->me_gen_swprov) {
|
||||
if (list != NULL)
|
||||
kcf_free_triedlist(list);
|
||||
KCF_PROV_REFRELE(pd);
|
||||
return (CRYPTO_OLD_CTX_TEMPLATE);
|
||||
} else {
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
}
|
||||
}
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL))
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
|
||||
/* The fast path for SW providers. */
|
||||
if (CHECK_FASTPATH(crq, pd)) {
|
||||
@@ -185,22 +171,8 @@ retry:
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the validity of the context template
|
||||
* It is very rare that the generation number mis-matches, so
|
||||
* is acceptable to fail here, and let the consumer recover by
|
||||
* freeing this tmpl and create a new one for the key and new provider
|
||||
*/
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL)) {
|
||||
if (ctx_tmpl->ct_generation != me->me_gen_swprov) {
|
||||
if (list != NULL)
|
||||
kcf_free_triedlist(list);
|
||||
KCF_PROV_REFRELE(pd);
|
||||
return (CRYPTO_OLD_CTX_TEMPLATE);
|
||||
} else {
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
}
|
||||
}
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL))
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
|
||||
/* The fast path for SW providers. */
|
||||
if (CHECK_FASTPATH(crq, pd)) {
|
||||
@@ -345,16 +317,8 @@ retry:
|
||||
* freeing this tmpl and create a new one for the key and new provider
|
||||
*/
|
||||
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL)) {
|
||||
if (ctx_tmpl->ct_generation != me->me_gen_swprov) {
|
||||
if (list != NULL)
|
||||
kcf_free_triedlist(list);
|
||||
KCF_PROV_REFRELE(pd);
|
||||
return (CRYPTO_OLD_CTX_TEMPLATE);
|
||||
} else {
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
}
|
||||
}
|
||||
if (((ctx_tmpl = (kcf_ctx_template_t *)tmpl) != NULL))
|
||||
spi_ctx_tmpl = ctx_tmpl->ct_prov_tmpl;
|
||||
|
||||
error = crypto_mac_init_prov(pd, pd->pd_sid, mech, key,
|
||||
spi_ctx_tmpl, ctxp, crq);
|
||||
|
||||
Reference in New Issue
Block a user