hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/crypto/internal.h
....@@ -1,36 +1,23 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Cryptographic API.
34 *
45 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
56 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of the GNU General Public License as published by the Free
9
- * Software Foundation; either version 2 of the License, or (at your option)
10
- * any later version.
11
- *
127 */
138 #ifndef _CRYPTO_INTERNAL_H
149 #define _CRYPTO_INTERNAL_H
1510
1611 #include <crypto/algapi.h>
1712 #include <linux/completion.h>
18
-#include <linux/mm.h>
19
-#include <linux/highmem.h>
20
-#include <linux/interrupt.h>
21
-#include <linux/init.h>
2213 #include <linux/list.h>
2314 #include <linux/module.h>
24
-#include <linux/kernel.h>
2515 #include <linux/notifier.h>
16
+#include <linux/numa.h>
17
+#include <linux/refcount.h>
2618 #include <linux/rwsem.h>
27
-#include <linux/slab.h>
28
-
29
-/* Crypto notification events. */
30
-enum {
31
- CRYPTO_MSG_ALG_REQUEST,
32
- CRYPTO_MSG_ALG_REGISTER,
33
-};
19
+#include <linux/sched.h>
20
+#include <linux/types.h>
3421
3522 struct crypto_instance;
3623 struct crypto_template;
....@@ -69,9 +56,6 @@
6956 struct crypto_alg *crypto_mod_get(struct crypto_alg *alg);
7057 struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask);
7158
72
-int crypto_init_cipher_ops(struct crypto_tfm *tfm);
73
-int crypto_init_compress_ops(struct crypto_tfm *tfm);
74
-
7559 struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask);
7660 void crypto_larval_kill(struct crypto_alg *alg);
7761 void crypto_alg_tested(const char *name, int err);
....@@ -79,18 +63,32 @@
7963 void crypto_remove_spawns(struct crypto_alg *alg, struct list_head *list,
8064 struct crypto_alg *nalg);
8165 void crypto_remove_final(struct list_head *list);
66
+void crypto_shoot_alg(struct crypto_alg *alg);
8267 struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type,
8368 u32 mask);
84
-void *crypto_create_tfm(struct crypto_alg *alg,
85
- const struct crypto_type *frontend);
69
+void *crypto_create_tfm_node(struct crypto_alg *alg,
70
+ const struct crypto_type *frontend, int node);
71
+
72
+static inline void *crypto_create_tfm(struct crypto_alg *alg,
73
+ const struct crypto_type *frontend)
74
+{
75
+ return crypto_create_tfm_node(alg, frontend, NUMA_NO_NODE);
76
+}
77
+
8678 struct crypto_alg *crypto_find_alg(const char *alg_name,
8779 const struct crypto_type *frontend,
8880 u32 type, u32 mask);
89
-void *crypto_alloc_tfm(const char *alg_name,
90
- const struct crypto_type *frontend, u32 type, u32 mask);
9181
92
-int crypto_register_notifier(struct notifier_block *nb);
93
-int crypto_unregister_notifier(struct notifier_block *nb);
82
+void *crypto_alloc_tfm_node(const char *alg_name,
83
+ const struct crypto_type *frontend, u32 type, u32 mask,
84
+ int node);
85
+
86
+static inline void *crypto_alloc_tfm(const char *alg_name,
87
+ const struct crypto_type *frontend, u32 type, u32 mask)
88
+{
89
+ return crypto_alloc_tfm_node(alg_name, frontend, type, mask, NUMA_NO_NODE);
90
+}
91
+
9492 int crypto_probing_notify(unsigned long val, void *v);
9593
9694 unsigned int crypto_alg_extsize(struct crypto_alg *alg);
....@@ -140,5 +138,11 @@
140138 blocking_notifier_call_chain(&crypto_chain, val, v);
141139 }
142140
141
+static inline void crypto_yield(u32 flags)
142
+{
143
+ if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
144
+ cond_resched();
145
+}
146
+
143147 #endif /* _CRYPTO_INTERNAL_H */
144148