Commit e8e3c1ca authored by Kamil Konieczny's avatar Kamil Konieczny Committed by Herbert Xu

crypto: s5p - update iv after AES-CBC op end

Fix bug "s5p-sss crypto driver doesn't set next AES-CBC IV". While at this,
fix also AES-CTR mode. Tested on Odroid U3 with Eric Biggers branch
"iv-out-testing".
Signed-off-by: default avatarKamil Konieczny <k.konieczny@partner.samsung.com>
Reported-by: default avatarEric Biggers <ebiggers@kernel.org>
Reviewed-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 7748168c
...@@ -463,6 +463,9 @@ static void s5p_sg_copy_buf(void *buf, struct scatterlist *sg, ...@@ -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) 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) { if (dev->sg_dst_cpy) {
dev_dbg(dev->dev, dev_dbg(dev->dev,
"Copying %d bytes of output data back to original place\n", "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) ...@@ -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_src_cpy);
s5p_free_sg_cpy(dev, &dev->sg_dst_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), AES_BLOCK_SIZE);
else if (reqctx->mode & FLAGS_AES_CTR)
memcpy_fromio(req->info, dev->aes_ioaddr + SSS_REG_AES_CNT_DATA(0), AES_BLOCK_SIZE);
} }
/* Calls the completion. Cannot be called with dev->lock hold. */ /* Calls the completion. Cannot be called with dev->lock hold. */
......
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