aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/algapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r--crypto/algapi.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index d2627a3d4ed8..3c079b7f23f6 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/err.h> 13#include <linux/err.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/fips.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/list.h> 18#include <linux/list.h>
@@ -43,12 +44,9 @@ static inline int crypto_set_driver_name(struct crypto_alg *alg)
43 44
44static inline void crypto_check_module_sig(struct module *mod) 45static inline void crypto_check_module_sig(struct module *mod)
45{ 46{
46#ifdef CONFIG_CRYPTO_FIPS 47 if (fips_enabled && mod && !module_sig_ok(mod))
47 if (fips_enabled && mod && !mod->sig_ok)
48 panic("Module %s signature verification failed in FIPS mode\n", 48 panic("Module %s signature verification failed in FIPS mode\n",
49 mod->name); 49 module_name(mod));
50#endif
51 return;
52} 50}
53 51
54static int crypto_check_alg(struct crypto_alg *alg) 52static int crypto_check_alg(struct crypto_alg *alg)
@@ -614,6 +612,22 @@ out:
614} 612}
615EXPORT_SYMBOL_GPL(crypto_init_spawn2); 613EXPORT_SYMBOL_GPL(crypto_init_spawn2);
616 614
615int crypto_grab_spawn(struct crypto_spawn *spawn, const char *name,
616 u32 type, u32 mask)
617{
618 struct crypto_alg *alg;
619 int err;
620
621 alg = crypto_find_alg(name, spawn->frontend, type, mask);
622 if (IS_ERR(alg))
623 return PTR_ERR(alg);
624
625 err = crypto_init_spawn(spawn, alg, spawn->inst, mask);
626 crypto_mod_put(alg);
627 return err;
628}
629EXPORT_SYMBOL_GPL(crypto_grab_spawn);
630
617void crypto_drop_spawn(struct crypto_spawn *spawn) 631void crypto_drop_spawn(struct crypto_spawn *spawn)
618{ 632{
619 if (!spawn->alg) 633 if (!spawn->alg)
@@ -964,6 +978,13 @@ void crypto_xor(u8 *dst, const u8 *src, unsigned int size)
964} 978}
965EXPORT_SYMBOL_GPL(crypto_xor); 979EXPORT_SYMBOL_GPL(crypto_xor);
966 980
981unsigned int crypto_alg_extsize(struct crypto_alg *alg)
982{
983 return alg->cra_ctxsize +
984 (alg->cra_alignmask & ~(crypto_tfm_ctx_alignment() - 1));
985}
986EXPORT_SYMBOL_GPL(crypto_alg_extsize);
987
967static int __init crypto_algapi_init(void) 988static int __init crypto_algapi_init(void)
968{ 989{
969 crypto_init_proc(); 990 crypto_init_proc();