Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3592362ybv; Sun, 16 Feb 2020 01:00:34 -0800 (PST) X-Google-Smtp-Source: APXvYqyLk9KaREHZxR+0ZpsmiTw2Gk5gAeAsaj8n01W852c5KVJMvbuF2pVUgNKEm4s8Fe+0UXAa X-Received: by 2002:a9d:4f02:: with SMTP id d2mr7992448otl.368.1581843634396; Sun, 16 Feb 2020 01:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581843634; cv=none; d=google.com; s=arc-20160816; b=LYEGXJ8Oq6EjuPMi3D5+4KRz34x+D9RixlL1DtZF1gTLAt8AGsWB9pismiUFL9guzQ JGcOT6RvSe+EgZDIIVybL/echGwEvZmlCOna66ghpC7Q0N/RziqMxrxe985QWaJ9XCn0 J40yRh8qaQDJW/V6I4gPbYStbe7V1Vh4Av1W9a9VKlxRCP6HALRL+IzmDjIVHX8lwReS n7CcWDPxyoxupidxx7xb3MyiH5AwCsnZm8qV/nrO9G2UeDqN3XiaiV+iv4XGX8rkCH4P D81A30hO5Zuuwqas/iWhjUn3c3EjwQNAZXAiEhCt0nYO83TdWMFwjr2L2OMjnCDNJaTn dNlA== 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=MSQ4l6fJgc7rgOVrYyq9GskC4LORb+9SA3xLUmIWqz4=; b=ZND1gijVTDFc4j5PtdiLplo7F/bterQq8xV4ep2KxJizkyetaUINiC16DywOvxQZw0 QGeRV02A18GL3yhe0haJdD6gz7igssAO0kmcN5zlpWvcRDmOvglg4tkPtk+1M7artFpB lf+Z8vvMWSIhOv4l+nwnhxuoYF3c47CUQenVg8L5Mlxu6PpEA0X6ZOaof7rn74jCwnFv 6T2vNGwmA6qDGd4RfCZpVtf7/jhCgpY59KNmFG92kznq4qV3MHPmjUNmKoMENMvEPKAc qZvToLOKZ3ThTbb4hVJwwse2ZehOY82Ar9wQfFDBp7XeHmUUd/ABkLo7sIvGDx9D8mG9 d8oQ== 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 r22si5309299otn.192.2020.02.16.01.00.16; Sun, 16 Feb 2020 01:00:34 -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 S1726178AbgBPJAC (ORCPT + 99 others); Sun, 16 Feb 2020 04:00:02 -0500 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:58615 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726203AbgBPJAC (ORCPT ); Sun, 16 Feb 2020 04:00:02 -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=e01e07417;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Tq4ZmV._1581843595; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0Tq4ZmV._1581843595) by smtp.aliyun-inc.com(127.0.0.1); Sun, 16 Feb 2020 16:59:55 +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 5/7] crypto: testmgr - Add SM2 test vectors Date: Sun, 16 Feb 2020 16:59:26 +0800 Message-Id: <20200216085928.108838-6-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 Add testmgr tests and vectors for SM2 asymmetric cipher. Signed-off-by: Tianjia Zhang --- crypto/testmgr.c | 7 +++++++ crypto/testmgr.h | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index db9b5ac878e7..ecc6b27c1dd3 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -5050,6 +5050,13 @@ static const struct alg_test_desc alg_test_descs[] = { .suite = { .hash = __VECS(sha512_tv_template) } + }, { + .alg = "sm2", + .test = alg_test_akcipher, + .fips_allowed = 1, + .suite = { + .akcipher = __VECS(sm2_tv_template) + } }, { .alg = "sm3", .test = alg_test_hash, diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 48da646651cb..d46720b07fcf 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -809,6 +809,22 @@ static const struct akcipher_testvec pkcs1pad_rsa_tv_template[] = { } }; +/* + * SM2 test vectors. + */ +static const struct akcipher_testvec sm2_tv_template[] = { + { + .key = + "\xbd\xca\x64\x55\xa5\x5b\x9c\x27\x22\xd0\xf5\x80\xf7\xf3\xc5\x63" + "\x3c\xbf\xce\xe8\x55\x17\xaa\xa5\x7f\x11\x9b\x4b\x25\x56\x9b\x43", + .m = "\x39\xb3\x2c\x59\x82\xc7\xdf\x11\x8a\x64\x2d", + .c = NULL, + .key_len = 32, + .m_size = 11, + .c_size = 0, + } +}; + static const struct kpp_testvec dh_tv_template[] = { { .secret = -- 2.17.1