File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -707,5 +707,15 @@ void crypto_req_done(void *data, int err)
707707}
708708EXPORT_SYMBOL_GPL (crypto_req_done );
709709
710+ void crypto_destroy_alg (struct crypto_alg * alg )
711+ {
712+ if (alg -> cra_type && alg -> cra_type -> destroy )
713+ alg -> cra_type -> destroy (alg );
714+
715+ if (alg -> cra_destroy )
716+ alg -> cra_destroy (alg );
717+ }
718+ EXPORT_SYMBOL_GPL (crypto_destroy_alg );
719+
710720MODULE_DESCRIPTION ("Cryptographic core API" );
711721MODULE_LICENSE ("GPL" );
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ struct crypto_type {
4040 void (* show )(struct seq_file * m , struct crypto_alg * alg );
4141 int (* report )(struct sk_buff * skb , struct crypto_alg * alg );
4242 void (* free )(struct crypto_instance * inst );
43+ void (* destroy )(struct crypto_alg * alg );
4344
4445 unsigned int type ;
4546 unsigned int maskclear ;
@@ -127,6 +128,7 @@ void *crypto_create_tfm_node(struct crypto_alg *alg,
127128 const struct crypto_type * frontend , int node );
128129void * crypto_clone_tfm (const struct crypto_type * frontend ,
129130 struct crypto_tfm * otfm );
131+ void crypto_destroy_alg (struct crypto_alg * alg );
130132
131133static inline void * crypto_create_tfm (struct crypto_alg * alg ,
132134 const struct crypto_type * frontend )
@@ -163,8 +165,8 @@ static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg)
163165
164166static inline void crypto_alg_put (struct crypto_alg * alg )
165167{
166- if (refcount_dec_and_test (& alg -> cra_refcnt ) && alg -> cra_destroy )
167- alg -> cra_destroy (alg );
168+ if (refcount_dec_and_test (& alg -> cra_refcnt ))
169+ crypto_destroy_alg (alg );
168170}
169171
170172static inline int crypto_tmpl_get (struct crypto_template * tmpl )
You can’t perform that action at this time.
0 commit comments