module: icp: remove unused CRYPTO_{NOTIFY_OPDONE,SKIP_REQID,RESTRICTED}

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12901
This commit is contained in:
наб 2021-12-24 16:43:18 +01:00 committed by Brian Behlendorf
parent eb1e09b7ec
commit d77702035a
6 changed files with 9 additions and 29 deletions

View File

@ -38,15 +38,7 @@ typedef void *crypto_bc_t;
typedef void *crypto_context_t;
typedef void *crypto_ctx_template_t;
typedef uint32_t crypto_call_flag_t;
/* crypto_call_flag's values */
#define CRYPTO_NOTIFY_OPDONE 0x00000002 /* Notify intermediate steps */
#define CRYPTO_SKIP_REQID 0x00000004 /* Skip request ID generation */
#define CRYPTO_RESTRICTED 0x00000008 /* cannot use restricted prov */
typedef struct {
crypto_call_flag_t cr_flag;
void (*cr_callback_func)(void *, int);
void *cr_callback_arg;
crypto_req_id_t cr_reqid;

View File

@ -83,7 +83,7 @@ crypto_encrypt(crypto_mechanism_t *mech, crypto_data_t *plaintext,
retry:
/* pd is returned held */
if ((pd = kcf_get_mech_provider(mech->cm_type, &me, &error,
list, CRYPTO_FG_ENCRYPT_ATOMIC, CHECK_RESTRICT(crq))) == NULL) {
list, CRYPTO_FG_ENCRYPT_ATOMIC)) == NULL) {
if (list != NULL)
kcf_free_triedlist(list);
return (error);
@ -161,7 +161,7 @@ crypto_decrypt(crypto_mechanism_t *mech, crypto_data_t *ciphertext,
retry:
/* pd is returned held */
if ((pd = kcf_get_mech_provider(mech->cm_type, &me, &error,
list, CRYPTO_FG_DECRYPT_ATOMIC, CHECK_RESTRICT(crq))) == NULL) {
list, CRYPTO_FG_DECRYPT_ATOMIC)) == NULL) {
if (list != NULL)
kcf_free_triedlist(list);
return (error);

View File

@ -102,7 +102,7 @@ crypto_mac(crypto_mechanism_t *mech, crypto_data_t *data,
retry:
/* The pd is returned held */
if ((pd = kcf_get_mech_provider(mech->cm_type, &me, &error,
list, CRYPTO_FG_MAC_ATOMIC, CHECK_RESTRICT(crq))) == NULL) {
list, CRYPTO_FG_MAC_ATOMIC)) == NULL) {
if (list != NULL)
kcf_free_triedlist(list);
return (error);
@ -219,7 +219,7 @@ crypto_mac_init(crypto_mechanism_t *mech, crypto_key_t *key,
retry:
/* The pd is returned held */
if ((pd = kcf_get_mech_provider(mech->cm_type, &me, &error,
list, CRYPTO_FG_MAC, CHECK_RESTRICT(crq))) == NULL) {
list, CRYPTO_FG_MAC)) == NULL) {
if (list != NULL)
kcf_free_triedlist(list);
return (error);

View File

@ -78,14 +78,10 @@ is_in_triedlist(kcf_provider_desc_t *pd, kcf_prov_tried_t *triedl)
* search to find one. This is fine as we assume there are only a few
* number of providers in this list. If this assumption ever changes,
* we should revisit this.
*
* call_restrict represents if the caller should not be allowed to
* use restricted providers.
*/
kcf_provider_desc_t *
kcf_get_mech_provider(crypto_mech_type_t mech_type, kcf_mech_entry_t **mepp,
int *error, kcf_prov_tried_t *triedl, crypto_func_group_t fg,
boolean_t call_restrict)
int *error, kcf_prov_tried_t *triedl, crypto_func_group_t fg)
{
kcf_provider_desc_t *pd = NULL;
kcf_prov_mech_desc_t *mdesc;
@ -119,7 +115,7 @@ kcf_get_mech_provider(crypto_mech_type_t mech_type, kcf_mech_entry_t **mepp,
if (!IS_FG_SUPPORTED(mdesc, fg) ||
!KCF_IS_PROV_USABLE(pd) ||
IS_PROVIDER_TRIED(pd, triedl) ||
(call_restrict && (pd->pd_flags & KCF_PROV_RESTRICTED)))
(pd->pd_flags & KCF_PROV_RESTRICTED))
pd = NULL;
}

View File

@ -265,8 +265,7 @@ kcf_resubmit_request(kcf_areq_node_t *areq)
return (error);
new_pd = kcf_get_mech_provider(mech1->cm_type, NULL, &error,
areq->an_tried_plist, fg,
(areq->an_reqarg.cr_flag & CRYPTO_RESTRICTED));
areq->an_tried_plist, fg);
if (new_pd == NULL)
return (error);
@ -684,16 +683,13 @@ kcf_aop_done(kcf_areq_node_t *areq, int error)
* atomic operations.
*/
skip_notify = (IS_UPDATE_OP(optype) || IS_INIT_OP(optype)) &&
(!(areq->an_reqarg.cr_flag & CRYPTO_NOTIFY_OPDONE)) &&
(error == CRYPTO_SUCCESS);
if (!skip_notify) {
NOTIFY_CLIENT(areq, error);
}
if (!(areq->an_reqarg.cr_flag & CRYPTO_SKIP_REQID))
kcf_reqid_delete(areq);
kcf_reqid_delete(areq);
KCF_AREQ_REFRELE(areq);
}

View File

@ -56,9 +56,6 @@ typedef enum kcf_call_type {
CRYPTO_ASYNCH
} kcf_call_type_t;
#define CHECK_RESTRICT(crq) (crq != NULL && \
((crq)->cr_flag & CRYPTO_RESTRICTED))
#define KCF_KMFLAG(crq) (((crq) == NULL) ? KM_SLEEP : KM_NOSLEEP)
/*
@ -445,8 +442,7 @@ extern void kcf_free_triedlist(kcf_prov_tried_t *);
extern kcf_prov_tried_t *kcf_insert_triedlist(kcf_prov_tried_t **,
kcf_provider_desc_t *, int);
extern kcf_provider_desc_t *kcf_get_mech_provider(crypto_mech_type_t,
kcf_mech_entry_t **, int *, kcf_prov_tried_t *, crypto_func_group_t,
boolean_t);
kcf_mech_entry_t **, int *, kcf_prov_tried_t *, crypto_func_group_t);
extern crypto_ctx_t *kcf_new_ctx(crypto_call_req_t *, kcf_provider_desc_t *,
crypto_session_id_t);
extern void kcf_sched_destroy(void);