Add more SM4 test vectors

SM4 pass openssl and other known test vectors. SM4-GCM and SM4-XTS only support the GB/T GF(2^128) encoding standard.
This commit is contained in:
Zhi Guan
2024-04-21 10:10:46 +08:00
parent a485fa0b10
commit 252c9e1765
16 changed files with 1267 additions and 691 deletions

View File

@@ -47,7 +47,7 @@ static int test_sm4_ecb(void)
return 1;
}
static int test_sm4_ecb_testvec(void)
static int test_sm4_ecb_test_vectors(void)
{
SM4_KEY sm4_key;
uint8_t key[16] = {
@@ -180,11 +180,10 @@ static int test_sm4_ecb_ctx(void)
return 1;
}
int main(void)
{
if (test_sm4_ecb() != 1) goto err;
if (test_sm4_ecb_testvec() != 1) goto err;
if (test_sm4_ecb_test_vectors() != 1) goto err;
if (test_sm4_ecb_ctx() != 1) goto err;
printf("%s all tests passed\n", __FILE__);
return 0;