From d77702035ae9db8db62f40a8ab35ce9d37751e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Fri, 24 Dec 2021 16:43:18 +0100 Subject: [PATCH] module: icp: remove unused CRYPTO_{NOTIFY_OPDONE,SKIP_REQID,RESTRICTED} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #12901 --- include/sys/crypto/api.h | 8 -------- module/icp/api/kcf_cipher.c | 4 ++-- module/icp/api/kcf_mac.c | 4 ++-- module/icp/core/kcf_callprov.c | 8 ++------ module/icp/core/kcf_sched.c | 8 ++------ module/icp/include/sys/crypto/sched_impl.h | 6 +----- 6 files changed, 9 insertions(+), 29 deletions(-) diff --git a/include/sys/crypto/api.h b/include/sys/crypto/api.h index 65f3237ba7..f310188926 100644 --- a/include/sys/crypto/api.h +++ b/include/sys/crypto/api.h @@ -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; diff --git a/module/icp/api/kcf_cipher.c b/module/icp/api/kcf_cipher.c index 61fb2208ba..30fd0f3d19 100644 --- a/module/icp/api/kcf_cipher.c +++ b/module/icp/api/kcf_cipher.c @@ -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); diff --git a/module/icp/api/kcf_mac.c b/module/icp/api/kcf_mac.c index c2260b2b08..cf805ee1cc 100644 --- a/module/icp/api/kcf_mac.c +++ b/module/icp/api/kcf_mac.c @@ -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); diff --git a/module/icp/core/kcf_callprov.c b/module/icp/core/kcf_callprov.c index 3fe6e3ebce..270579061f 100644 --- a/module/icp/core/kcf_callprov.c +++ b/module/icp/core/kcf_callprov.c @@ -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; } diff --git a/module/icp/core/kcf_sched.c b/module/icp/core/kcf_sched.c index 9e66586a97..5155b4710e 100644 --- a/module/icp/core/kcf_sched.c +++ b/module/icp/core/kcf_sched.c @@ -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); } diff --git a/module/icp/include/sys/crypto/sched_impl.h b/module/icp/include/sys/crypto/sched_impl.h index 6d70c65bfa..eb08f57baa 100644 --- a/module/icp/include/sys/crypto/sched_impl.h +++ b/module/icp/include/sys/crypto/sched_impl.h @@ -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);