~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/crypto/mcryptd.h

Version: ~ [ linux-6.1-rc7 ] ~ [ linux-6.0.10 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.80 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.156 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.225 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.267 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.300 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.334 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Software async multibuffer crypto daemon headers
  3  *
  4  *    Author:
  5  *             Tim Chen <tim.c.chen@linux.intel.com>
  6  *
  7  *    Copyright (c) 2014, Intel Corporation.
  8  */
  9 
 10 #ifndef _CRYPTO_MCRYPT_H
 11 #define _CRYPTO_MCRYPT_H
 12 
 13 #include <linux/crypto.h>
 14 #include <linux/kernel.h>
 15 #include <crypto/hash.h>
 16 
 17 struct mcryptd_ahash {
 18         struct crypto_ahash base;
 19 };
 20 
 21 static inline struct mcryptd_ahash *__mcryptd_ahash_cast(
 22         struct crypto_ahash *tfm)
 23 {
 24         return (struct mcryptd_ahash *)tfm;
 25 }
 26 
 27 struct mcryptd_cpu_queue {
 28         struct crypto_queue queue;
 29         spinlock_t q_lock;
 30         struct work_struct work;
 31 };
 32 
 33 struct mcryptd_queue {
 34         struct mcryptd_cpu_queue __percpu *cpu_queue;
 35 };
 36 
 37 struct mcryptd_instance_ctx {
 38         struct crypto_spawn spawn;
 39         struct mcryptd_queue *queue;
 40 };
 41 
 42 struct mcryptd_hash_ctx {
 43         struct crypto_shash *child;
 44         struct mcryptd_alg_state *alg_state;
 45 };
 46 
 47 struct mcryptd_tag {
 48         /* seq number of request */
 49         unsigned seq_num;
 50         /* arrival time of request */
 51         unsigned long arrival;
 52         unsigned long expire;
 53         int     cpu;
 54 };
 55 
 56 struct mcryptd_hash_request_ctx {
 57         struct list_head waiter;
 58         crypto_completion_t complete;
 59         struct mcryptd_tag tag;
 60         struct crypto_hash_walk walk;
 61         u8 *out;
 62         int flag;
 63         struct shash_desc desc;
 64 };
 65 
 66 struct mcryptd_ahash *mcryptd_alloc_ahash(const char *alg_name,
 67                                         u32 type, u32 mask);
 68 struct crypto_shash *mcryptd_ahash_child(struct mcryptd_ahash *tfm);
 69 struct shash_desc *mcryptd_shash_desc(struct ahash_request *req);
 70 void mcryptd_free_ahash(struct mcryptd_ahash *tfm);
 71 void mcryptd_flusher(struct work_struct *work);
 72 
 73 enum mcryptd_req_type {
 74         MCRYPTD_NONE,
 75         MCRYPTD_UPDATE,
 76         MCRYPTD_FINUP,
 77         MCRYPTD_DIGEST,
 78         MCRYPTD_FINAL
 79 };
 80 
 81 struct mcryptd_alg_cstate {
 82         unsigned long next_flush;
 83         unsigned next_seq_num;
 84         bool    flusher_engaged;
 85         struct  delayed_work flush;
 86         int     cpu;
 87         struct  mcryptd_alg_state *alg_state;
 88         void    *mgr;
 89         spinlock_t work_lock;
 90         struct list_head work_list;
 91         struct list_head flush_list;
 92 };
 93 
 94 struct mcryptd_alg_state {
 95         struct mcryptd_alg_cstate __percpu *alg_cstate;
 96         unsigned long (*flusher)(struct mcryptd_alg_cstate *cstate);
 97 };
 98 
 99 /* return delay in jiffies from current time */
100 static inline unsigned long get_delay(unsigned long t)
101 {
102         long delay;
103 
104         delay = (long) t - (long) jiffies;
105         if (delay <= 0)
106                 return 0;
107         else
108                 return (unsigned long) delay;
109 }
110 
111 void mcryptd_arm_flusher(struct mcryptd_alg_cstate *cstate, unsigned long delay);
112 
113 #endif
114 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp