omap-aes: IV not updated after encrypt/decrypt operation
Francis Le Bourse
francis.lebourse at sfr.fr
Fri Jan 19 11:09:00 EST 2018
Hi,
AES_REG_IV() registers should be read back at the end of encryption or
decryption operations and the values returned to the caller.
Add the code and helper to do just that.
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index 49bd56f..744885b 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -97,6 +97,13 @@ static void omap_aes_write_n(struct omap_aes_dev *dd,
u32 offset,
omap_aes_write(dd, offset, *value);
}
+static void omap_aes_read_n(struct omap_aes_dev *dd, u32 offset,
+ u32 *value, int count)
+{
+ for (; count--; value++, offset += 4)
+ *value = omap_aes_read(dd, offset);
+}
+
static int omap_aes_hw_init(struct omap_aes_dev *dd)
{
int err;
@@ -389,6 +396,9 @@ static void omap_aes_finish_req(struct omap_aes_dev
*dd, int err)
pr_debug("err: %d\n", err);
+ if ((dd->flags & (FLAGS_CBC | FLAGS_CTR)) && dd->req->info)
+ omap_aes_read_n(dd, AES_REG_IV(dd, 0), dd->req->info, 4);
+
crypto_finalize_cipher_request(dd->engine, req, err);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/linux-crypto/attachments/20180119/c35e9eb9/attachment.html>
More information about the Linux-crypto
mailing list