summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/stm32
diff options
context:
space:
mode:
authorLionel Debieve <lionel.debieve@st.com>2019-04-24 09:34:53 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2019-05-03 02:03:29 -0400
commit5f49f18d27cd6d49c52f2805cd79c2362710a2e9 (patch)
tree3e6d8ac9a6b88db4682770a516e08530acb7d9af /drivers/crypto/stm32
parent29aed438e8702096a2dda3c5aed88e9176656be7 (diff)
crypto: stm32/cryp - update to return iv_out
The kernel crypto API request output the next IV data to IV buffer for CBC implementation. Signed-off-by: Lionel Debieve <lionel.debieve@st.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/stm32')
-rw-r--r--drivers/crypto/stm32/stm32-cryp.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c
index eb525669d4eb..cddcc97875b2 100644
--- a/drivers/crypto/stm32/stm32-cryp.c
+++ b/drivers/crypto/stm32/stm32-cryp.c
@@ -393,6 +393,23 @@ static void stm32_cryp_hw_write_iv(struct stm32_cryp *cryp, u32 *iv)
393 } 393 }
394} 394}
395 395
396static void stm32_cryp_get_iv(struct stm32_cryp *cryp)
397{
398 struct ablkcipher_request *req = cryp->req;
399 u32 *tmp = req->info;
400
401 if (!tmp)
402 return;
403
404 *tmp++ = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV0LR));
405 *tmp++ = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV0RR));
406
407 if (is_aes(cryp)) {
408 *tmp++ = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV1LR));
409 *tmp++ = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV1RR));
410 }
411}
412
396static void stm32_cryp_hw_write_key(struct stm32_cryp *c) 413static void stm32_cryp_hw_write_key(struct stm32_cryp *c)
397{ 414{
398 unsigned int i; 415 unsigned int i;
@@ -622,6 +639,9 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err)
622 /* Phase 4 : output tag */ 639 /* Phase 4 : output tag */
623 err = stm32_cryp_read_auth_tag(cryp); 640 err = stm32_cryp_read_auth_tag(cryp);
624 641
642 if (!err && (!(is_gcm(cryp) || is_ccm(cryp))))
643 stm32_cryp_get_iv(cryp);
644
625 if (cryp->sgs_copied) { 645 if (cryp->sgs_copied) {
626 void *buf_in, *buf_out; 646 void *buf_in, *buf_out;
627 int pages, len; 647 int pages, len;