Skip to content

Commit

Permalink
crypto: tcrypt - fix buffer lengths in test_aead_speed()
Browse files Browse the repository at this point in the history
Fix the way the length of the buffers used for
encryption / decryption are computed.
For e.g. in case of encryption, input buffer does not contain
an authentication tag.

Signed-off-by: Robert Baronescu <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Robert Baronescu authored and herbertx committed Nov 3, 2017
1 parent 5951722 commit 7aacbfc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crypto/tcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,17 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
}

sg_init_aead(sg, xbuf,
*b_size + (enc ? authsize : 0));
*b_size + (enc ? 0 : authsize));

sg_init_aead(sgout, xoutbuf,
*b_size + (enc ? authsize : 0));

sg_set_buf(&sg[0], assoc, aad_size);
sg_set_buf(&sgout[0], assoc, aad_size);

aead_request_set_crypt(req, sg, sgout, *b_size, iv);
aead_request_set_crypt(req, sg, sgout,
*b_size + (enc ? 0 : authsize),
iv);
aead_request_set_ad(req, aad_size);

if (secs)
Expand Down

0 comments on commit 7aacbfc

Please sign in to comment.