diff options
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/amcc/crypto4xx_core.c | 3 | ||||
-rw-r--r-- | drivers/crypto/geode-aes.c | 8 | ||||
-rw-r--r-- | drivers/crypto/hifn_795x.c | 4 | ||||
-rw-r--r-- | drivers/crypto/ixp4xx_crypto.c | 1 | ||||
-rw-r--r-- | drivers/crypto/mv_cesa.c | 1 | ||||
-rw-r--r-- | drivers/crypto/padlock-aes.c | 13 | ||||
-rw-r--r-- | drivers/crypto/padlock-sha.c | 23 | ||||
-rw-r--r-- | drivers/crypto/talitos.c | 3 |
8 files changed, 42 insertions, 14 deletions
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c index 46e899ac924e..6c4c8b7ce3aa 100644 --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/of_platform.h> | 30 | #include <linux/of_platform.h> |
31 | #include <linux/slab.h> | ||
31 | #include <asm/dcr.h> | 32 | #include <asm/dcr.h> |
32 | #include <asm/dcr-regs.h> | 33 | #include <asm/dcr-regs.h> |
33 | #include <asm/cacheflush.h> | 34 | #include <asm/cacheflush.h> |
@@ -1274,7 +1275,7 @@ static int __exit crypto4xx_remove(struct of_device *ofdev) | |||
1274 | return 0; | 1275 | return 0; |
1275 | } | 1276 | } |
1276 | 1277 | ||
1277 | static struct of_device_id crypto4xx_match[] = { | 1278 | static const struct of_device_id crypto4xx_match[] = { |
1278 | { .compatible = "amcc,ppc4xx-crypto",}, | 1279 | { .compatible = "amcc,ppc4xx-crypto",}, |
1279 | { }, | 1280 | { }, |
1280 | }; | 1281 | }; |
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c index 4801162919d9..c7a5a43ba691 100644 --- a/drivers/crypto/geode-aes.c +++ b/drivers/crypto/geode-aes.c | |||
@@ -135,13 +135,13 @@ static int geode_setkey_cip(struct crypto_tfm *tfm, const u8 *key, | |||
135 | /* | 135 | /* |
136 | * The requested key size is not supported by HW, do a fallback | 136 | * The requested key size is not supported by HW, do a fallback |
137 | */ | 137 | */ |
138 | op->fallback.blk->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; | 138 | op->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; |
139 | op->fallback.blk->base.crt_flags |= (tfm->crt_flags & CRYPTO_TFM_REQ_MASK); | 139 | op->fallback.cip->base.crt_flags |= (tfm->crt_flags & CRYPTO_TFM_REQ_MASK); |
140 | 140 | ||
141 | ret = crypto_cipher_setkey(op->fallback.cip, key, len); | 141 | ret = crypto_cipher_setkey(op->fallback.cip, key, len); |
142 | if (ret) { | 142 | if (ret) { |
143 | tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; | 143 | tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; |
144 | tfm->crt_flags |= (op->fallback.blk->base.crt_flags & CRYPTO_TFM_RES_MASK); | 144 | tfm->crt_flags |= (op->fallback.cip->base.crt_flags & CRYPTO_TFM_RES_MASK); |
145 | } | 145 | } |
146 | return ret; | 146 | return ret; |
147 | } | 147 | } |
@@ -263,7 +263,7 @@ static int fallback_init_cip(struct crypto_tfm *tfm) | |||
263 | 263 | ||
264 | if (IS_ERR(op->fallback.cip)) { | 264 | if (IS_ERR(op->fallback.cip)) { |
265 | printk(KERN_ERR "Error allocating fallback algo %s\n", name); | 265 | printk(KERN_ERR "Error allocating fallback algo %s\n", name); |
266 | return PTR_ERR(op->fallback.blk); | 266 | return PTR_ERR(op->fallback.cip); |
267 | } | 267 | } |
268 | 268 | ||
269 | return 0; | 269 | return 0; |
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c index 5f753fc08730..73e8b1713b54 100644 --- a/drivers/crypto/hifn_795x.c +++ b/drivers/crypto/hifn_795x.c | |||
@@ -321,7 +321,7 @@ static atomic_t hifn_dev_number; | |||
321 | #define HIFN_PUBOPLEN_MOD_M 0x0000007f /* modulus length mask */ | 321 | #define HIFN_PUBOPLEN_MOD_M 0x0000007f /* modulus length mask */ |
322 | #define HIFN_PUBOPLEN_MOD_S 0 /* modulus length shift */ | 322 | #define HIFN_PUBOPLEN_MOD_S 0 /* modulus length shift */ |
323 | #define HIFN_PUBOPLEN_EXP_M 0x0003ff80 /* exponent length mask */ | 323 | #define HIFN_PUBOPLEN_EXP_M 0x0003ff80 /* exponent length mask */ |
324 | #define HIFN_PUBOPLEN_EXP_S 7 /* exponent lenght shift */ | 324 | #define HIFN_PUBOPLEN_EXP_S 7 /* exponent length shift */ |
325 | #define HIFN_PUBOPLEN_RED_M 0x003c0000 /* reducend length mask */ | 325 | #define HIFN_PUBOPLEN_RED_M 0x003c0000 /* reducend length mask */ |
326 | #define HIFN_PUBOPLEN_RED_S 18 /* reducend length shift */ | 326 | #define HIFN_PUBOPLEN_RED_S 18 /* reducend length shift */ |
327 | 327 | ||
@@ -863,7 +863,7 @@ static int hifn_init_pubrng(struct hifn_device *dev) | |||
863 | dev->dmareg |= HIFN_DMAIER_PUBDONE; | 863 | dev->dmareg |= HIFN_DMAIER_PUBDONE; |
864 | hifn_write_1(dev, HIFN_1_DMA_IER, dev->dmareg); | 864 | hifn_write_1(dev, HIFN_1_DMA_IER, dev->dmareg); |
865 | 865 | ||
866 | dprintk("Chip %s: Public key engine has been sucessfully " | 866 | dprintk("Chip %s: Public key engine has been successfully " |
867 | "initialised.\n", dev->name); | 867 | "initialised.\n", dev->name); |
868 | } | 868 | } |
869 | 869 | ||
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 6c6656d3b1e2..f17ddf37a1ed 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/rtnetlink.h> | 17 | #include <linux/rtnetlink.h> |
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/gfp.h> | ||
20 | 21 | ||
21 | #include <crypto/ctr.h> | 22 | #include <crypto/ctr.h> |
22 | #include <crypto/des.h> | 23 | #include <crypto/des.h> |
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index b21ef635f352..6f29012bcc43 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/kthread.h> | 14 | #include <linux/kthread.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/scatterlist.h> | 16 | #include <linux/scatterlist.h> |
17 | #include <linux/slab.h> | ||
17 | 18 | ||
18 | #include "mv_cesa.h" | 19 | #include "mv_cesa.h" |
19 | /* | 20 | /* |
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index 84c51e177269..2e992bc8015b 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/percpu.h> | 18 | #include <linux/percpu.h> |
19 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
20 | #include <linux/slab.h> | ||
20 | #include <asm/byteorder.h> | 21 | #include <asm/byteorder.h> |
21 | #include <asm/processor.h> | 22 | #include <asm/processor.h> |
22 | #include <asm/i387.h> | 23 | #include <asm/i387.h> |
@@ -64,7 +65,7 @@ struct aes_ctx { | |||
64 | u32 *D; | 65 | u32 *D; |
65 | }; | 66 | }; |
66 | 67 | ||
67 | static DEFINE_PER_CPU(struct cword *, last_cword); | 68 | static DEFINE_PER_CPU(struct cword *, paes_last_cword); |
68 | 69 | ||
69 | /* Tells whether the ACE is capable to generate | 70 | /* Tells whether the ACE is capable to generate |
70 | the extended key for a given key_len. */ | 71 | the extended key for a given key_len. */ |
@@ -152,9 +153,9 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | |||
152 | 153 | ||
153 | ok: | 154 | ok: |
154 | for_each_online_cpu(cpu) | 155 | for_each_online_cpu(cpu) |
155 | if (&ctx->cword.encrypt == per_cpu(last_cword, cpu) || | 156 | if (&ctx->cword.encrypt == per_cpu(paes_last_cword, cpu) || |
156 | &ctx->cword.decrypt == per_cpu(last_cword, cpu)) | 157 | &ctx->cword.decrypt == per_cpu(paes_last_cword, cpu)) |
157 | per_cpu(last_cword, cpu) = NULL; | 158 | per_cpu(paes_last_cword, cpu) = NULL; |
158 | 159 | ||
159 | return 0; | 160 | return 0; |
160 | } | 161 | } |
@@ -166,7 +167,7 @@ static inline void padlock_reset_key(struct cword *cword) | |||
166 | { | 167 | { |
167 | int cpu = raw_smp_processor_id(); | 168 | int cpu = raw_smp_processor_id(); |
168 | 169 | ||
169 | if (cword != per_cpu(last_cword, cpu)) | 170 | if (cword != per_cpu(paes_last_cword, cpu)) |
170 | #ifndef CONFIG_X86_64 | 171 | #ifndef CONFIG_X86_64 |
171 | asm volatile ("pushfl; popfl"); | 172 | asm volatile ("pushfl; popfl"); |
172 | #else | 173 | #else |
@@ -176,7 +177,7 @@ static inline void padlock_reset_key(struct cword *cword) | |||
176 | 177 | ||
177 | static inline void padlock_store_cword(struct cword *cword) | 178 | static inline void padlock_store_cword(struct cword *cword) |
178 | { | 179 | { |
179 | per_cpu(last_cword, raw_smp_processor_id()) = cword; | 180 | per_cpu(paes_last_cword, raw_smp_processor_id()) = cword; |
180 | } | 181 | } |
181 | 182 | ||
182 | /* | 183 | /* |
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index 0af80577dc7b..d3a27e0119bc 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
@@ -57,6 +57,23 @@ static int padlock_sha_update(struct shash_desc *desc, | |||
57 | return crypto_shash_update(&dctx->fallback, data, length); | 57 | return crypto_shash_update(&dctx->fallback, data, length); |
58 | } | 58 | } |
59 | 59 | ||
60 | static int padlock_sha_export(struct shash_desc *desc, void *out) | ||
61 | { | ||
62 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); | ||
63 | |||
64 | return crypto_shash_export(&dctx->fallback, out); | ||
65 | } | ||
66 | |||
67 | static int padlock_sha_import(struct shash_desc *desc, const void *in) | ||
68 | { | ||
69 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); | ||
70 | struct padlock_sha_ctx *ctx = crypto_shash_ctx(desc->tfm); | ||
71 | |||
72 | dctx->fallback.tfm = ctx->fallback; | ||
73 | dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP; | ||
74 | return crypto_shash_import(&dctx->fallback, in); | ||
75 | } | ||
76 | |||
60 | static inline void padlock_output_block(uint32_t *src, | 77 | static inline void padlock_output_block(uint32_t *src, |
61 | uint32_t *dst, size_t count) | 78 | uint32_t *dst, size_t count) |
62 | { | 79 | { |
@@ -235,7 +252,10 @@ static struct shash_alg sha1_alg = { | |||
235 | .update = padlock_sha_update, | 252 | .update = padlock_sha_update, |
236 | .finup = padlock_sha1_finup, | 253 | .finup = padlock_sha1_finup, |
237 | .final = padlock_sha1_final, | 254 | .final = padlock_sha1_final, |
255 | .export = padlock_sha_export, | ||
256 | .import = padlock_sha_import, | ||
238 | .descsize = sizeof(struct padlock_sha_desc), | 257 | .descsize = sizeof(struct padlock_sha_desc), |
258 | .statesize = sizeof(struct sha1_state), | ||
239 | .base = { | 259 | .base = { |
240 | .cra_name = "sha1", | 260 | .cra_name = "sha1", |
241 | .cra_driver_name = "sha1-padlock", | 261 | .cra_driver_name = "sha1-padlock", |
@@ -256,7 +276,10 @@ static struct shash_alg sha256_alg = { | |||
256 | .update = padlock_sha_update, | 276 | .update = padlock_sha_update, |
257 | .finup = padlock_sha256_finup, | 277 | .finup = padlock_sha256_finup, |
258 | .final = padlock_sha256_final, | 278 | .final = padlock_sha256_final, |
279 | .export = padlock_sha_export, | ||
280 | .import = padlock_sha_import, | ||
259 | .descsize = sizeof(struct padlock_sha_desc), | 281 | .descsize = sizeof(struct padlock_sha_desc), |
282 | .statesize = sizeof(struct sha256_state), | ||
260 | .base = { | 283 | .base = { |
261 | .cra_name = "sha256", | 284 | .cra_name = "sha256", |
262 | .cra_driver_name = "sha256-padlock", | 285 | .cra_driver_name = "sha256-padlock", |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index c47ffe8a73ef..dc558a097311 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/io.h> | 37 | #include <linux/io.h> |
38 | #include <linux/spinlock.h> | 38 | #include <linux/spinlock.h> |
39 | #include <linux/rtnetlink.h> | 39 | #include <linux/rtnetlink.h> |
40 | #include <linux/slab.h> | ||
40 | 41 | ||
41 | #include <crypto/algapi.h> | 42 | #include <crypto/algapi.h> |
42 | #include <crypto/aes.h> | 43 | #include <crypto/aes.h> |
@@ -1958,7 +1959,7 @@ err_out: | |||
1958 | return err; | 1959 | return err; |
1959 | } | 1960 | } |
1960 | 1961 | ||
1961 | static struct of_device_id talitos_match[] = { | 1962 | static const struct of_device_id talitos_match[] = { |
1962 | { | 1963 | { |
1963 | .compatible = "fsl,sec2.0", | 1964 | .compatible = "fsl,sec2.0", |
1964 | }, | 1965 | }, |