Commit 5601e014 authored by Tudor-Dan Ambarus's avatar Tudor-Dan Ambarus Committed by Herbert Xu

crypto: tcrypt - set assoc in sg_init_aead()

Results better code readability.
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 6905c461
...@@ -185,7 +185,8 @@ static void testmgr_free_buf(char *buf[XBUFSIZE]) ...@@ -185,7 +185,8 @@ static void testmgr_free_buf(char *buf[XBUFSIZE])
} }
static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE], static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE],
unsigned int buflen) unsigned int buflen, const void *assoc,
unsigned int aad_size)
{ {
int np = (buflen + PAGE_SIZE - 1)/PAGE_SIZE; int np = (buflen + PAGE_SIZE - 1)/PAGE_SIZE;
int k, rem; int k, rem;
...@@ -198,6 +199,9 @@ static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE], ...@@ -198,6 +199,9 @@ static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE],
} }
sg_init_table(sg, np + 1); sg_init_table(sg, np + 1);
sg_set_buf(&sg[0], assoc, aad_size);
if (rem) if (rem)
np--; np--;
for (k = 0; k < np; k++) for (k = 0; k < np; k++)
...@@ -318,14 +322,12 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs, ...@@ -318,14 +322,12 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
goto out; goto out;
} }
sg_init_aead(sg, xbuf, sg_init_aead(sg, xbuf, *b_size + (enc ? 0 : authsize),
*b_size + (enc ? 0 : authsize)); assoc, aad_size);
sg_init_aead(sgout, xoutbuf, sg_init_aead(sgout, xoutbuf,
*b_size + (enc ? authsize : 0)); *b_size + (enc ? authsize : 0), assoc,
aad_size);
sg_set_buf(&sg[0], assoc, aad_size);
sg_set_buf(&sgout[0], assoc, aad_size);
aead_request_set_crypt(req, sg, sgout, aead_request_set_crypt(req, sg, sgout,
*b_size + (enc ? 0 : authsize), *b_size + (enc ? 0 : authsize),
......
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