diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2013-09-20 03:55:40 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-09-23 16:02:24 -0400 |
commit | a62b01cd6cc1feb5e80d64d6937c291473ed82cb (patch) | |
tree | dd995ccdf562851b9d947c2ccb18afd6427f9c8e /include | |
parent | 714b33d15130cbb5ab426456d4e3de842d6c5b8a (diff) |
crypto: create generic version of ablk_helper
Create a generic version of ablk_helper so it can be reused
by other architectures.
Acked-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/simd.h | 14 | ||||
-rw-r--r-- | include/crypto/ablk_helper.h | 31 |
2 files changed, 45 insertions, 0 deletions
diff --git a/include/asm-generic/simd.h b/include/asm-generic/simd.h new file mode 100644 index 000000000000..f57eb7b5c23b --- /dev/null +++ b/include/asm-generic/simd.h | |||
@@ -0,0 +1,14 @@ | |||
1 | |||
2 | #include <linux/hardirq.h> | ||
3 | |||
4 | /* | ||
5 | * may_use_simd - whether it is allowable at this time to issue SIMD | ||
6 | * instructions or access the SIMD register file | ||
7 | * | ||
8 | * As architectures typically don't preserve the SIMD register file when | ||
9 | * taking an interrupt, !in_interrupt() should be a reasonable default. | ||
10 | */ | ||
11 | static __must_check inline bool may_use_simd(void) | ||
12 | { | ||
13 | return !in_interrupt(); | ||
14 | } | ||
diff --git a/include/crypto/ablk_helper.h b/include/crypto/ablk_helper.h new file mode 100644 index 000000000000..4f93df50c23e --- /dev/null +++ b/include/crypto/ablk_helper.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * Shared async block cipher helpers | ||
3 | */ | ||
4 | |||
5 | #ifndef _CRYPTO_ABLK_HELPER_H | ||
6 | #define _CRYPTO_ABLK_HELPER_H | ||
7 | |||
8 | #include <linux/crypto.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <crypto/cryptd.h> | ||
11 | |||
12 | struct async_helper_ctx { | ||
13 | struct cryptd_ablkcipher *cryptd_tfm; | ||
14 | }; | ||
15 | |||
16 | extern int ablk_set_key(struct crypto_ablkcipher *tfm, const u8 *key, | ||
17 | unsigned int key_len); | ||
18 | |||
19 | extern int __ablk_encrypt(struct ablkcipher_request *req); | ||
20 | |||
21 | extern int ablk_encrypt(struct ablkcipher_request *req); | ||
22 | |||
23 | extern int ablk_decrypt(struct ablkcipher_request *req); | ||
24 | |||
25 | extern void ablk_exit(struct crypto_tfm *tfm); | ||
26 | |||
27 | extern int ablk_init_common(struct crypto_tfm *tfm, const char *drv_name); | ||
28 | |||
29 | extern int ablk_init(struct crypto_tfm *tfm); | ||
30 | |||
31 | #endif /* _CRYPTO_ABLK_HELPER_H */ | ||