Commit 5f49f18d authored by Lionel Debieve's avatar Lionel Debieve Committed by Herbert Xu

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: default avatarLionel Debieve <lionel.debieve@st.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 29aed438
...@@ -393,6 +393,23 @@ static void stm32_cryp_hw_write_iv(struct stm32_cryp *cryp, u32 *iv) ...@@ -393,6 +393,23 @@ static void stm32_cryp_hw_write_iv(struct stm32_cryp *cryp, u32 *iv)
} }
} }
static void stm32_cryp_get_iv(struct stm32_cryp *cryp)
{
struct ablkcipher_request *req = cryp->req;
u32 *tmp = req->info;
if (!tmp)
return;
*tmp++ = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV0LR));
*tmp++ = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV0RR));
if (is_aes(cryp)) {
*tmp++ = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV1LR));
*tmp++ = cpu_to_be32(stm32_cryp_read(cryp, CRYP_IV1RR));
}
}
static void stm32_cryp_hw_write_key(struct stm32_cryp *c) static void stm32_cryp_hw_write_key(struct stm32_cryp *c)
{ {
unsigned int i; unsigned int i;
...@@ -622,6 +639,9 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err) ...@@ -622,6 +639,9 @@ static void stm32_cryp_finish_req(struct stm32_cryp *cryp, int err)
/* Phase 4 : output tag */ /* Phase 4 : output tag */
err = stm32_cryp_read_auth_tag(cryp); err = stm32_cryp_read_auth_tag(cryp);
if (!err && (!(is_gcm(cryp) || is_ccm(cryp))))
stm32_cryp_get_iv(cryp);
if (cryp->sgs_copied) { if (cryp->sgs_copied) {
void *buf_in, *buf_out; void *buf_in, *buf_out;
int pages, len; int pages, len;
......
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