linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Baronescu <robert.baronescu@nxp.com>
To: <herbert@gondor.apana.org.au>
Cc: <linux-crypto@vger.kernel.org>, <davem@davemloft.net>,
	Robert Baronescu <robert.baronescu@nxp.com>
Subject: [PATCH 2/2] crypto: tcrypt - fix buffer lengths in test_aead_speed()
Date: Tue, 10 Oct 2017 13:22:00 +0300	[thread overview]
Message-ID: <1507630920-9014-2-git-send-email-robert.baronescu@nxp.com> (raw)
In-Reply-To: <1507630920-9014-1-git-send-email-robert.baronescu@nxp.com>

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 <robert.baronescu@nxp.com>
---
 crypto/tcrypt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index bd9b66c..e339960 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -342,7 +342,7 @@ 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));
@@ -350,7 +350,9 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
 			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)
-- 
1.9.3

  reply	other threads:[~2017-10-10 10:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 10:21 [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed() Robert Baronescu
2017-10-10 10:22 ` Robert Baronescu [this message]
2017-11-03 14:22   ` [PATCH 2/2] crypto: tcrypt - fix buffer lengths in test_aead_speed() Herbert Xu
2017-11-03 12:41 ` [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed() Herbert Xu
2017-11-09 14:37   ` Horia Geantă
2017-11-09 22:21     ` Herbert Xu
2017-11-10  6:37       ` Horia Geantă
2017-11-10  7:43         ` Herbert Xu
2017-11-10  9:17           ` Horia Geantă
2017-11-10 10:41             ` Herbert Xu
2017-11-12 16:26               ` Horia Geantă
2017-11-13 18:27                 ` Tudor Ambarus
2017-11-14 10:41                   ` Horia Geantă
2017-11-14 14:59                   ` [PATCH] crypto: tcrypt - set assoc in sg_init_aead() Tudor Ambarus
2017-11-15  9:11                     ` Horia Geantă
2017-11-29  6:36                     ` Herbert Xu
2017-11-14 10:45                 ` [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed() Herbert Xu
2017-11-13 18:24 ` Tudor Ambarus
2017-11-14 10:02   ` Horia Geantă
2017-11-29  6:28 ` [1/2] " Herbert Xu
2017-11-29  8:57   ` Horia Geantă
2017-11-29 10:23     ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507630920-9014-2-git-send-email-robert.baronescu@nxp.com \
    --to=robert.baronescu@nxp.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).