Skip to content

Commit

Permalink
crypto: caam - fix RNG state handle instantiation descriptor
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Porosanu authored and Herbert Xu committed Sep 13, 2013
1 parent f5b38c5 commit d5e4e99
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/crypto/caam/ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ static void build_instantiation_desc(u32 *desc)
/* generate secure keys (non-test) */
append_operation(desc, OP_TYPE_CLASS1_ALG | OP_ALG_ALGSEL_RNG |
OP_ALG_RNG4_SK);

append_jump(desc, JUMP_CLASS_CLASS1 | JUMP_TYPE_HALT);
}

static int instantiate_rng(struct device *ctrldev)
Expand All @@ -83,7 +85,7 @@ static int instantiate_rng(struct device *ctrldev)
u32 *desc;
int i, ret = 0;

desc = kmalloc(CAAM_CMD_SZ * 6, GFP_KERNEL | GFP_DMA);
desc = kmalloc(CAAM_CMD_SZ * 7, GFP_KERNEL | GFP_DMA);
if (!desc) {
dev_err(ctrldev, "can't allocate RNG init descriptor memory\n");
return -ENOMEM;
Expand Down

0 comments on commit d5e4e99

Please sign in to comment.