summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVakul Garg <vakul@freescale.com>2014-04-27 15:48:48 (GMT)
committerJose Rivera <German.Rivera@freescale.com>2014-04-30 12:47:31 (GMT)
commita3b5e706f2032633eaeb2970cefb1b07dbd785e4 (patch)
tree87dbaa2a08a7b2ea61bdf66c307fe96779251c22 /drivers
parentd7dd4f316c573a4594ac8afe44523f7021829986 (diff)
downloadlinux-fsl-qoriq-a3b5e706f2032633eaeb2970cefb1b07dbd785e4.tar.xz
crypto: caam/qi - Fix key inlining in AEAD shared descriptors
The variable 'keys_fit_inline' is initialised correctly to avoid using its stale value while creating shared descriptor for decryption and given-iv-encryption. Signed-off-by: Vakul Garg <vakul@freescale.com> Change-Id: Iac6521a229bbe2932b3052f8be795830cc533e4d Reviewed-on: http://git.am.freescale.net:8181/11566 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Ruchika Gupta <ruchika.gupta@freescale.com> Reviewed-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/caam/caamalg_qi.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c
index 1e9c99f..1e7ce50 100644
--- a/drivers/crypto/caam/caamalg_qi.c
+++ b/drivers/crypto/caam/caamalg_qi.c
@@ -167,7 +167,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
{
struct aead_tfm *tfm = &aead->base.crt_aead;
struct caam_ctx *ctx = crypto_aead_ctx(aead);
- bool keys_fit_inline = false;
+ bool keys_fit_inline;
u32 *key_jump_cmd, *jump_cmd;
u32 geniv, moveiv;
u32 *desc;
@@ -183,6 +183,8 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
ctx->split_key_pad_len + ctx->enckeylen <=
CAAM_DESC_BYTES_MAX)
keys_fit_inline = true;
+ else
+ keys_fit_inline = false;
/* aead_encrypt shared descriptor */
desc = ctx->sh_desc_enc;
@@ -235,6 +237,8 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
ctx->split_key_pad_len + ctx->enckeylen <=
CAAM_DESC_BYTES_MAX)
keys_fit_inline = true;
+ else
+ keys_fit_inline = false;
desc = ctx->sh_desc_dec;
@@ -297,6 +301,8 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
ctx->split_key_pad_len + ctx->enckeylen <=
CAAM_DESC_BYTES_MAX)
keys_fit_inline = true;
+ else
+ keys_fit_inline = false;
/* aead_givencrypt shared descriptor */
desc = ctx->sh_desc_givenc;
@@ -384,7 +390,7 @@ static int tls_set_sh_desc(struct crypto_aead *aead)
{
struct aead_tfm *tfm = &aead->base.crt_aead;
struct caam_ctx *ctx = crypto_aead_ctx(aead);
- bool keys_fit_inline = false;
+ bool keys_fit_inline;
u32 *key_jump_cmd, *zero_payload_jump_cmd, *skip_zero_jump_cmd;
u32 genpad, idx_ld_datasz, idx_ld_pad, jumpback, stidx;
u32 *desc;
@@ -415,6 +421,8 @@ static int tls_set_sh_desc(struct crypto_aead *aead)
idx_ld_pad = DESC_TLS10_ENC_LEN + ctx->split_key_pad_len +
ctx->enckeylen - 2 * CAAM_CMD_SZ;
} else {
+ keys_fit_inline = false;
+
idx_ld_datasz = DESC_TLS10_ENC_LEN + 2 * CAAM_PTR_SZ -
4 * CAAM_CMD_SZ;
idx_ld_pad = DESC_TLS10_ENC_LEN + 2 * CAAM_PTR_SZ -