• Home
  • Raw
  • Download

Lines Matching refs: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 ? \
88 static int execute_certreq_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_certreq_create_test() argument
90 EXECUTE_MSG_CREATION_TEST(ossl_cmp_certreq_new(fixture->cmp_ctx, in execute_certreq_create_test()
91 fixture->bodytype, in execute_certreq_create_test()
95 static int execute_errormsg_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_errormsg_create_test() argument
97 EXECUTE_MSG_CREATION_TEST(ossl_cmp_error_new(fixture->cmp_ctx, fixture->si, in execute_errormsg_create_test()
98 fixture->err_code, in execute_errormsg_create_test()
102 static int execute_rr_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_rr_create_test() argument
104 EXECUTE_MSG_CREATION_TEST(ossl_cmp_rr_new(fixture->cmp_ctx)); in execute_rr_create_test()
107 static int execute_certconf_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_certconf_create_test() argument
110 (fixture->cmp_ctx, OSSL_CMP_CERTREQID, in execute_certconf_create_test()
111 fixture->fail_info, NULL)); in execute_certconf_create_test()
114 static int execute_genm_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_genm_create_test() argument
116 EXECUTE_MSG_CREATION_TEST(ossl_cmp_genm_new(fixture->cmp_ctx)); in execute_genm_create_test()
119 static int execute_pollreq_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_pollreq_create_test() argument
121 EXECUTE_MSG_CREATION_TEST(ossl_cmp_pollReq_new(fixture->cmp_ctx, 4711)); in execute_pollreq_create_test()
124 static int execute_pkimessage_create_test(CMP_MSG_TEST_FIXTURE *fixture) in execute_pkimessage_create_test() argument
127 (fixture->cmp_ctx, fixture->bodytype)); in execute_pkimessage_create_test()
149 ctx = fixture->cmp_ctx; in test_cmp_create_ir_protection_set()
150 fixture->bodytype = OSSL_CMP_PKIBODY_IR; in test_cmp_create_ir_protection_set()
151 fixture->err_code = -1; in test_cmp_create_ir_protection_set()
152 fixture->expected = 1; in test_cmp_create_ir_protection_set()
158 tear_down(fixture); in test_cmp_create_ir_protection_set()
159 fixture = NULL; in test_cmp_create_ir_protection_set()
168 fixture->bodytype = OSSL_CMP_PKIBODY_IR; in test_cmp_create_ir_protection_fails()
169 fixture->err_code = -1; in test_cmp_create_ir_protection_fails()
170 fixture->expected = 0; in test_cmp_create_ir_protection_fails()
171 if (!TEST_true(OSSL_CMP_CTX_set1_pkey(fixture->cmp_ctx, newkey)) in test_cmp_create_ir_protection_fails()
172 || !TEST_true(SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 0)) in test_cmp_create_ir_protection_fails()
174 || !TEST_true(OSSL_CMP_CTX_set1_cert(fixture->cmp_ctx, cert))) { in test_cmp_create_ir_protection_fails()
175 tear_down(fixture); in test_cmp_create_ir_protection_fails()
176 fixture = NULL; in test_cmp_create_ir_protection_fails()
185 fixture->bodytype = OSSL_CMP_PKIBODY_CR; in test_cmp_create_cr_without_key()
186 fixture->err_code = -1; in test_cmp_create_cr_without_key()
187 fixture->expected = 0; in test_cmp_create_cr_without_key()
195 fixture->bodytype = OSSL_CMP_PKIBODY_CR; in test_cmp_create_cr()
196 fixture->err_code = -1; in test_cmp_create_cr()
197 fixture->expected = 1; in test_cmp_create_cr()
198 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_cr()
199 tear_down(fixture); in test_cmp_create_cr()
200 fixture = NULL; in test_cmp_create_cr()
209 fixture->bodytype = OSSL_CMP_PKIBODY_RR; in test_cmp_create_certreq_with_invalid_bodytype()
210 fixture->err_code = -1; in test_cmp_create_certreq_with_invalid_bodytype()
211 fixture->expected = 0; in test_cmp_create_certreq_with_invalid_bodytype()
212 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_certreq_with_invalid_bodytype()
213 tear_down(fixture); in test_cmp_create_certreq_with_invalid_bodytype()
214 fixture = NULL; in test_cmp_create_certreq_with_invalid_bodytype()
226 ctx = fixture->cmp_ctx; in test_cmp_create_p10cr()
227 fixture->bodytype = OSSL_CMP_PKIBODY_P10CR; in test_cmp_create_p10cr()
228 fixture->err_code = CMP_R_ERROR_CREATING_CERTREQ; in test_cmp_create_p10cr()
229 fixture->expected = 1; in test_cmp_create_p10cr()
233 tear_down(fixture); in test_cmp_create_p10cr()
234 fixture = NULL; in test_cmp_create_p10cr()
244 fixture->bodytype = OSSL_CMP_PKIBODY_P10CR; in test_cmp_create_p10cr_null()
245 fixture->err_code = CMP_R_ERROR_CREATING_CERTREQ; in test_cmp_create_p10cr_null()
246 fixture->expected = 0; in test_cmp_create_p10cr_null()
247 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_p10cr_null()
248 tear_down(fixture); in test_cmp_create_p10cr_null()
249 fixture = NULL; in test_cmp_create_p10cr_null()
258 fixture->bodytype = OSSL_CMP_PKIBODY_KUR; in test_cmp_create_kur()
259 fixture->err_code = -1; in test_cmp_create_kur()
260 fixture->expected = 1; in test_cmp_create_kur()
261 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey)) in test_cmp_create_kur()
262 || !TEST_true(OSSL_CMP_CTX_set1_oldCert(fixture->cmp_ctx, cert))) { in test_cmp_create_kur()
263 tear_down(fixture); in test_cmp_create_kur()
264 fixture = NULL; in test_cmp_create_kur()
273 fixture->bodytype = OSSL_CMP_PKIBODY_KUR; in test_cmp_create_kur_without_oldcert()
274 fixture->err_code = -1; in test_cmp_create_kur_without_oldcert()
275 fixture->expected = 0; in test_cmp_create_kur_without_oldcert()
276 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_kur_without_oldcert()
277 tear_down(fixture); in test_cmp_create_kur_without_oldcert()
278 fixture = NULL; in test_cmp_create_kur_without_oldcert()
287 fixture->fail_info = 0; in test_cmp_create_certconf()
288 fixture->expected = 1; in test_cmp_create_certconf()
289 if (!TEST_true(ossl_cmp_ctx_set0_newCert(fixture->cmp_ctx, in test_cmp_create_certconf()
291 tear_down(fixture); in test_cmp_create_certconf()
292 fixture = NULL; in test_cmp_create_certconf()
301 fixture->fail_info = 1 << OSSL_CMP_PKIFAILUREINFO_badAlg; in test_cmp_create_certconf_badAlg()
302 fixture->expected = 1; in test_cmp_create_certconf_badAlg()
303 if (!TEST_true(ossl_cmp_ctx_set0_newCert(fixture->cmp_ctx, in test_cmp_create_certconf_badAlg()
305 tear_down(fixture); in test_cmp_create_certconf_badAlg()
306 fixture = NULL; in test_cmp_create_certconf_badAlg()
315 fixture->fail_info = 1 << OSSL_CMP_PKIFAILUREINFO_MAX; in test_cmp_create_certconf_fail_info_max()
316 fixture->expected = 1; in test_cmp_create_certconf_fail_info_max()
317 if (!TEST_true(ossl_cmp_ctx_set0_newCert(fixture->cmp_ctx, in test_cmp_create_certconf_fail_info_max()
319 tear_down(fixture); in test_cmp_create_certconf_fail_info_max()
320 fixture = NULL; in test_cmp_create_certconf_fail_info_max()
329 fixture->si = OSSL_CMP_STATUSINFO_new(OSSL_CMP_PKISTATUS_rejection, in test_cmp_create_error_msg()
332 fixture->err_code = -1; in test_cmp_create_error_msg()
333 fixture->expected = 1; /* expected: message creation is successful */ in test_cmp_create_error_msg()
334 if (!TEST_true(set1_newPkey(fixture->cmp_ctx, newkey))) { in test_cmp_create_error_msg()
335 tear_down(fixture); in test_cmp_create_error_msg()
336 fixture = NULL; in test_cmp_create_error_msg()
346 fixture->expected = 1; in test_cmp_create_pollreq()
354 fixture->expected = 1; in test_cmp_create_rr()
355 if (!TEST_true(OSSL_CMP_CTX_set1_oldCert(fixture->cmp_ctx, cert))) { in test_cmp_create_rr()
356 tear_down(fixture); in test_cmp_create_rr()
357 fixture = NULL; in test_cmp_create_rr()
368 fixture->expected = 1; in test_cmp_create_genm()
371 || !TEST_true(OSSL_CMP_CTX_push0_genm_ITAV(fixture->cmp_ctx, iv))) { in test_cmp_create_genm()
373 tear_down(fixture); in test_cmp_create_genm()
374 fixture = NULL; in test_cmp_create_genm()
381 static int execute_certrep_create(CMP_MSG_TEST_FIXTURE *fixture) in execute_certrep_create() argument
383 OSSL_CMP_CTX *ctx = fixture->cmp_ctx; in execute_certrep_create()
427 static int execute_rp_create(CMP_MSG_TEST_FIXTURE *fixture) in execute_rp_create() argument
443 || (rpmsg = ossl_cmp_rp_new(fixture->cmp_ctx, si, cid, 1)) == NULL) in execute_rp_create()
469 static int execute_pollrep_create(CMP_MSG_TEST_FIXTURE *fixture) in execute_pollrep_create() argument
474 pollrep = ossl_cmp_pollRep_new(fixture->cmp_ctx, 77, 2000); in execute_pollrep_create()
503 switch (fixture->bodytype = bodytype) { in test_cmp_pkimessage_create()
505 fixture->expected = 1; in test_cmp_pkimessage_create()
507 if (!TEST_true(OSSL_CMP_CTX_set1_p10CSR(fixture->cmp_ctx, p10cr))) { in test_cmp_pkimessage_create()
508 tear_down(fixture); in test_cmp_pkimessage_create()
509 fixture = NULL; in test_cmp_pkimessage_create()
528 fixture->expected = 1; in test_cmp_pkimessage_create()
531 fixture->expected = 0; in test_cmp_pkimessage_create()