diff options
author | Xu Yizhou <xuyizhou1@huawei.com> | 2022-11-25 13:54:07 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-11-29 16:17:30 +0100 |
commit | 6cdf83eaabda63f7c5cf9d69d51d931308da471e (patch) | |
tree | 60f1d41d9e2bfe286d18b316a426a7505cdff11a /test/evp_test.c | |
parent | 2788b56f0c8306c89c97a6599484120afddfa14a (diff) | |
download | openssl-new-6cdf83eaabda63f7c5cf9d69d51d931308da471e.tar.gz |
test: add sm4 xts test cases
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19619)
Diffstat (limited to 'test/evp_test.c')
-rw-r--r-- | test/evp_test.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/evp_test.c b/test/evp_test.c index a5f7b93cfb..9cccd4209c 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -557,6 +557,7 @@ typedef struct cipher_data_st { int tag_late; unsigned char *mac_key; size_t mac_key_len; + const char *xts_standard; } CIPHER_DATA; static int cipher_test_init(EVP_TEST *t, const char *alg) @@ -698,6 +699,10 @@ static int cipher_test_parse(EVP_TEST *t, const char *keyword, cdat->cts_mode = value; return 1; } + if (strcmp(keyword, "XTSStandard") == 0) { + cdat->xts_standard = value; + return 1; + } return 0; } @@ -940,7 +945,18 @@ static int cipher_test_enc(EVP_TEST *t, int enc, goto err; } } + if (expected->xts_standard != NULL) { + OSSL_PARAM params[2]; + params[0] = + OSSL_PARAM_construct_utf8_string(OSSL_CIPHER_PARAM_XTS_STANDARD, + (char *)expected->xts_standard, 0); + params[1] = OSSL_PARAM_construct_end(); + if (!EVP_CIPHER_CTX_set_params(ctx, params)) { + t->err = "SET_XTS_STANDARD_ERROR"; + goto err; + } + } EVP_CIPHER_CTX_set_padding(ctx, 0); t->err = "CIPHERUPDATE_ERROR"; tmplen = 0; |