* [PATCH] crypto: s5p: update iv after AES op end
[not found] <CGME20190218160113eucas1p2183a3620f8322ee33273d3bfe5f06486@eucas1p2.samsung.com>
@ 2019-02-18 16:00 ` Kamil Konieczny
2019-02-19 12:02 ` Krzysztof Kozlowski
0 siblings, 1 reply; 3+ messages in thread
From: Kamil Konieczny @ 2019-02-18 16:00 UTC (permalink / raw)
To: k.konieczny
Cc: Krzysztof Kozlowski, Vladimir Zapolskiy, Herbert Xu,
David S. Miller, Eric Biggers, linux-crypto, linux-samsung-soc,
linux-kernel
Fix bug "s5p-sss crypto driver doesn't set next AES-CBC IV". This should
also fix AES-CTR mode. Tested on Odroid U3 with Eric Biggers branch
"iv-out-testing".
Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
---
drivers/crypto/s5p-sss.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index 0064be0e3941..3ea058addad3 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -463,6 +463,9 @@ static void s5p_sg_copy_buf(void *buf, struct scatterlist *sg,
static void s5p_sg_done(struct s5p_aes_dev *dev)
{
+ struct ablkcipher_request *req = dev->req;
+ struct s5p_aes_reqctx *reqctx = ablkcipher_request_ctx(req);
+
if (dev->sg_dst_cpy) {
dev_dbg(dev->dev,
"Copying %d bytes of output data back to original place\n",
@@ -472,6 +475,11 @@ static void s5p_sg_done(struct s5p_aes_dev *dev)
}
s5p_free_sg_cpy(dev, &dev->sg_src_cpy);
s5p_free_sg_cpy(dev, &dev->sg_dst_cpy);
+ if (reqctx->mode & FLAGS_AES_CBC)
+ memcpy_fromio(req->info, dev->aes_ioaddr + SSS_REG_AES_IV_DATA(0), 0x10);
+
+ if (reqctx->mode & FLAGS_AES_CTR)
+ memcpy_fromio(req->info, dev->aes_ioaddr + SSS_REG_AES_CNT_DATA(0), 0x10);
}
/* Calls the completion. Cannot be called with dev->lock hold. */
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: s5p: update iv after AES op end
2019-02-18 16:00 ` [PATCH] crypto: s5p: update iv after AES op end Kamil Konieczny
@ 2019-02-19 12:02 ` Krzysztof Kozlowski
0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2019-02-19 12:02 UTC (permalink / raw)
To: Kamil Konieczny
Cc: Vladimir Zapolskiy, Herbert Xu, David S. Miller, Eric Biggers,
linux-crypto, linux-samsung-soc, linux-kernel
On Mon, 18 Feb 2019 at 17:01, Kamil Konieczny
<k.konieczny@partner.samsung.com> wrote:
>
> Fix bug "s5p-sss crypto driver doesn't set next AES-CBC IV". This should
> also fix AES-CTR mode. Tested on Odroid U3 with Eric Biggers branch
> "iv-out-testing".
>
> Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
> ---
> drivers/crypto/s5p-sss.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
> index 0064be0e3941..3ea058addad3 100644
> --- a/drivers/crypto/s5p-sss.c
> +++ b/drivers/crypto/s5p-sss.c
> @@ -463,6 +463,9 @@ static void s5p_sg_copy_buf(void *buf, struct scatterlist *sg,
>
> static void s5p_sg_done(struct s5p_aes_dev *dev)
> {
> + struct ablkcipher_request *req = dev->req;
> + struct s5p_aes_reqctx *reqctx = ablkcipher_request_ctx(req);
> +
> if (dev->sg_dst_cpy) {
> dev_dbg(dev->dev,
> "Copying %d bytes of output data back to original place\n",
> @@ -472,6 +475,11 @@ static void s5p_sg_done(struct s5p_aes_dev *dev)
> }
> s5p_free_sg_cpy(dev, &dev->sg_src_cpy);
> s5p_free_sg_cpy(dev, &dev->sg_dst_cpy);
> + if (reqctx->mode & FLAGS_AES_CBC)
> + memcpy_fromio(req->info, dev->aes_ioaddr + SSS_REG_AES_IV_DATA(0), 0x10);
> +
0x10 -> AES_BLOCK_SIZE
> + if (reqctx->mode & FLAGS_AES_CTR)
if -> else if
Beside that looks good.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: s5p: update iv after AES op end
@ 2019-02-19 12:02 ` Krzysztof Kozlowski
0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2019-02-19 12:02 UTC (permalink / raw)
To: Kamil Konieczny
Cc: Vladimir Zapolskiy, Herbert Xu, David S. Miller, Eric Biggers,
linux-crypto, linux-samsung-soc, linux-kernel
On Mon, 18 Feb 2019 at 17:01, Kamil Konieczny
<k.konieczny@partner.samsung.com> wrote:
>
> Fix bug "s5p-sss crypto driver doesn't set next AES-CBC IV". This should
> also fix AES-CTR mode. Tested on Odroid U3 with Eric Biggers branch
> "iv-out-testing".
>
> Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
> ---
> drivers/crypto/s5p-sss.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
> index 0064be0e3941..3ea058addad3 100644
> --- a/drivers/crypto/s5p-sss.c
> +++ b/drivers/crypto/s5p-sss.c
> @@ -463,6 +463,9 @@ static void s5p_sg_copy_buf(void *buf, struct scatterlist *sg,
>
> static void s5p_sg_done(struct s5p_aes_dev *dev)
> {
> + struct ablkcipher_request *req = dev->req;
> + struct s5p_aes_reqctx *reqctx = ablkcipher_request_ctx(req);
> +
> if (dev->sg_dst_cpy) {
> dev_dbg(dev->dev,
> "Copying %d bytes of output data back to original place\n",
> @@ -472,6 +475,11 @@ static void s5p_sg_done(struct s5p_aes_dev *dev)
> }
> s5p_free_sg_cpy(dev, &dev->sg_src_cpy);
> s5p_free_sg_cpy(dev, &dev->sg_dst_cpy);
> + if (reqctx->mode & FLAGS_AES_CBC)
> + memcpy_fromio(req->info, dev->aes_ioaddr + SSS_REG_AES_IV_DATA(0), 0x10);
> +
0x10 -> AES_BLOCK_SIZE
> + if (reqctx->mode & FLAGS_AES_CTR)
if -> else if
Beside that looks good.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-19 12:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20190218160113eucas1p2183a3620f8322ee33273d3bfe5f06486@eucas1p2.samsung.com>
2019-02-18 16:00 ` [PATCH] crypto: s5p: update iv after AES op end Kamil Konieczny
2019-02-19 12:02 ` Krzysztof Kozlowski
2019-02-19 12:02 ` Krzysztof Kozlowski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.