From: Vakul Garg <va...@freescale.com>

Re-initialize keys_fit_inline to avoid using its stale encrypt() shared
descriptor value prior to building descriptors for the decrypt() and
givencrypt() cases.

Signed-off-by: Vakul Garg <va...@freescale.com>
[reworded commit text, enhanced code readability]
Signed-off-by: Kim Phillips <kim.phill...@freescale.com>
---
 drivers/crypto/caam/caamalg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 5f89125..4bf7634 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -303,6 +303,7 @@ static int aead_null_set_sh_desc(struct crypto_aead *aead)
         * Job Descriptor and Shared Descriptors
         * must all fit into the 64-word Descriptor h/w Buffer
         */
+       keys_fit_inline = false;
        if (DESC_AEAD_NULL_DEC_LEN + DESC_JOB_IO_LEN +
            ctx->split_key_pad_len <= CAAM_DESC_BYTES_MAX)
                keys_fit_inline = true;
@@ -472,6 +473,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
         * Job Descriptor and Shared Descriptors
         * must all fit into the 64-word Descriptor h/w Buffer
         */
+       keys_fit_inline = false;
        if (DESC_AEAD_DEC_LEN + DESC_JOB_IO_LEN +
            ctx->split_key_pad_len + ctx->enckeylen <=
            CAAM_DESC_BYTES_MAX)
@@ -527,6 +529,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead)
         * Job Descriptor and Shared Descriptors
         * must all fit into the 64-word Descriptor h/w Buffer
         */
+       keys_fit_inline = false;
        if (DESC_AEAD_GIVENC_LEN + DESC_JOB_IO_LEN +
            ctx->split_key_pad_len + ctx->enckeylen <=
            CAAM_DESC_BYTES_MAX)
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to