aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/caam
diff options
context:
space:
mode:
authorAlex Porosanu <alexandru.porosanu@freescale.com>2013-09-09 11:56:28 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2013-09-13 07:43:53 -0400
commitd5e4e999cda51eaa62e662088579fcce0ac79e92 (patch)
tree0d1d4289a598444ec542797a19a5d214d245652a /drivers/crypto/caam
parentf5b38c5f19b1dafb413c6581cd4a0d84d3b6512f (diff)
crypto: caam - fix RNG state handle instantiation descriptor
The way the DECO runs a descriptor through the direct (debug) interface is different from the JRI interface: the DECO will continue to try and execute the next commands, after the descriptor buffer has ended. This leads to unpredictable results and possibly to locking up of the DECO. This patch adds a halt command at the end of the descriptor to ensure the DECO halts when it reaches the end of the descriptor buffer. Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/caam')
-rw-r--r--drivers/crypto/caam/ctrl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index b010d42a1803..11c7f295857b 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -73,6 +73,8 @@ static void build_instantiation_desc(u32 *desc)
73 /* generate secure keys (non-test) */ 73 /* generate secure keys (non-test) */
74 append_operation(desc, OP_TYPE_CLASS1_ALG | OP_ALG_ALGSEL_RNG | 74 append_operation(desc, OP_TYPE_CLASS1_ALG | OP_ALG_ALGSEL_RNG |
75 OP_ALG_RNG4_SK); 75 OP_ALG_RNG4_SK);
76
77 append_jump(desc, JUMP_CLASS_CLASS1 | JUMP_TYPE_HALT);
76} 78}
77 79
78static int instantiate_rng(struct device *ctrldev) 80static int instantiate_rng(struct device *ctrldev)
@@ -83,7 +85,7 @@ static int instantiate_rng(struct device *ctrldev)
83 u32 *desc; 85 u32 *desc;
84 int i, ret = 0; 86 int i, ret = 0;
85 87
86 desc = kmalloc(CAAM_CMD_SZ * 6, GFP_KERNEL | GFP_DMA); 88 desc = kmalloc(CAAM_CMD_SZ * 7, GFP_KERNEL | GFP_DMA);
87 if (!desc) { 89 if (!desc) {
88 dev_err(ctrldev, "can't allocate RNG init descriptor memory\n"); 90 dev_err(ctrldev, "can't allocate RNG init descriptor memory\n");
89 return -ENOMEM; 91 return -ENOMEM;