@@ -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,
@@ -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 =
Add testmgr tests and vectors for SM2 asymmetric cipher. Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> --- crypto/testmgr.c | 7 +++++++ crypto/testmgr.h | 16 ++++++++++++++++ 2 files changed, 23 insertions(+)