Lines Matching full:fixture
38 static void tear_down(CMP_MSG_TEST_FIXTURE *fixture) in tear_down() argument
40 OSSL_CMP_CTX_free(fixture->cmp_ctx); in tear_down()
41 OSSL_CMP_MSG_free(fixture->msg); in tear_down()
42 OSSL_CMP_PKISI_free(fixture->si); in tear_down()
43 OPENSSL_free(fixture); in tear_down()
50 CMP_MSG_TEST_FIXTURE *fixture; in set_up() local
52 if (!TEST_ptr(fixture = OPENSSL_zalloc(sizeof(*fixture)))) in set_up()
54 fixture->test_case_name = test_case_name; in set_up()
56 if (!TEST_ptr(fixture->cmp_ctx = OSSL_CMP_CTX_new(libctx, NULL)) in set_up()
57 || !TEST_true(SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 1)) in set_up()
58 || !TEST_true(OSSL_CMP_CTX_set1_referenceValue(fixture->cmp_ctx, in set_up()
60 tear_down(fixture); in set_up()
63 return fixture; in set_up()
72 …int good = fixture->expected != 0 ? TEST_ptr(msg = (expr)) && TEST_true(valid_asn1_encoding(msg)) …
81 * if fixture->expected != 0:
83 * if fixture->expected == 0
86 static int execute_certreq_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_certreq_create_test() argument
88 EXECUTE_MSG_CREATION_TEST(ossl_cmp_certreq_new(fixture->cmp_ctx, in execute_certreq_create_test()
89 fixture->bodytype, in execute_certreq_create_test()
93 static int execute_errormsg_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_errormsg_create_test() argument
95 EXECUTE_MSG_CREATION_TEST(ossl_cmp_error_new(fixture->cmp_ctx, fixture->si, in execute_errormsg_create_test()
96 fixture->err_code, in execute_errormsg_create_test()
100 static int execute_rr_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_rr_create_test() argument
102 EXECUTE_MSG_CREATION_TEST(ossl_cmp_rr_new(fixture->cmp_ctx)); in execute_rr_create_test()
105 static int execute_certconf_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_certconf_create_test() argument
107 EXECUTE_MSG_CREATION_TEST(ossl_cmp_certConf_new(fixture->cmp_ctx, OSSL_CMP_CERTREQID, in execute_certconf_create_test()
108 fixture->fail_info, NULL)); in execute_certconf_create_test()
111 static int execute_genm_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_genm_create_test() argument
113 EXECUTE_MSG_CREATION_TEST(ossl_cmp_genm_new(fixture->cmp_ctx)); in execute_genm_create_test()
116 static int execute_pollreq_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_pollreq_create_test() argument
118 EXECUTE_MSG_CREATION_TEST(ossl_cmp_pollReq_new(fixture->cmp_ctx, 4711)); in execute_pollreq_create_test()
121 static int execute_pkimessage_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_pkimessage_create_test() argument
123 EXECUTE_MSG_CREATION_TEST(ossl_cmp_msg_create(fixture->cmp_ctx, fixture->bodytype)); in execute_pkimessage_create_test()
145 ctx = fixture->cmp_ctx; in test_cmp_create_ir_protection_set()
146 fixture->bodytype = OSSL_CMP_PKIBODY_IR; in test_cmp_create_ir_protection_set()
147 fixture->err_code = -1; in test_cmp_create_ir_protection_set()
148 fixture->expected = 1; in test_cmp_create_ir_protection_set()
154 tear_down(fixture); in test_cmp_create_ir_protection_set()
155 fixture = NULL; in test_cmp_create_ir_protection_set()
164 fixture->bodytype = OSSL_CMP_PKIBODY_IR; in test_cmp_create_ir_protection_fails()
165 fixture->err_code = -1; in test_cmp_create_ir_protection_fails()
166 fixture->expected = 0; in test_cmp_create_ir_protection_fails()
167 if (!TEST_true(OSSL_CMP_CTX_set1_pkey(fixture->cmp_ctx, newkey)) in test_cmp_create_ir_protection_fails()
168 || !TEST_true(SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 0)) in test_cmp_create_ir_protection_fails()
170 || !TEST_true(OSSL_CMP_CTX_set1_cert(fixture->cmp_ctx, cert))) { in test_cmp_create_ir_protection_fails()
171 tear_down(fixture); in test_cmp_create_ir_protection_fails()
172 fixture = NULL; in test_cmp_create_ir_protection_fails()
181 fixture->bodytype = OSSL_CMP_PKIBODY_CR; in test_cmp_create_cr_without_key()
182 fixture->err_code = -1; in test_cmp_create_cr_without_key()
183 fixture->expected = 0; in test_cmp_create_cr_without_key()
191 fixture->bodytype = OSSL_CMP_PKIBODY_CR; in test_cmp_create_cr()
192 fixture->err_code = -1; in test_cmp_create_cr()
193 fixture->expected = 1; in test_cmp_create_cr()
194 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_cr()
195 tear_down(fixture); in test_cmp_create_cr()
196 fixture = NULL; in test_cmp_create_cr()
205 fixture->bodytype = OSSL_CMP_PKIBODY_RR; in test_cmp_create_certreq_with_invalid_bodytype()
206 fixture->err_code = -1; in test_cmp_create_certreq_with_invalid_bodytype()
207 fixture->expected = 0; in test_cmp_create_certreq_with_invalid_bodytype()
208 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_certreq_with_invalid_bodytype()
209 tear_down(fixture); in test_cmp_create_certreq_with_invalid_bodytype()
210 fixture = NULL; in test_cmp_create_certreq_with_invalid_bodytype()
222 ctx = fixture->cmp_ctx; in test_cmp_create_p10cr()
223 fixture->bodytype = OSSL_CMP_PKIBODY_P10CR; in test_cmp_create_p10cr()
224 fixture->err_code = CMP_R_ERROR_CREATING_CERTREQ; in test_cmp_create_p10cr()
225 fixture->expected = 1; in test_cmp_create_p10cr()
229 tear_down(fixture); in test_cmp_create_p10cr()
230 fixture = NULL; in test_cmp_create_p10cr()
240 fixture->bodytype = OSSL_CMP_PKIBODY_P10CR; in test_cmp_create_p10cr_null()
241 fixture->err_code = CMP_R_ERROR_CREATING_CERTREQ; in test_cmp_create_p10cr_null()
242 fixture->expected = 0; in test_cmp_create_p10cr_null()
243 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_p10cr_null()
244 tear_down(fixture); in test_cmp_create_p10cr_null()
245 fixture = NULL; in test_cmp_create_p10cr_null()
254 fixture->bodytype = OSSL_CMP_PKIBODY_KUR; in test_cmp_create_kur()
255 fixture->err_code = -1; in test_cmp_create_kur()
256 fixture->expected = 1; in test_cmp_create_kur()
257 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey)) in test_cmp_create_kur()
258 || !TEST_true(OSSL_CMP_CTX_set1_oldCert(fixture->cmp_ctx, cert))) { in test_cmp_create_kur()
259 tear_down(fixture); in test_cmp_create_kur()
260 fixture = NULL; in test_cmp_create_kur()
269 fixture->bodytype = OSSL_CMP_PKIBODY_KUR; in test_cmp_create_kur_without_oldcert()
270 fixture->err_code = -1; in test_cmp_create_kur_without_oldcert()
271 fixture->expected = 0; in test_cmp_create_kur_without_oldcert()
272 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_kur_without_oldcert()
273 tear_down(fixture); in test_cmp_create_kur_without_oldcert()
274 fixture = NULL; in test_cmp_create_kur_without_oldcert()
283 fixture->fail_info = 0; in test_cmp_create_certconf()
284 fixture->expected = 1; in test_cmp_create_certconf()
285 if (!TEST_true(ossl_cmp_ctx_set0_newCert(fixture->cmp_ctx, in test_cmp_create_certconf()
287 tear_down(fixture); in test_cmp_create_certconf()
288 fixture = NULL; in test_cmp_create_certconf()
297 fixture->fail_info = 1 << OSSL_CMP_PKIFAILUREINFO_badAlg; in test_cmp_create_certconf_badAlg()
298 fixture->expected = 1; in test_cmp_create_certconf_badAlg()
299 if (!TEST_true(ossl_cmp_ctx_set0_newCert(fixture->cmp_ctx, in test_cmp_create_certconf_badAlg()
301 tear_down(fixture); in test_cmp_create_certconf_badAlg()
302 fixture = NULL; in test_cmp_create_certconf_badAlg()
311 fixture->fail_info = 1 << OSSL_CMP_PKIFAILUREINFO_MAX; in test_cmp_create_certconf_fail_info_max()
312 fixture->expected = 1; in test_cmp_create_certconf_fail_info_max()
313 if (!TEST_true(ossl_cmp_ctx_set0_newCert(fixture->cmp_ctx, in test_cmp_create_certconf_fail_info_max()
315 tear_down(fixture); in test_cmp_create_certconf_fail_info_max()
316 fixture = NULL; in test_cmp_create_certconf_fail_info_max()
325 fixture->si = OSSL_CMP_STATUSINFO_new(OSSL_CMP_PKISTATUS_rejection, in test_cmp_create_error_msg()
328 fixture->err_code = -1; in test_cmp_create_error_msg()
329 fixture->expected = 1; /* expected: message creation is successful */ in test_cmp_create_error_msg()
330 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_error_msg()
331 tear_down(fixture); in test_cmp_create_error_msg()
332 fixture = NULL; in test_cmp_create_error_msg()
341 fixture->expected = 1; in test_cmp_create_pollreq()
349 fixture->expected = 1; in test_cmp_create_rr()
350 if (!TEST_true(OSSL_CMP_CTX_set1_oldCert(fixture->cmp_ctx, cert))) { in test_cmp_create_rr()
351 tear_down(fixture); in test_cmp_create_rr()
352 fixture = NULL; in test_cmp_create_rr()
363 fixture->expected = 1; in test_cmp_create_genm()
366 || !TEST_true(OSSL_CMP_CTX_push0_genm_ITAV(fixture->cmp_ctx, iv))) { in test_cmp_create_genm()
368 tear_down(fixture); in test_cmp_create_genm()
369 fixture = NULL; in test_cmp_create_genm()
376 static int execute_certrep_create(CMP_MSG_TEST_FIXTURE *fixture) in execute_certrep_create() argument
378 OSSL_CMP_CTX *ctx = fixture->cmp_ctx; in execute_certrep_create()
419 static int execute_rp_create(CMP_MSG_TEST_FIXTURE *fixture) in execute_rp_create() argument
435 || (rpmsg = ossl_cmp_rp_new(fixture->cmp_ctx, si, cid, 1)) == NULL) in execute_rp_create()
461 static int execute_pollrep_create(CMP_MSG_TEST_FIXTURE *fixture) in execute_pollrep_create() argument
466 pollrep = ossl_cmp_pollRep_new(fixture->cmp_ctx, 77, 2000); in execute_pollrep_create()
493 switch (fixture->bodytype = bodytype) { in test_cmp_pkimessage_create()
495 fixture->expected = 1; in test_cmp_pkimessage_create()
497 if (!TEST_true(OSSL_CMP_CTX_set1_p10CSR(fixture->cmp_ctx, p10cr))) { in test_cmp_pkimessage_create()
498 tear_down(fixture); in test_cmp_pkimessage_create()
499 fixture = NULL; in test_cmp_pkimessage_create()
518 fixture->expected = 1; in test_cmp_pkimessage_create()
521 fixture->expected = 0; in test_cmp_pkimessage_create()