regression 4006: add test cases for SM2 PKE

Adds test cases for SM2 Public Key Encryption.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/host/xtest/regression_4000_data.h b/host/xtest/regression_4000_data.h
index d40a3eb..03f72de 100644
--- a/host/xtest/regression_4000_data.h
+++ b/host/xtest/regression_4000_data.h
@@ -7762,4 +7762,72 @@
 	/* [B-571] - GP NOT SUPPORTED */
 };
 
+/* G/MT 0003 (SM2) Part 5 Annex C.2 - encryption/decryption */
+static const uint8_t gmt_0003_part5_c2_sm2_testvector_ptx[19] =
+/* M */
+	"encryption standard";
+static const uint8_t gmt_0003_part5_c2_sm2_testvector_private[] = {
+/* dB */
+	0x39, 0x45, 0x20, 0x8F, 0x7B, 0x21, 0x44, 0xB1, 0x3F, 0x36, 0xE3, 0x8A,
+	0xC6, 0xD3, 0x9F, 0x95, 0x88, 0x93, 0x93, 0x69, 0x28, 0x60, 0xB5, 0x1A,
+	0x42, 0xFB, 0x81, 0xEF, 0x4D, 0xF7, 0xC5, 0xB8
+};
+static const uint8_t gmt_0003_part5_c2_sm2_testvector_public_x[] = {
+/* xB */
+	0x09, 0xF9, 0xDF, 0x31, 0x1E, 0x54, 0x21, 0xA1, 0x50, 0xDD, 0x7D, 0x16,
+	0x1E, 0x4B, 0xC5, 0xC6, 0x72, 0x17, 0x9F, 0xAD, 0x18, 0x33, 0xFC, 0x07,
+	0x6B, 0xB0, 0x8F, 0xF3, 0x56, 0xF3, 0x50, 0x20
+};
+static const uint8_t gmt_0003_part5_c2_sm2_testvector_public_y[] = {
+/* yB */
+	0xCC, 0xEA, 0x49, 0x0C, 0xE2, 0x67, 0x75, 0xA5, 0x2D, 0xC6, 0xEA, 0x71,
+	0x8C, 0xC1, 0xAA, 0x60, 0x0A, 0xED, 0x05, 0xFB, 0xF3, 0x5E, 0x08, 0x4A,
+	0x66, 0x32, 0xF6, 0x07, 0x2D, 0xA9, 0xAD, 0x13
+};
+static const uint8_t gmt_0003_part5_c2_sm2_testvector_out[] = {
+/* C */
+	/* C1 */
+	0x04,
+	0x04, 0xEB, 0xFC, 0x71, 0x8E, 0x8D, 0x17, 0x98, 0x62, 0x04, 0x32, 0x26,
+	0x8E, 0x77, 0xFE, 0xB6, 0x41, 0x5E, 0x2E, 0xDE, 0x0E, 0x07, 0x3C, 0x0F,
+	0x4F, 0x64, 0x0E, 0xCD, 0x2E, 0x14, 0x9A, 0x73, 0xE8, 0x58, 0xF9, 0xD8,
+	0x1E, 0x54, 0x30, 0xA5, 0x7B, 0x36, 0xDA, 0xAB, 0x8F, 0x95, 0x0A, 0x3C,
+	0x64, 0xE6, 0xEE, 0x6A, 0x63, 0x09, 0x4D, 0x99, 0x28, 0x3A, 0xFF, 0x76,
+	0x7E, 0x12, 0x4D, 0xF0,
+	/* C2 */
+	0x21, 0x88, 0x6C, 0xA9, 0x89, 0xCA, 0x9C, 0x7D, 0x58, 0x08, 0x73, 0x07,
+	0xCA, 0x93, 0x09, 0x2D, 0x65, 0x1E, 0xFA,
+	/* C3 */
+	0x59, 0x98, 0x3C, 0x18, 0xF8, 0x09, 0xE2, 0x62, 0x92, 0x3C, 0x53, 0xAE,
+	0xC2, 0x95, 0xD3, 0x03, 0x83, 0xB5, 0x4E, 0x39, 0xD6, 0x09, 0xD1, 0x60,
+	0xAF, 0xCB, 0x19, 0x08, 0xD0, 0xBD, 0x87, 0x66
+};
+
+/* SM2 encryption/decryption */
+static const uint8_t sm2_testvector2_ptx[] =
+/* M */
+	"This test vector is used to test encryption then decryption. The "
+	"plain text is longer than 64 characters, so it will exercise parts "
+	"of the code that are not used for shorter messages.";
+static const uint8_t sm2_testvector2_private[] = {
+/* dB */
+	0x39, 0x45, 0x20, 0x8F, 0x7B, 0x21, 0x44, 0xB1, 0x3F, 0x36, 0xE3, 0x8A,
+	0xC6, 0xD3, 0x9F, 0x95, 0x88, 0x93, 0x93, 0x69, 0x28, 0x60, 0xB5, 0x1A,
+	0x42, 0xFB, 0x81, 0xEF, 0x4D, 0xF7, 0xC5, 0xB8
+};
+static const uint8_t sm2_testvector2_public_x[] = {
+/* xB */
+	0x09, 0xF9, 0xDF, 0x31, 0x1E, 0x54, 0x21, 0xA1, 0x50, 0xDD, 0x7D, 0x16,
+	0x1E, 0x4B, 0xC5, 0xC6, 0x72, 0x17, 0x9F, 0xAD, 0x18, 0x33, 0xFC, 0x07,
+	0x6B, 0xB0, 0x8F, 0xF3, 0x56, 0xF3, 0x50, 0x20
+};
+static const uint8_t sm2_testvector2_public_y[] = {
+/* yB */
+	0xCC, 0xEA, 0x49, 0x0C, 0xE2, 0x67, 0x75, 0xA5, 0x2D, 0xC6, 0xEA, 0x71,
+	0x8C, 0xC1, 0xAA, 0x60, 0x0A, 0xED, 0x05, 0xFB, 0xF3, 0x5E, 0x08, 0x4A,
+	0x66, 0x32, 0xF6, 0x07, 0x2D, 0xA9, 0xAD, 0x13
+};
+static const uint8_t sm2_testvector2_out[] = {
+	0x00, /* Not used -- test runs in encrypt/decrypt mode */
+};
 #endif /*XTEST_4000_DATA_H*/