diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-05-14 12:32:44 +1000 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-08-21 09:04:11 +0200 |
commit | ab28b59064b3f46c7a62b540cd17cad718738108 (patch) | |
tree | 2959690fe059a4fbf66b38661e94046aa91000af /test/cmp_server_test.c | |
parent | 97e00da90282dddfc572c84d8468d85ab1925fba (diff) | |
download | openssl-ab28b59064b3f46c7a62b540cd17cad718738108.tar.gz |
Add libctx/provider support to cmp_server_test
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/11808)
Diffstat (limited to 'test/cmp_server_test.c')
-rw-r--r-- | test/cmp_server_test.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/test/cmp_server_test.c b/test/cmp_server_test.c index dc52a2515d..4b3525d7bd 100644 --- a/test/cmp_server_test.c +++ b/test/cmp_server_test.c @@ -18,6 +18,8 @@ typedef struct test_fixture { OSSL_CMP_MSG *req; } CMP_SRV_TEST_FIXTURE; +static OPENSSL_CTX *libctx = NULL; +static OSSL_PROVIDER *default_null_provider = NULL, *provider = NULL; static OSSL_CMP_MSG *request = NULL; static void tear_down(CMP_SRV_TEST_FIXTURE *fixture) @@ -33,7 +35,7 @@ static CMP_SRV_TEST_FIXTURE *set_up(const char *const test_case_name) if (!TEST_ptr(fixture = OPENSSL_zalloc(sizeof(*fixture)))) return NULL; fixture->test_case_name = test_case_name; - if (!TEST_ptr(fixture->srv_ctx = OSSL_CMP_SRV_CTX_new(NULL, NULL))) + if (!TEST_ptr(fixture->srv_ctx = OSSL_CMP_SRV_CTX_new(libctx, NULL))) goto err; return fixture; @@ -67,7 +69,7 @@ static int execute_test_handle_request(CMP_SRV_TEST_FIXTURE *fixture) OSSL_CMP_ERRORMSGCONTENT *errorContent; int res = 0; - if (!TEST_ptr(client_ctx = OSSL_CMP_CTX_new(NULL, NULL)) + if (!TEST_ptr(client_ctx = OSSL_CMP_CTX_new(libctx, NULL)) || !TEST_true(OSSL_CMP_CTX_set_transfer_cb_arg(client_ctx, ctx))) goto end; @@ -119,9 +121,16 @@ static int test_handle_request(void) void cleanup_tests(void) { OSSL_CMP_MSG_free(request); + OSSL_PROVIDER_unload(default_null_provider); + OSSL_PROVIDER_unload(provider); + OPENSSL_CTX_free(libctx); return; } +#define USAGE \ + "CR_protected_PBM_1234.der module_name [module_conf_file]\n" +OPT_TEST_DECLARE_USAGE(USAGE) + int setup_tests(void) { const char *request_f; @@ -132,10 +141,13 @@ int setup_tests(void) } if (!TEST_ptr(request_f = test_get_argument(0))) { - TEST_error("usage: cmp_server_test CR_protected_PBM_1234.der\n"); + TEST_error("usage: cmp_server_test %s", USAGE); return 0; } + if (!test_get_libctx(&libctx, &default_null_provider, &provider, 1, USAGE)) + return 0; + if (!TEST_ptr(request = load_pkimsg(request_f))) { cleanup_tests(); return 0; |