mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Biggers <ebiggers@google.com>,
	Eric Biggers <ebiggers@kernel.org>,
	Gilad Ben-Yossef <gilad@benyossef.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jia Zhang <zhang.jia@linux.alibaba.com>,
	"YiLin . Li" <YiLin.Li@linux.alibaba.com>
Cc: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Subject: [PATCH 1/3] crypto: tcrypt - Fix the wrong position of return value test statement
Date: Thu, 12 Aug 2021 21:17:46 +0800	[thread overview]
Message-ID: <20210812131748.81620-2-tianjia.zhang@linux.alibaba.com> (raw)
In-Reply-To: <20210812131748.81620-1-tianjia.zhang@linux.alibaba.com>

The position of the return value test statement of crypto_aead_setkey()
is wrong, adjust to make it work properly.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 crypto/tcrypt.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index d73a42fdaa9b..73c97e085baf 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -612,6 +612,12 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
 				}
 			}
 			ret = crypto_aead_setkey(tfm, key, *keysize);
+			if (ret) {
+				pr_err("setkey() failed flags=%x\n",
+						crypto_aead_get_flags(tfm));
+				goto out;
+			}
+
 			ret = crypto_aead_setauthsize(tfm, authsize);
 
 			iv_len = crypto_aead_ivsize(tfm);
@@ -622,15 +628,8 @@ static void test_aead_speed(const char *algo, int enc, unsigned int secs,
 			printk(KERN_INFO "test %u (%d bit key, %d byte blocks): ",
 					i, *keysize * 8, bs);
 
-
 			memset(tvmem[0], 0xff, PAGE_SIZE);
 
-			if (ret) {
-				pr_err("setkey() failed flags=%x\n",
-						crypto_aead_get_flags(tfm));
-				goto out;
-			}
-
 			sg_init_aead(sg, xbuf, bs + (enc ? 0 : authsize),
 				     assoc, aad_size);
 
-- 
2.19.1.3.ge56e4f7


  reply	other threads:[~2021-08-12 13:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 13:17 [PATCH 0/3] support test GCM/CCM mode for SM4 Tianjia Zhang
2021-08-12 13:17 ` Tianjia Zhang [this message]
2021-08-12 13:59   ` [PATCH 1/3] crypto: tcrypt - Fix the wrong position of return value test statement Vitaly Chikunov
2021-08-13  7:38     ` Tianjia Zhang
2021-08-12 13:17 ` [PATCH 2/3] crypto: testmgr - Add GCM/CCM mode test of SM4 algorithm Tianjia Zhang
2021-08-12 13:17 ` [PATCH 3/3] crypto: tcrypt: add GCM/CCM mode test for " Tianjia Zhang

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=20210812131748.81620-2-tianjia.zhang@linux.alibaba.com \
    --to=tianjia.zhang@linux.alibaba.com \
    --cc=YiLin.Li@linux.alibaba.com \
    --cc=ardb@kernel.org \
    --cc=davem@davemloft.net \
    --cc=ebiggers@google.com \
    --cc=ebiggers@kernel.org \
    --cc=gilad@benyossef.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhang.jia@linux.alibaba.com \
    /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

all inboxes | Powered by JetHome®