Commit 24cbcc94 authored by Thara Gopinath's avatar Thara Gopinath Committed by Herbert Xu

crypto: qce - Set data unit size to message length for AES XTS transformation

Set the register REG_ENCR_XTS_DU_SIZE to cryptlen for AES XTS
transformation. Anything else causes the engine to return back
wrong results.
Acked-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarThara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 25b71d61
...@@ -295,15 +295,15 @@ static void qce_xtskey(struct qce_device *qce, const u8 *enckey, ...@@ -295,15 +295,15 @@ static void qce_xtskey(struct qce_device *qce, const u8 *enckey,
{ {
u32 xtskey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(u32)] = {0}; u32 xtskey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(u32)] = {0};
unsigned int xtsklen = enckeylen / (2 * sizeof(u32)); unsigned int xtsklen = enckeylen / (2 * sizeof(u32));
unsigned int xtsdusize;
qce_cpu_to_be32p_array((__be32 *)xtskey, enckey + enckeylen / 2, qce_cpu_to_be32p_array((__be32 *)xtskey, enckey + enckeylen / 2,
enckeylen / 2); enckeylen / 2);
qce_write_array(qce, REG_ENCR_XTS_KEY0, xtskey, xtsklen); qce_write_array(qce, REG_ENCR_XTS_KEY0, xtskey, xtsklen);
/* xts du size 512B */ /* Set data unit size to cryptlen. Anything else causes
xtsdusize = min_t(u32, QCE_SECTOR_SIZE, cryptlen); * crypto engine to return back incorrect results.
qce_write(qce, REG_ENCR_XTS_DU_SIZE, xtsdusize); */
qce_write(qce, REG_ENCR_XTS_DU_SIZE, cryptlen);
} }
static int qce_setup_regs_skcipher(struct crypto_async_request *async_req, static int qce_setup_regs_skcipher(struct crypto_async_request *async_req,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment