Blame view
crypto/internal.h
3.8 KB
2874c5fd2 treewide: Replace... |
1 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
1da177e4c Linux-2.6.12-rc2 |
2 3 4 5 |
/* * Cryptographic API. * * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> |
5cb1454b8 [CRYPTO] Allow mu... |
6 |
* Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au> |
1da177e4c Linux-2.6.12-rc2 |
7 8 9 |
*/ #ifndef _CRYPTO_INTERNAL_H #define _CRYPTO_INTERNAL_H |
cce9e06d1 [CRYPTO] api: Spl... |
10 11 |
#include <crypto/algapi.h> |
2825982d9 [CRYPTO] api: Add... |
12 |
#include <linux/completion.h> |
5cb1454b8 [CRYPTO] Allow mu... |
13 |
#include <linux/list.h> |
4cc7720cd [CRYPTO] api: Add... |
14 |
#include <linux/module.h> |
2825982d9 [CRYPTO] api: Add... |
15 |
#include <linux/notifier.h> |
1dbb920e3 crypto: algapi - ... |
16 17 |
#include <linux/numa.h> #include <linux/refcount.h> |
5cb1454b8 [CRYPTO] Allow mu... |
18 |
#include <linux/rwsem.h> |
1dbb920e3 crypto: algapi - ... |
19 20 |
#include <linux/sched.h> #include <linux/types.h> |
ccb778e18 crypto: api - Add... |
21 |
|
4cc7720cd [CRYPTO] api: Add... |
22 23 |
struct crypto_instance; struct crypto_template; |
2825982d9 [CRYPTO] api: Add... |
24 25 26 27 |
struct crypto_larval { struct crypto_alg alg; struct crypto_alg *adult; struct completion completion; |
492e2b63e [CRYPTO] api: All... |
28 |
u32 mask; |
2825982d9 [CRYPTO] api: Add... |
29 |
}; |
5cb1454b8 [CRYPTO] Allow mu... |
30 31 |
extern struct list_head crypto_alg_list; extern struct rw_semaphore crypto_alg_sem; |
2825982d9 [CRYPTO] api: Add... |
32 |
extern struct blocking_notifier_head crypto_chain; |
5cb1454b8 [CRYPTO] Allow mu... |
33 |
|
1da177e4c Linux-2.6.12-rc2 |
34 35 |
#ifdef CONFIG_PROC_FS void __init crypto_init_proc(void); |
cce9e06d1 [CRYPTO] api: Spl... |
36 |
void __exit crypto_exit_proc(void); |
1da177e4c Linux-2.6.12-rc2 |
37 38 39 |
#else static inline void crypto_init_proc(void) { } |
cce9e06d1 [CRYPTO] api: Spl... |
40 41 |
static inline void crypto_exit_proc(void) { } |
1da177e4c Linux-2.6.12-rc2 |
42 |
#endif |
f1ddcaf33 [CRYPTO] api: Rem... |
43 |
static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg) |
fbdae9f3e [CRYPTO] Ensure c... |
44 |
{ |
f1ddcaf33 [CRYPTO] api: Rem... |
45 |
return alg->cra_ctxsize; |
fbdae9f3e [CRYPTO] Ensure c... |
46 |
} |
f1ddcaf33 [CRYPTO] api: Rem... |
47 |
static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg) |
fbdae9f3e [CRYPTO] Ensure c... |
48 49 50 |
{ return alg->cra_ctxsize; } |
2825982d9 [CRYPTO] api: Add... |
51 |
struct crypto_alg *crypto_mod_get(struct crypto_alg *alg); |
492e2b63e [CRYPTO] api: All... |
52 |
struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask); |
2825982d9 [CRYPTO] api: Add... |
53 |
|
73d3864a4 crypto: api - Use... |
54 |
struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask); |
b9c55aa47 [CRYPTO] skcipher... |
55 |
void crypto_larval_kill(struct crypto_alg *alg); |
73d3864a4 crypto: api - Use... |
56 |
void crypto_alg_tested(const char *name, int err); |
2825982d9 [CRYPTO] api: Add... |
57 |
|
89b596ba2 crypto: Export cr... |
58 59 |
void crypto_remove_spawns(struct crypto_alg *alg, struct list_head *list, struct crypto_alg *nalg); |
22e5b20be crypto: Export cr... |
60 |
void crypto_remove_final(struct list_head *list); |
6603523bf crypto: api - Fix... |
61 |
void crypto_shoot_alg(struct crypto_alg *alg); |
27d2a3300 [CRYPTO] api: All... |
62 63 |
struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type, u32 mask); |
7bc13b5b6 crypto: api - per... |
64 65 66 67 68 69 70 71 |
void *crypto_create_tfm_node(struct crypto_alg *alg, const struct crypto_type *frontend, int node); static inline void *crypto_create_tfm(struct crypto_alg *alg, const struct crypto_type *frontend) { return crypto_create_tfm_node(alg, frontend, NUMA_NO_NODE); } |
d06854f02 crypto: api - Add... |
72 73 74 |
struct crypto_alg *crypto_find_alg(const char *alg_name, const struct crypto_type *frontend, u32 type, u32 mask); |
7bc13b5b6 crypto: api - per... |
75 76 77 78 79 80 81 82 83 84 |
void *crypto_alloc_tfm_node(const char *alg_name, const struct crypto_type *frontend, u32 type, u32 mask, int node); static inline void *crypto_alloc_tfm(const char *alg_name, const struct crypto_type *frontend, u32 type, u32 mask) { return crypto_alloc_tfm_node(alg_name, frontend, type, mask, NUMA_NO_NODE); } |
4cc7720cd [CRYPTO] api: Add... |
85 |
|
73d3864a4 crypto: api - Use... |
86 |
int crypto_probing_notify(unsigned long val, void *v); |
2825982d9 [CRYPTO] api: Add... |
87 |
|
38d214331 crypto: api - Add... |
88 |
unsigned int crypto_alg_extsize(struct crypto_alg *alg); |
f2aefdab5 crypto: api - Add... |
89 90 |
int crypto_type_has_alg(const char *name, const struct crypto_type *frontend, u32 type, u32 mask); |
939e17799 crypto: algboss -... |
91 92 |
static inline struct crypto_alg *crypto_alg_get(struct crypto_alg *alg) { |
ce8614a31 crypto: algapi - ... |
93 |
refcount_inc(&alg->cra_refcnt); |
939e17799 crypto: algboss -... |
94 95 |
return alg; } |
6bfd48096 [CRYPTO] api: Add... |
96 97 |
static inline void crypto_alg_put(struct crypto_alg *alg) { |
ce8614a31 crypto: algapi - ... |
98 |
if (refcount_dec_and_test(&alg->cra_refcnt) && alg->cra_destroy) |
6bfd48096 [CRYPTO] api: Add... |
99 100 |
alg->cra_destroy(alg); } |
4cc7720cd [CRYPTO] api: Add... |
101 102 103 104 105 106 107 108 109 |
static inline int crypto_tmpl_get(struct crypto_template *tmpl) { return try_module_get(tmpl->module); } static inline void crypto_tmpl_put(struct crypto_template *tmpl) { module_put(tmpl->module); } |
2825982d9 [CRYPTO] api: Add... |
110 111 112 113 |
static inline int crypto_is_larval(struct crypto_alg *alg) { return alg->cra_flags & CRYPTO_ALG_LARVAL; } |
6bfd48096 [CRYPTO] api: Add... |
114 115 116 117 118 119 120 121 122 |
static inline int crypto_is_dead(struct crypto_alg *alg) { return alg->cra_flags & CRYPTO_ALG_DEAD; } static inline int crypto_is_moribund(struct crypto_alg *alg) { return alg->cra_flags & (CRYPTO_ALG_DEAD | CRYPTO_ALG_DYING); } |
73d3864a4 crypto: api - Use... |
123 |
static inline void crypto_notify(unsigned long val, void *v) |
2825982d9 [CRYPTO] api: Add... |
124 |
{ |
73d3864a4 crypto: api - Use... |
125 |
blocking_notifier_call_chain(&crypto_chain, val, v); |
2825982d9 [CRYPTO] api: Add... |
126 |
} |
1dbb920e3 crypto: algapi - ... |
127 128 129 130 131 |
static inline void crypto_yield(u32 flags) { if (flags & CRYPTO_TFM_REQ_MAY_SLEEP) cond_resched(); } |
1da177e4c Linux-2.6.12-rc2 |
132 |
#endif /* _CRYPTO_INTERNAL_H */ |