diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-23 19:18:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-23 19:18:25 -0500 |
commit | 26b265cd29dde56bf0901c421eabc7ae815f38c4 (patch) | |
tree | 83a5418c96ccde8522bda6614063b665fe5e0ec9 /arch | |
parent | 2e7babfa892a55588467ef03b545002e32f31528 (diff) | |
parent | f262f0f5cad0c9eca61d1d383e3b67b57dcbe5ea (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto update from Herbert Xu:
- Made x86 ablk_helper generic for ARM
- Phase out chainiv in favour of eseqiv (affects IPsec)
- Fixed aes-cbc IV corruption on s390
- Added constant-time crypto_memneq which replaces memcmp
- Fixed aes-ctr in omap-aes
- Added OMAP3 ROM RNG support
- Add PRNG support for MSM SoC's
- Add and use Job Ring API in caam
- Misc fixes
[ NOTE! This pull request was sent within the merge window, but Herbert
has some questionable email sending setup that makes him public enemy
#1 as far as gmail is concerned. So most of his emails seem to be
trapped by gmail as spam, resulting in me not seeing them. - Linus ]
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (49 commits)
crypto: s390 - Fix aes-cbc IV corruption
crypto: omap-aes - Fix CTR mode counter length
crypto: omap-sham - Add missing modalias
padata: make the sequence counter an atomic_t
crypto: caam - Modify the interface layers to use JR API's
crypto: caam - Add API's to allocate/free Job Rings
crypto: caam - Add Platform driver for Job Ring
hwrng: msm - Add PRNG support for MSM SoC's
ARM: DT: msm: Add Qualcomm's PRNG driver binding document
crypto: skcipher - Use eseqiv even on UP machines
crypto: talitos - Simplify key parsing
crypto: picoxcell - Simplify and harden key parsing
crypto: ixp4xx - Simplify and harden key parsing
crypto: authencesn - Simplify key parsing
crypto: authenc - Export key parsing helper function
crypto: mv_cesa: remove deprecated IRQF_DISABLED
hwrng: OMAP3 ROM Random Number Generator support
crypto: sha256_ssse3 - also test for BMI2
crypto: mv_cesa - Remove redundant of_match_ptr
crypto: sahara - Remove redundant of_match_ptr
...
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/fuse.c | 10 | ||||
-rw-r--r-- | arch/s390/crypto/aes_s390.c | 19 | ||||
-rw-r--r-- | arch/x86/crypto/Makefile | 3 | ||||
-rw-r--r-- | arch/x86/crypto/ablk_helper.c | 149 | ||||
-rw-r--r-- | arch/x86/crypto/aesni-intel_glue.c | 2 | ||||
-rw-r--r-- | arch/x86/crypto/camellia_aesni_avx2_glue.c | 2 | ||||
-rw-r--r-- | arch/x86/crypto/camellia_aesni_avx_glue.c | 2 | ||||
-rw-r--r-- | arch/x86/crypto/cast5_avx_glue.c | 2 | ||||
-rw-r--r-- | arch/x86/crypto/cast6_avx_glue.c | 2 | ||||
-rw-r--r-- | arch/x86/crypto/serpent_avx2_glue.c | 2 | ||||
-rw-r--r-- | arch/x86/crypto/serpent_avx_glue.c | 2 | ||||
-rw-r--r-- | arch/x86/crypto/serpent_sse2_glue.c | 2 | ||||
-rw-r--r-- | arch/x86/crypto/sha256_ssse3_glue.c | 4 | ||||
-rw-r--r-- | arch/x86/crypto/twofish_avx_glue.c | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/crypto/ablk_helper.h | 31 | ||||
-rw-r--r-- | arch/x86/include/asm/simd.h | 11 |
16 files changed, 36 insertions, 209 deletions
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c index d4639c506622..9a4e910c3796 100644 --- a/arch/arm/mach-tegra/fuse.c +++ b/arch/arm/mach-tegra/fuse.c | |||
@@ -209,13 +209,3 @@ void __init tegra_init_fuse(void) | |||
209 | tegra_sku_id, tegra_cpu_process_id, | 209 | tegra_sku_id, tegra_cpu_process_id, |
210 | tegra_core_process_id); | 210 | tegra_core_process_id); |
211 | } | 211 | } |
212 | |||
213 | unsigned long long tegra_chip_uid(void) | ||
214 | { | ||
215 | unsigned long long lo, hi; | ||
216 | |||
217 | lo = tegra_fuse_readl(FUSE_UID_LOW); | ||
218 | hi = tegra_fuse_readl(FUSE_UID_HIGH); | ||
219 | return (hi << 32ull) | lo; | ||
220 | } | ||
221 | EXPORT_SYMBOL(tegra_chip_uid); | ||
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index 46cae138ece2..4363528dc8fd 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c | |||
@@ -35,7 +35,6 @@ static u8 *ctrblk; | |||
35 | static char keylen_flag; | 35 | static char keylen_flag; |
36 | 36 | ||
37 | struct s390_aes_ctx { | 37 | struct s390_aes_ctx { |
38 | u8 iv[AES_BLOCK_SIZE]; | ||
39 | u8 key[AES_MAX_KEY_SIZE]; | 38 | u8 key[AES_MAX_KEY_SIZE]; |
40 | long enc; | 39 | long enc; |
41 | long dec; | 40 | long dec; |
@@ -441,30 +440,36 @@ static int cbc_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | |||
441 | return aes_set_key(tfm, in_key, key_len); | 440 | return aes_set_key(tfm, in_key, key_len); |
442 | } | 441 | } |
443 | 442 | ||
444 | static int cbc_aes_crypt(struct blkcipher_desc *desc, long func, void *param, | 443 | static int cbc_aes_crypt(struct blkcipher_desc *desc, long func, |
445 | struct blkcipher_walk *walk) | 444 | struct blkcipher_walk *walk) |
446 | { | 445 | { |
446 | struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); | ||
447 | int ret = blkcipher_walk_virt(desc, walk); | 447 | int ret = blkcipher_walk_virt(desc, walk); |
448 | unsigned int nbytes = walk->nbytes; | 448 | unsigned int nbytes = walk->nbytes; |
449 | struct { | ||
450 | u8 iv[AES_BLOCK_SIZE]; | ||
451 | u8 key[AES_MAX_KEY_SIZE]; | ||
452 | } param; | ||
449 | 453 | ||
450 | if (!nbytes) | 454 | if (!nbytes) |
451 | goto out; | 455 | goto out; |
452 | 456 | ||
453 | memcpy(param, walk->iv, AES_BLOCK_SIZE); | 457 | memcpy(param.iv, walk->iv, AES_BLOCK_SIZE); |
458 | memcpy(param.key, sctx->key, sctx->key_len); | ||
454 | do { | 459 | do { |
455 | /* only use complete blocks */ | 460 | /* only use complete blocks */ |
456 | unsigned int n = nbytes & ~(AES_BLOCK_SIZE - 1); | 461 | unsigned int n = nbytes & ~(AES_BLOCK_SIZE - 1); |
457 | u8 *out = walk->dst.virt.addr; | 462 | u8 *out = walk->dst.virt.addr; |
458 | u8 *in = walk->src.virt.addr; | 463 | u8 *in = walk->src.virt.addr; |
459 | 464 | ||
460 | ret = crypt_s390_kmc(func, param, out, in, n); | 465 | ret = crypt_s390_kmc(func, ¶m, out, in, n); |
461 | if (ret < 0 || ret != n) | 466 | if (ret < 0 || ret != n) |
462 | return -EIO; | 467 | return -EIO; |
463 | 468 | ||
464 | nbytes &= AES_BLOCK_SIZE - 1; | 469 | nbytes &= AES_BLOCK_SIZE - 1; |
465 | ret = blkcipher_walk_done(desc, walk, nbytes); | 470 | ret = blkcipher_walk_done(desc, walk, nbytes); |
466 | } while ((nbytes = walk->nbytes)); | 471 | } while ((nbytes = walk->nbytes)); |
467 | memcpy(walk->iv, param, AES_BLOCK_SIZE); | 472 | memcpy(walk->iv, param.iv, AES_BLOCK_SIZE); |
468 | 473 | ||
469 | out: | 474 | out: |
470 | return ret; | 475 | return ret; |
@@ -481,7 +486,7 @@ static int cbc_aes_encrypt(struct blkcipher_desc *desc, | |||
481 | return fallback_blk_enc(desc, dst, src, nbytes); | 486 | return fallback_blk_enc(desc, dst, src, nbytes); |
482 | 487 | ||
483 | blkcipher_walk_init(&walk, dst, src, nbytes); | 488 | blkcipher_walk_init(&walk, dst, src, nbytes); |
484 | return cbc_aes_crypt(desc, sctx->enc, sctx->iv, &walk); | 489 | return cbc_aes_crypt(desc, sctx->enc, &walk); |
485 | } | 490 | } |
486 | 491 | ||
487 | static int cbc_aes_decrypt(struct blkcipher_desc *desc, | 492 | static int cbc_aes_decrypt(struct blkcipher_desc *desc, |
@@ -495,7 +500,7 @@ static int cbc_aes_decrypt(struct blkcipher_desc *desc, | |||
495 | return fallback_blk_dec(desc, dst, src, nbytes); | 500 | return fallback_blk_dec(desc, dst, src, nbytes); |
496 | 501 | ||
497 | blkcipher_walk_init(&walk, dst, src, nbytes); | 502 | blkcipher_walk_init(&walk, dst, src, nbytes); |
498 | return cbc_aes_crypt(desc, sctx->dec, sctx->iv, &walk); | 503 | return cbc_aes_crypt(desc, sctx->dec, &walk); |
499 | } | 504 | } |
500 | 505 | ||
501 | static struct crypto_alg cbc_aes_alg = { | 506 | static struct crypto_alg cbc_aes_alg = { |
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile index 7d6ba9db1be9..e0fc24db234a 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile | |||
@@ -3,8 +3,9 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | avx_supported := $(call as-instr,vpxor %xmm0$(comma)%xmm0$(comma)%xmm0,yes,no) | 5 | avx_supported := $(call as-instr,vpxor %xmm0$(comma)%xmm0$(comma)%xmm0,yes,no) |
6 | avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\ | ||
7 | $(comma)4)$(comma)%ymm2,yes,no) | ||
6 | 8 | ||
7 | obj-$(CONFIG_CRYPTO_ABLK_HELPER_X86) += ablk_helper.o | ||
8 | obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o | 9 | obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o |
9 | 10 | ||
10 | obj-$(CONFIG_CRYPTO_AES_586) += aes-i586.o | 11 | obj-$(CONFIG_CRYPTO_AES_586) += aes-i586.o |
diff --git a/arch/x86/crypto/ablk_helper.c b/arch/x86/crypto/ablk_helper.c deleted file mode 100644 index 43282fe04a8b..000000000000 --- a/arch/x86/crypto/ablk_helper.c +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
1 | /* | ||
2 | * Shared async block cipher helpers | ||
3 | * | ||
4 | * Copyright (c) 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | ||
5 | * | ||
6 | * Based on aesni-intel_glue.c by: | ||
7 | * Copyright (C) 2008, Intel Corp. | ||
8 | * Author: Huang Ying <ying.huang@intel.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
23 | * USA | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/crypto.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <crypto/algapi.h> | ||
32 | #include <crypto/cryptd.h> | ||
33 | #include <asm/i387.h> | ||
34 | #include <asm/crypto/ablk_helper.h> | ||
35 | |||
36 | int ablk_set_key(struct crypto_ablkcipher *tfm, const u8 *key, | ||
37 | unsigned int key_len) | ||
38 | { | ||
39 | struct async_helper_ctx *ctx = crypto_ablkcipher_ctx(tfm); | ||
40 | struct crypto_ablkcipher *child = &ctx->cryptd_tfm->base; | ||
41 | int err; | ||
42 | |||
43 | crypto_ablkcipher_clear_flags(child, CRYPTO_TFM_REQ_MASK); | ||
44 | crypto_ablkcipher_set_flags(child, crypto_ablkcipher_get_flags(tfm) | ||
45 | & CRYPTO_TFM_REQ_MASK); | ||
46 | err = crypto_ablkcipher_setkey(child, key, key_len); | ||
47 | crypto_ablkcipher_set_flags(tfm, crypto_ablkcipher_get_flags(child) | ||
48 | & CRYPTO_TFM_RES_MASK); | ||
49 | return err; | ||
50 | } | ||
51 | EXPORT_SYMBOL_GPL(ablk_set_key); | ||
52 | |||
53 | int __ablk_encrypt(struct ablkcipher_request *req) | ||
54 | { | ||
55 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); | ||
56 | struct async_helper_ctx *ctx = crypto_ablkcipher_ctx(tfm); | ||
57 | struct blkcipher_desc desc; | ||
58 | |||
59 | desc.tfm = cryptd_ablkcipher_child(ctx->cryptd_tfm); | ||
60 | desc.info = req->info; | ||
61 | desc.flags = 0; | ||
62 | |||
63 | return crypto_blkcipher_crt(desc.tfm)->encrypt( | ||
64 | &desc, req->dst, req->src, req->nbytes); | ||
65 | } | ||
66 | EXPORT_SYMBOL_GPL(__ablk_encrypt); | ||
67 | |||
68 | int ablk_encrypt(struct ablkcipher_request *req) | ||
69 | { | ||
70 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); | ||
71 | struct async_helper_ctx *ctx = crypto_ablkcipher_ctx(tfm); | ||
72 | |||
73 | if (!irq_fpu_usable()) { | ||
74 | struct ablkcipher_request *cryptd_req = | ||
75 | ablkcipher_request_ctx(req); | ||
76 | |||
77 | memcpy(cryptd_req, req, sizeof(*req)); | ||
78 | ablkcipher_request_set_tfm(cryptd_req, &ctx->cryptd_tfm->base); | ||
79 | |||
80 | return crypto_ablkcipher_encrypt(cryptd_req); | ||
81 | } else { | ||
82 | return __ablk_encrypt(req); | ||
83 | } | ||
84 | } | ||
85 | EXPORT_SYMBOL_GPL(ablk_encrypt); | ||
86 | |||
87 | int ablk_decrypt(struct ablkcipher_request *req) | ||
88 | { | ||
89 | struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); | ||
90 | struct async_helper_ctx *ctx = crypto_ablkcipher_ctx(tfm); | ||
91 | |||
92 | if (!irq_fpu_usable()) { | ||
93 | struct ablkcipher_request *cryptd_req = | ||
94 | ablkcipher_request_ctx(req); | ||
95 | |||
96 | memcpy(cryptd_req, req, sizeof(*req)); | ||
97 | ablkcipher_request_set_tfm(cryptd_req, &ctx->cryptd_tfm->base); | ||
98 | |||
99 | return crypto_ablkcipher_decrypt(cryptd_req); | ||
100 | } else { | ||
101 | struct blkcipher_desc desc; | ||
102 | |||
103 | desc.tfm = cryptd_ablkcipher_child(ctx->cryptd_tfm); | ||
104 | desc.info = req->info; | ||
105 | desc.flags = 0; | ||
106 | |||
107 | return crypto_blkcipher_crt(desc.tfm)->decrypt( | ||
108 | &desc, req->dst, req->src, req->nbytes); | ||
109 | } | ||
110 | } | ||
111 | EXPORT_SYMBOL_GPL(ablk_decrypt); | ||
112 | |||
113 | void ablk_exit(struct crypto_tfm *tfm) | ||
114 | { | ||
115 | struct async_helper_ctx *ctx = crypto_tfm_ctx(tfm); | ||
116 | |||
117 | cryptd_free_ablkcipher(ctx->cryptd_tfm); | ||
118 | } | ||
119 | EXPORT_SYMBOL_GPL(ablk_exit); | ||
120 | |||
121 | int ablk_init_common(struct crypto_tfm *tfm, const char *drv_name) | ||
122 | { | ||
123 | struct async_helper_ctx *ctx = crypto_tfm_ctx(tfm); | ||
124 | struct cryptd_ablkcipher *cryptd_tfm; | ||
125 | |||
126 | cryptd_tfm = cryptd_alloc_ablkcipher(drv_name, 0, 0); | ||
127 | if (IS_ERR(cryptd_tfm)) | ||
128 | return PTR_ERR(cryptd_tfm); | ||
129 | |||
130 | ctx->cryptd_tfm = cryptd_tfm; | ||
131 | tfm->crt_ablkcipher.reqsize = sizeof(struct ablkcipher_request) + | ||
132 | crypto_ablkcipher_reqsize(&cryptd_tfm->base); | ||
133 | |||
134 | return 0; | ||
135 | } | ||
136 | EXPORT_SYMBOL_GPL(ablk_init_common); | ||
137 | |||
138 | int ablk_init(struct crypto_tfm *tfm) | ||
139 | { | ||
140 | char drv_name[CRYPTO_MAX_ALG_NAME]; | ||
141 | |||
142 | snprintf(drv_name, sizeof(drv_name), "__driver-%s", | ||
143 | crypto_tfm_alg_driver_name(tfm)); | ||
144 | |||
145 | return ablk_init_common(tfm, drv_name); | ||
146 | } | ||
147 | EXPORT_SYMBOL_GPL(ablk_init); | ||
148 | |||
149 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c index f80e668785c0..835488b745ee 100644 --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <asm/cpu_device_id.h> | 34 | #include <asm/cpu_device_id.h> |
35 | #include <asm/i387.h> | 35 | #include <asm/i387.h> |
36 | #include <asm/crypto/aes.h> | 36 | #include <asm/crypto/aes.h> |
37 | #include <asm/crypto/ablk_helper.h> | 37 | #include <crypto/ablk_helper.h> |
38 | #include <crypto/scatterwalk.h> | 38 | #include <crypto/scatterwalk.h> |
39 | #include <crypto/internal/aead.h> | 39 | #include <crypto/internal/aead.h> |
40 | #include <linux/workqueue.h> | 40 | #include <linux/workqueue.h> |
diff --git a/arch/x86/crypto/camellia_aesni_avx2_glue.c b/arch/x86/crypto/camellia_aesni_avx2_glue.c index 414fe5d7946b..4209a76fcdaa 100644 --- a/arch/x86/crypto/camellia_aesni_avx2_glue.c +++ b/arch/x86/crypto/camellia_aesni_avx2_glue.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/crypto.h> | 15 | #include <linux/crypto.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <crypto/ablk_helper.h> | ||
17 | #include <crypto/algapi.h> | 18 | #include <crypto/algapi.h> |
18 | #include <crypto/ctr.h> | 19 | #include <crypto/ctr.h> |
19 | #include <crypto/lrw.h> | 20 | #include <crypto/lrw.h> |
@@ -21,7 +22,6 @@ | |||
21 | #include <asm/xcr.h> | 22 | #include <asm/xcr.h> |
22 | #include <asm/xsave.h> | 23 | #include <asm/xsave.h> |
23 | #include <asm/crypto/camellia.h> | 24 | #include <asm/crypto/camellia.h> |
24 | #include <asm/crypto/ablk_helper.h> | ||
25 | #include <asm/crypto/glue_helper.h> | 25 | #include <asm/crypto/glue_helper.h> |
26 | 26 | ||
27 | #define CAMELLIA_AESNI_PARALLEL_BLOCKS 16 | 27 | #define CAMELLIA_AESNI_PARALLEL_BLOCKS 16 |
diff --git a/arch/x86/crypto/camellia_aesni_avx_glue.c b/arch/x86/crypto/camellia_aesni_avx_glue.c index 37fd0c0a81ea..87a041a10f4a 100644 --- a/arch/x86/crypto/camellia_aesni_avx_glue.c +++ b/arch/x86/crypto/camellia_aesni_avx_glue.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/crypto.h> | 15 | #include <linux/crypto.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <crypto/ablk_helper.h> | ||
17 | #include <crypto/algapi.h> | 18 | #include <crypto/algapi.h> |
18 | #include <crypto/ctr.h> | 19 | #include <crypto/ctr.h> |
19 | #include <crypto/lrw.h> | 20 | #include <crypto/lrw.h> |
@@ -21,7 +22,6 @@ | |||
21 | #include <asm/xcr.h> | 22 | #include <asm/xcr.h> |
22 | #include <asm/xsave.h> | 23 | #include <asm/xsave.h> |
23 | #include <asm/crypto/camellia.h> | 24 | #include <asm/crypto/camellia.h> |
24 | #include <asm/crypto/ablk_helper.h> | ||
25 | #include <asm/crypto/glue_helper.h> | 25 | #include <asm/crypto/glue_helper.h> |
26 | 26 | ||
27 | #define CAMELLIA_AESNI_PARALLEL_BLOCKS 16 | 27 | #define CAMELLIA_AESNI_PARALLEL_BLOCKS 16 |
diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c index c6631813dc11..e6a3700489b9 100644 --- a/arch/x86/crypto/cast5_avx_glue.c +++ b/arch/x86/crypto/cast5_avx_glue.c | |||
@@ -26,13 +26,13 @@ | |||
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/crypto.h> | 27 | #include <linux/crypto.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <crypto/ablk_helper.h> | ||
29 | #include <crypto/algapi.h> | 30 | #include <crypto/algapi.h> |
30 | #include <crypto/cast5.h> | 31 | #include <crypto/cast5.h> |
31 | #include <crypto/cryptd.h> | 32 | #include <crypto/cryptd.h> |
32 | #include <crypto/ctr.h> | 33 | #include <crypto/ctr.h> |
33 | #include <asm/xcr.h> | 34 | #include <asm/xcr.h> |
34 | #include <asm/xsave.h> | 35 | #include <asm/xsave.h> |
35 | #include <asm/crypto/ablk_helper.h> | ||
36 | #include <asm/crypto/glue_helper.h> | 36 | #include <asm/crypto/glue_helper.h> |
37 | 37 | ||
38 | #define CAST5_PARALLEL_BLOCKS 16 | 38 | #define CAST5_PARALLEL_BLOCKS 16 |
diff --git a/arch/x86/crypto/cast6_avx_glue.c b/arch/x86/crypto/cast6_avx_glue.c index 8d0dfb86a559..09f3677393e4 100644 --- a/arch/x86/crypto/cast6_avx_glue.c +++ b/arch/x86/crypto/cast6_avx_glue.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/crypto.h> | 29 | #include <linux/crypto.h> |
30 | #include <linux/err.h> | 30 | #include <linux/err.h> |
31 | #include <crypto/ablk_helper.h> | ||
31 | #include <crypto/algapi.h> | 32 | #include <crypto/algapi.h> |
32 | #include <crypto/cast6.h> | 33 | #include <crypto/cast6.h> |
33 | #include <crypto/cryptd.h> | 34 | #include <crypto/cryptd.h> |
@@ -37,7 +38,6 @@ | |||
37 | #include <crypto/xts.h> | 38 | #include <crypto/xts.h> |
38 | #include <asm/xcr.h> | 39 | #include <asm/xcr.h> |
39 | #include <asm/xsave.h> | 40 | #include <asm/xsave.h> |
40 | #include <asm/crypto/ablk_helper.h> | ||
41 | #include <asm/crypto/glue_helper.h> | 41 | #include <asm/crypto/glue_helper.h> |
42 | 42 | ||
43 | #define CAST6_PARALLEL_BLOCKS 8 | 43 | #define CAST6_PARALLEL_BLOCKS 8 |
diff --git a/arch/x86/crypto/serpent_avx2_glue.c b/arch/x86/crypto/serpent_avx2_glue.c index 23aabc6c20a5..2fae489b1524 100644 --- a/arch/x86/crypto/serpent_avx2_glue.c +++ b/arch/x86/crypto/serpent_avx2_glue.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/crypto.h> | 15 | #include <linux/crypto.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <crypto/ablk_helper.h> | ||
17 | #include <crypto/algapi.h> | 18 | #include <crypto/algapi.h> |
18 | #include <crypto/ctr.h> | 19 | #include <crypto/ctr.h> |
19 | #include <crypto/lrw.h> | 20 | #include <crypto/lrw.h> |
@@ -22,7 +23,6 @@ | |||
22 | #include <asm/xcr.h> | 23 | #include <asm/xcr.h> |
23 | #include <asm/xsave.h> | 24 | #include <asm/xsave.h> |
24 | #include <asm/crypto/serpent-avx.h> | 25 | #include <asm/crypto/serpent-avx.h> |
25 | #include <asm/crypto/ablk_helper.h> | ||
26 | #include <asm/crypto/glue_helper.h> | 26 | #include <asm/crypto/glue_helper.h> |
27 | 27 | ||
28 | #define SERPENT_AVX2_PARALLEL_BLOCKS 16 | 28 | #define SERPENT_AVX2_PARALLEL_BLOCKS 16 |
diff --git a/arch/x86/crypto/serpent_avx_glue.c b/arch/x86/crypto/serpent_avx_glue.c index 9ae83cf8d21e..ff4870870972 100644 --- a/arch/x86/crypto/serpent_avx_glue.c +++ b/arch/x86/crypto/serpent_avx_glue.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/crypto.h> | 29 | #include <linux/crypto.h> |
30 | #include <linux/err.h> | 30 | #include <linux/err.h> |
31 | #include <crypto/ablk_helper.h> | ||
31 | #include <crypto/algapi.h> | 32 | #include <crypto/algapi.h> |
32 | #include <crypto/serpent.h> | 33 | #include <crypto/serpent.h> |
33 | #include <crypto/cryptd.h> | 34 | #include <crypto/cryptd.h> |
@@ -38,7 +39,6 @@ | |||
38 | #include <asm/xcr.h> | 39 | #include <asm/xcr.h> |
39 | #include <asm/xsave.h> | 40 | #include <asm/xsave.h> |
40 | #include <asm/crypto/serpent-avx.h> | 41 | #include <asm/crypto/serpent-avx.h> |
41 | #include <asm/crypto/ablk_helper.h> | ||
42 | #include <asm/crypto/glue_helper.h> | 42 | #include <asm/crypto/glue_helper.h> |
43 | 43 | ||
44 | /* 8-way parallel cipher functions */ | 44 | /* 8-way parallel cipher functions */ |
diff --git a/arch/x86/crypto/serpent_sse2_glue.c b/arch/x86/crypto/serpent_sse2_glue.c index 97a356ece24d..8c95f8637306 100644 --- a/arch/x86/crypto/serpent_sse2_glue.c +++ b/arch/x86/crypto/serpent_sse2_glue.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/crypto.h> | 35 | #include <linux/crypto.h> |
36 | #include <linux/err.h> | 36 | #include <linux/err.h> |
37 | #include <crypto/ablk_helper.h> | ||
37 | #include <crypto/algapi.h> | 38 | #include <crypto/algapi.h> |
38 | #include <crypto/serpent.h> | 39 | #include <crypto/serpent.h> |
39 | #include <crypto/cryptd.h> | 40 | #include <crypto/cryptd.h> |
@@ -42,7 +43,6 @@ | |||
42 | #include <crypto/lrw.h> | 43 | #include <crypto/lrw.h> |
43 | #include <crypto/xts.h> | 44 | #include <crypto/xts.h> |
44 | #include <asm/crypto/serpent-sse2.h> | 45 | #include <asm/crypto/serpent-sse2.h> |
45 | #include <asm/crypto/ablk_helper.h> | ||
46 | #include <asm/crypto/glue_helper.h> | 46 | #include <asm/crypto/glue_helper.h> |
47 | 47 | ||
48 | static void serpent_decrypt_cbc_xway(void *ctx, u128 *dst, const u128 *src) | 48 | static void serpent_decrypt_cbc_xway(void *ctx, u128 *dst, const u128 *src) |
diff --git a/arch/x86/crypto/sha256_ssse3_glue.c b/arch/x86/crypto/sha256_ssse3_glue.c index 50226c4b86ed..f248546da1ca 100644 --- a/arch/x86/crypto/sha256_ssse3_glue.c +++ b/arch/x86/crypto/sha256_ssse3_glue.c | |||
@@ -281,7 +281,7 @@ static int __init sha256_ssse3_mod_init(void) | |||
281 | /* allow AVX to override SSSE3, it's a little faster */ | 281 | /* allow AVX to override SSSE3, it's a little faster */ |
282 | if (avx_usable()) { | 282 | if (avx_usable()) { |
283 | #ifdef CONFIG_AS_AVX2 | 283 | #ifdef CONFIG_AS_AVX2 |
284 | if (boot_cpu_has(X86_FEATURE_AVX2)) | 284 | if (boot_cpu_has(X86_FEATURE_AVX2) && boot_cpu_has(X86_FEATURE_BMI2)) |
285 | sha256_transform_asm = sha256_transform_rorx; | 285 | sha256_transform_asm = sha256_transform_rorx; |
286 | else | 286 | else |
287 | #endif | 287 | #endif |
@@ -319,4 +319,4 @@ MODULE_LICENSE("GPL"); | |||
319 | MODULE_DESCRIPTION("SHA256 Secure Hash Algorithm, Supplemental SSE3 accelerated"); | 319 | MODULE_DESCRIPTION("SHA256 Secure Hash Algorithm, Supplemental SSE3 accelerated"); |
320 | 320 | ||
321 | MODULE_ALIAS("sha256"); | 321 | MODULE_ALIAS("sha256"); |
322 | MODULE_ALIAS("sha384"); | 322 | MODULE_ALIAS("sha224"); |
diff --git a/arch/x86/crypto/twofish_avx_glue.c b/arch/x86/crypto/twofish_avx_glue.c index a62ba541884e..4e3c665be129 100644 --- a/arch/x86/crypto/twofish_avx_glue.c +++ b/arch/x86/crypto/twofish_avx_glue.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/crypto.h> | 29 | #include <linux/crypto.h> |
30 | #include <linux/err.h> | 30 | #include <linux/err.h> |
31 | #include <crypto/ablk_helper.h> | ||
31 | #include <crypto/algapi.h> | 32 | #include <crypto/algapi.h> |
32 | #include <crypto/twofish.h> | 33 | #include <crypto/twofish.h> |
33 | #include <crypto/cryptd.h> | 34 | #include <crypto/cryptd.h> |
@@ -39,7 +40,6 @@ | |||
39 | #include <asm/xcr.h> | 40 | #include <asm/xcr.h> |
40 | #include <asm/xsave.h> | 41 | #include <asm/xsave.h> |
41 | #include <asm/crypto/twofish.h> | 42 | #include <asm/crypto/twofish.h> |
42 | #include <asm/crypto/ablk_helper.h> | ||
43 | #include <asm/crypto/glue_helper.h> | 43 | #include <asm/crypto/glue_helper.h> |
44 | #include <crypto/scatterwalk.h> | 44 | #include <crypto/scatterwalk.h> |
45 | #include <linux/workqueue.h> | 45 | #include <linux/workqueue.h> |
diff --git a/arch/x86/include/asm/crypto/ablk_helper.h b/arch/x86/include/asm/crypto/ablk_helper.h deleted file mode 100644 index 4f93df50c23e..000000000000 --- a/arch/x86/include/asm/crypto/ablk_helper.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
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 */ | ||
diff --git a/arch/x86/include/asm/simd.h b/arch/x86/include/asm/simd.h new file mode 100644 index 000000000000..ee80b92f0096 --- /dev/null +++ b/arch/x86/include/asm/simd.h | |||
@@ -0,0 +1,11 @@ | |||
1 | |||
2 | #include <asm/i387.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 | static __must_check inline bool may_use_simd(void) | ||
9 | { | ||
10 | return irq_fpu_usable(); | ||
11 | } | ||