• Home
  • Raw
  • Download

Lines Matching refs:fixture

48 static void tear_down(CMP_SES_TEST_FIXTURE *fixture)  in tear_down()  argument
50 OSSL_CMP_CTX_free(fixture->cmp_ctx); in tear_down()
51 ossl_cmp_mock_srv_free(fixture->srv_ctx); in tear_down()
52 sk_X509_free(fixture->caPubs); in tear_down()
53 OPENSSL_free(fixture); in tear_down()
58 CMP_SES_TEST_FIXTURE *fixture; in set_up() local
62 if (!TEST_ptr(fixture = OPENSSL_zalloc(sizeof(*fixture)))) in set_up()
64 fixture->test_case_name = test_case_name; in set_up()
65 if (!TEST_ptr(fixture->srv_ctx = ossl_cmp_mock_srv_new(libctx, NULL)) in set_up()
66 || !OSSL_CMP_SRV_CTX_set_accept_unprotected(fixture->srv_ctx, 1) in set_up()
67 || !ossl_cmp_mock_srv_set1_certOut(fixture->srv_ctx, client_cert) in set_up()
69 OSSL_CMP_SRV_CTX_get0_cmp_ctx(fixture->srv_ctx)) == NULL in set_up()
73 if (!TEST_ptr(fixture->cmp_ctx = ctx = OSSL_CMP_CTX_new(libctx, NULL)) in set_up()
74 || !OSSL_CMP_CTX_set_log_cb(fixture->cmp_ctx, print_to_bio_out) in set_up()
76 || !OSSL_CMP_CTX_set_transfer_cb_arg(ctx, fixture->srv_ctx) in set_up()
85 fixture->req_type = -1; in set_up()
86 return fixture; in set_up()
89 tear_down(fixture); in set_up()
102 static int execute_exec_GENM_ses_test_single(CMP_SES_TEST_FIXTURE *fixture) in execute_exec_GENM_ses_test_single() argument
104 OSSL_CMP_CTX *ctx = fixture->cmp_ctx; in execute_exec_GENM_ses_test_single()
113 return TEST_int_eq(OSSL_CMP_CTX_get_status(ctx), fixture->expected) in execute_exec_GENM_ses_test_single()
114 && fixture->expected == OSSL_CMP_PKISTATUS_accepted ? in execute_exec_GENM_ses_test_single()
118 static int execute_exec_GENM_ses_test(CMP_SES_TEST_FIXTURE *fixture) in execute_exec_GENM_ses_test() argument
120 return execute_exec_GENM_ses_test_single(fixture) in execute_exec_GENM_ses_test()
121 && OSSL_CMP_CTX_reinit(fixture->cmp_ctx) in execute_exec_GENM_ses_test()
122 && execute_exec_GENM_ses_test_single(fixture); in execute_exec_GENM_ses_test()
125 static int execute_exec_certrequest_ses_test(CMP_SES_TEST_FIXTURE *fixture) in execute_exec_certrequest_ses_test() argument
127 OSSL_CMP_CTX *ctx = fixture->cmp_ctx; in execute_exec_certrequest_ses_test()
128 X509 *res = OSSL_CMP_exec_certreq(ctx, fixture->req_type, NULL); in execute_exec_certrequest_ses_test()
132 if (!TEST_int_eq(status, fixture->expected) in execute_exec_certrequest_ses_test()
133 && !(fixture->expected == OSSL_CMP_PKISTATUS_waiting in execute_exec_certrequest_ses_test()
136 if (fixture->expected != OSSL_CMP_PKISTATUS_accepted) in execute_exec_certrequest_ses_test()
141 if (fixture->caPubs != NULL) { in execute_exec_certrequest_ses_test()
142 STACK_OF(X509) *caPubs = OSSL_CMP_CTX_get1_caPubs(fixture->cmp_ctx); in execute_exec_certrequest_ses_test()
143 int ret = TEST_int_eq(STACK_OF_X509_cmp(fixture->caPubs, caPubs), 0); in execute_exec_certrequest_ses_test()
155 OSSL_CMP_CTX_set1_oldCert(fixture->cmp_ctx, NULL); in test_exec_RR_ses()
156 fixture->expected = request_error ? OSSL_CMP_PKISTATUS_request in test_exec_RR_ses()
175 ossl_cmp_mock_srv_set_statusInfo(fixture->srv_ctx, in test_exec_RR_ses_receive_error()
179 ossl_cmp_mock_srv_set_sendError(fixture->srv_ctx, OSSL_CMP_PKIBODY_RR); in test_exec_RR_ses_receive_error()
180 fixture->expected = OSSL_CMP_PKISTATUS_rejection; in test_exec_RR_ses_receive_error()
188 fixture->req_type = OSSL_CMP_IR; in test_exec_IR_ses()
189 fixture->expected = OSSL_CMP_PKISTATUS_accepted; in test_exec_IR_ses()
190 fixture->caPubs = sk_X509_new_null(); in test_exec_IR_ses()
191 sk_X509_push(fixture->caPubs, server_cert); in test_exec_IR_ses()
192 sk_X509_push(fixture->caPubs, server_cert); in test_exec_IR_ses()
193 ossl_cmp_mock_srv_set1_caPubsOut(fixture->srv_ctx, fixture->caPubs); in test_exec_IR_ses()
202 fixture->req_type = OSSL_CMP_IR; in test_exec_IR_ses_poll()
203 fixture->expected = expect; in test_exec_IR_ses_poll()
204 ossl_cmp_mock_srv_set_checkAfterTime(fixture->srv_ctx, check_after); in test_exec_IR_ses_poll()
205 ossl_cmp_mock_srv_set_pollCount(fixture->srv_ctx, poll_count); in test_exec_IR_ses_poll()
206 OSSL_CMP_CTX_set_option(fixture->cmp_ctx, in test_exec_IR_ses_poll()
233 fixture->req_type = OSSL_CMP_CR; in test_exec_CR_ses()
234 OSSL_CMP_CTX_set_option(fixture->cmp_ctx, in test_exec_CR_ses()
236 OSSL_CMP_SRV_CTX_set_grant_implicit_confirm(fixture->srv_ctx, granted); in test_exec_CR_ses()
237 ossl_cmp_mock_srv_set_sendError(fixture->srv_ctx, in test_exec_CR_ses()
239 fixture->expected = reject ? OSSL_CMP_PKISTATUS_rejection in test_exec_CR_ses()
260 fixture->req_type = OSSL_CMP_KUR; in test_exec_KUR_ses()
264 OSSL_CMP_CTX_set_transfer_cb_arg(fixture->cmp_ctx, NULL); in test_exec_KUR_ses()
269 OSSL_CMP_CTX_set0_newPkey(fixture->cmp_ctx, 0 /* not priv */, key); in test_exec_KUR_ses()
270 OSSL_CMP_SRV_CTX_set_accept_raverified(fixture->srv_ctx, 1); in test_exec_KUR_ses()
273 OSSL_CMP_CTX_set_option(fixture->cmp_ctx, OSSL_CMP_OPT_POPO_METHOD, in test_exec_KUR_ses()
275 fixture->expected = transfer_error ? OSSL_CMP_PKISTATUS_trans : in test_exec_KUR_ses()
328 fixture->req_type = OSSL_CMP_P10CR; in test_exec_P10CR_ses()
329 fixture->expected = reject ? OSSL_CMP_PKISTATUS_rejection in test_exec_P10CR_ses()
331 ctx = fixture->cmp_ctx; in test_exec_P10CR_ses()
336 tear_down(fixture); in test_exec_P10CR_ses()
337 fixture = NULL; in test_exec_P10CR_ses()
354 static int execute_try_certreq_poll_test(CMP_SES_TEST_FIXTURE *fixture) in execute_try_certreq_poll_test() argument
356 OSSL_CMP_CTX *ctx = fixture->cmp_ctx; in execute_try_certreq_poll_test()
361 ossl_cmp_mock_srv_set_pollCount(fixture->srv_ctx, 3); in execute_try_certreq_poll_test()
362 ossl_cmp_mock_srv_set_checkAfterTime(fixture->srv_ctx, CHECK_AFTER); in execute_try_certreq_poll_test()
369 && TEST_int_eq(fixture->expected, in execute_try_certreq_poll_test()
378 fixture->expected = 1; in test_try_certreq_poll()
383 static int execute_try_certreq_poll_abort_test(CMP_SES_TEST_FIXTURE *fixture) in execute_try_certreq_poll_abort_test() argument
385 OSSL_CMP_CTX *ctx = fixture->cmp_ctx; in execute_try_certreq_poll_abort_test()
390 ossl_cmp_mock_srv_set_pollCount(fixture->srv_ctx, 3); in execute_try_certreq_poll_abort_test()
391 ossl_cmp_mock_srv_set_checkAfterTime(fixture->srv_ctx, CHECK_AFTER); in execute_try_certreq_poll_abort_test()
395 && TEST_int_eq(fixture->expected, in execute_try_certreq_poll_abort_test()
397 && TEST_ptr_eq(OSSL_CMP_CTX_get0_newCert(fixture->cmp_ctx), NULL); in execute_try_certreq_poll_abort_test()
403 fixture->expected = 1; in test_try_certreq_poll_abort()
412 OSSL_CMP_CTX_set_transfer_cb_arg(fixture->cmp_ctx, NULL); in test_exec_GENM_ses()
417 fixture->cmp_ctx->total_timeout = total_timeout; in test_exec_GENM_ses()
418 fixture->expected = expect; in test_exec_GENM_ses()
438 static int execute_exchange_certConf_test(CMP_SES_TEST_FIXTURE *fixture) in execute_exchange_certConf_test() argument
441 ossl_cmp_exchange_certConf(fixture->cmp_ctx, OSSL_CMP_CERTREQID, in execute_exchange_certConf_test()
444 return TEST_int_eq(fixture->expected, res); in execute_exchange_certConf_test()
447 static int execute_exchange_error_test(CMP_SES_TEST_FIXTURE *fixture) in execute_exchange_error_test() argument
450 ossl_cmp_exchange_error(fixture->cmp_ctx, in execute_exchange_error_test()
455 return TEST_int_eq(fixture->expected, res); in execute_exchange_error_test()
461 fixture->expected = 0; /* client should not send certConf immediately */ in test_exchange_certConf()
462 if (!ossl_cmp_ctx_set0_newCert(fixture->cmp_ctx, X509_dup(client_cert))) { in test_exchange_certConf()
463 tear_down(fixture); in test_exchange_certConf()
464 fixture = NULL; in test_exchange_certConf()
473 fixture->expected = 1; /* client may send error any time */ in test_exchange_error()