Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3594585ybv; Sun, 16 Feb 2020 01:03:07 -0800 (PST) X-Google-Smtp-Source: APXvYqzQha9epsLGdCniDBGMYVFjArM2rnLBIG1N+CQM7jWiY8bAbi9lz9YrgIGYjltXVNbiokYS X-Received: by 2002:a05:6830:2015:: with SMTP id e21mr8084923otp.106.1581843787459; Sun, 16 Feb 2020 01:03:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581843787; cv=none; d=google.com; s=arc-20160816; b=PvEKjB81UX4jQXocvxJoLjWKP0t18OTjC0iuS059Z4hF2qi9Y+1JdPKi0WAIb3GNpj rZ7LeyGKFXoqUchOwJPyO2yCsv4fC9v+8DpO30zuVkSYV42y/5qnRZVQMTmYIF+Q2016 nTz0sUqUSWE5ksnbctuvD3GCI75lthZA96uI4FgSxHlH5AcALdgMZUEyMTsJxuA5s3AZ 3XFKZT9wxBEk5EX3V1OWjHnN8dUwEa8Bv4HrDy5XDkbKUyneVMMdIsPS8PrC8HTiO7uz 59f5bZfFUBl+vS5uEJnM4iAD9r99fUD21D28Mf5QGF7MDo8YF+LDzAtg+vOa9zhk0F67 cqHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=bgN1jCqd/uOP5NCZbEXH026I4qtwK9W8DKwIhjFY7CE=; b=uHpDKyxF3PtSLjaCVbhRIU0I4PWYKx5XluPuNflnsJqWYDP3OQqlV2B3w8Epn00lhp r7jhFj+BdL/5rE97MeMioYgHgGgsKYxANs8mXa4QZKHNeoHembV+niHx0uVj323t8U8k zJJxiyhXAiiTVOGZ56sOfakatsnBMc44JhbrOEhNnGtP05itZ/1/FHGnI8sM3l9Cg8eq v0XgTFHEzmXY7XBCvqwCmqMNKF3nD4o58wl53jbNhxi1B39AW0NETsvxzfggn4c0cbfd sduC8MYvK5LOg9DXZp17wLzFYcVIYcbehnYdtmwd5EL35To+XzQp/EA+NHDNvIW7ItFh HU+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si5345812oic.62.2020.02.16.01.02.55; Sun, 16 Feb 2020 01:03:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726222AbgBPJAM (ORCPT + 99 others); Sun, 16 Feb 2020 04:00:12 -0500 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:33926 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgBPJAL (ORCPT ); Sun, 16 Feb 2020 04:00:11 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Tq4U7hv_1581843593; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0Tq4U7hv_1581843593) by smtp.aliyun-inc.com(127.0.0.1); Sun, 16 Feb 2020 16:59:54 +0800 From: Tianjia Zhang To: herbert@gondor.apana.org.au, davem@davemloft.net, ebiggers@kernel.org, pvanleeuwen@rambus.com, zohar@linux.ibm.com Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] crypto: testmgr - support test with different ciphertext per encryption Date: Sun, 16 Feb 2020 16:59:25 +0800 Message-Id: <20200216085928.108838-5-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200216085928.108838-1-tianjia.zhang@linux.alibaba.com> References: <20200216085928.108838-1-tianjia.zhang@linux.alibaba.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Some asymmetric algorithms will get different ciphertext after each encryption, such as SM2, and let testmgr support the testing of such algorithms. In struct akcipher_testvec, set c and c_size to be empty, skip the comparison of the ciphertext, and compare the decrypted plaintext with m to achieve the test purpose. Signed-off-by: Tianjia Zhang --- crypto/testmgr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 82513b6b0abd..db9b5ac878e7 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -3741,7 +3741,7 @@ static int test_akcipher_one(struct crypto_akcipher *tfm, pr_err("alg: akcipher: %s test failed. err %d\n", op, err); goto free_all; } - if (!vecs->siggen_sigver_test) { + if (!vecs->siggen_sigver_test && c) { if (req->dst_len != c_size) { pr_err("alg: akcipher: %s test failed. Invalid output len\n", op); @@ -3772,6 +3772,11 @@ static int test_akcipher_one(struct crypto_akcipher *tfm, goto free_all; } + if (!vecs->siggen_sigver_test && !c) { + c = outbuf_enc; + c_size = req->dst_len; + } + op = vecs->siggen_sigver_test ? "sign" : "decrypt"; if (WARN_ON(c_size > PAGE_SIZE)) goto free_all; -- 2.17.1