TEST: Adapt all applicable tests to the new distinguishing ID
[openssl.git] / test / cmp_protect_test.c
1 /*
2  * Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved.
3  * Copyright Nokia 2007-2019
4  * Copyright Siemens AG 2015-2019
5  *
6  * Licensed under the Apache License 2.0 (the "License").  You may not use
7  * this file except in compliance with the License.  You can obtain a copy
8  * in the file LICENSE in the source distribution or at
9  * https://www.openssl.org/source/license.html
10  */
11
12 #include "cmp_testlib.h"
13
14 static const char *ir_protected_f;
15 static const char *ir_unprotected_f;
16 static const char *ip_PBM_f;
17
18 typedef struct test_fixture {
19     const char *test_case_name;
20     OSSL_CMP_CTX *cmp_ctx;
21     /* for protection tests */
22     OSSL_CMP_MSG *msg;
23     OSSL_CMP_PKISI *si; /* for error and response messages */
24     ASN1_OCTET_STRING *secret;
25     EVP_PKEY *privkey;
26     EVP_PKEY *pubkey;
27     unsigned char *mem;
28     int memlen;
29     X509 *cert;
30     STACK_OF(X509) *certs;
31     STACK_OF(X509) *chain;
32     int callback_arg;
33     int expected;
34 } CMP_PROTECT_TEST_FIXTURE;
35
36 static void tear_down(CMP_PROTECT_TEST_FIXTURE *fixture)
37 {
38     OSSL_CMP_CTX_free(fixture->cmp_ctx);
39     OSSL_CMP_MSG_free(fixture->msg);
40     ASN1_OCTET_STRING_free(fixture->secret);
41     OSSL_CMP_PKISI_free(fixture->si);
42
43     OPENSSL_free(fixture->mem);
44     sk_X509_free(fixture->certs);
45     sk_X509_free(fixture->chain);
46
47     OPENSSL_free(fixture);
48 }
49
50 static CMP_PROTECT_TEST_FIXTURE *set_up(const char *const test_case_name)
51 {
52     CMP_PROTECT_TEST_FIXTURE *fixture;
53
54     if (!TEST_ptr(fixture = OPENSSL_zalloc(sizeof(*fixture))))
55         return NULL;
56     fixture->test_case_name = test_case_name;
57     if (!TEST_ptr(fixture->cmp_ctx = OSSL_CMP_CTX_new())) {
58         tear_down(fixture);
59         return NULL;
60     }
61     return fixture;
62 }
63
64 static EVP_PKEY *loadedprivkey = NULL;
65 static EVP_PKEY *loadedpubkey = NULL;
66 static EVP_PKEY *loadedkey = NULL;
67 static X509 *cert = NULL;
68 static unsigned char rand_data[OSSL_CMP_TRANSACTIONID_LENGTH];
69 static OSSL_CMP_MSG *ir_unprotected, *ir_protected;
70 static X509 *endentity1 = NULL, *endentity2 = NULL,
71     *root = NULL, *intermediate = NULL;
72
73 static int execute_calc_protection_fails_test(CMP_PROTECT_TEST_FIXTURE *fixture)
74 {
75     ASN1_BIT_STRING *protection =
76         ossl_cmp_calc_protection(fixture->msg, fixture->secret,
77                                  fixture->privkey);
78     int res = TEST_ptr_null(protection);
79
80     ASN1_BIT_STRING_free(protection);
81     return res;
82 }
83
84 static int execute_calc_protection_pbmac_test(CMP_PROTECT_TEST_FIXTURE *fixture)
85 {
86     ASN1_BIT_STRING *protection =
87         ossl_cmp_calc_protection(fixture->msg, fixture->secret, NULL);
88     int res = TEST_ptr(protection)
89             && TEST_true(ASN1_STRING_cmp(protection,
90                                          fixture->msg->protection) == 0);
91
92     ASN1_BIT_STRING_free(protection);
93     return res;
94 }
95
96 /*
97  * This function works similarly to parts of CMP_verify_signature in cmp_vfy.c,
98  * but without the need for a OSSL_CMP_CTX or a X509 certificate
99  */
100 static int verify_signature(OSSL_CMP_MSG *msg,
101                             ASN1_BIT_STRING *protection,
102                             EVP_PKEY *pkey, int digest_nid)
103 {
104     CMP_PROTECTEDPART prot_part;
105     unsigned char *prot_part_der = NULL;
106     int len;
107     EVP_MD_CTX *ctx = NULL;
108     const EVP_MD *digest = EVP_get_digestbynid(digest_nid);
109     int res;
110
111     prot_part.header = OSSL_CMP_MSG_get0_header(msg);
112     prot_part.body = msg->body;
113     res =
114         TEST_int_ge(len = i2d_CMP_PROTECTEDPART(&prot_part, &prot_part_der), 0)
115         && TEST_ptr(ctx = EVP_MD_CTX_new())
116         && TEST_true(EVP_DigestVerifyInit(ctx, NULL, digest, NULL, pkey))
117         && TEST_int_eq(EVP_DigestVerify(ctx, protection->data,
118                                         protection->length,
119                                         prot_part_der, len), 1);
120     /* cleanup */
121     EVP_MD_CTX_free(ctx);
122     OPENSSL_free(prot_part_der);
123     return res;
124 }
125
126 /* Calls OSSL_CMP_calc_protection and compares and verifies signature */
127 static int execute_calc_protection_signature_test(CMP_PROTECT_TEST_FIXTURE *
128                                                   fixture)
129 {
130     ASN1_BIT_STRING *protection =
131         ossl_cmp_calc_protection(fixture->msg, NULL, fixture->privkey);
132     int ret = (TEST_ptr(protection)
133                    && TEST_true(ASN1_STRING_cmp(protection,
134                                                 fixture->msg->protection) == 0)
135                    && TEST_true(verify_signature(fixture->msg, protection,
136                                                  fixture->pubkey,
137                                                  fixture->cmp_ctx->digest)));
138
139     ASN1_BIT_STRING_free(protection);
140     return ret;
141 }
142
143 static int test_cmp_calc_protection_no_key_no_secret(void)
144 {
145     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
146     if (!TEST_ptr(fixture->msg = load_pkimsg(ir_unprotected_f))
147             || !TEST_ptr(fixture->msg->header->protectionAlg =
148                          X509_ALGOR_new() /* no specific alg needed here */)) {
149         tear_down(fixture);
150         fixture = NULL;
151     }
152
153     EXECUTE_TEST(execute_calc_protection_fails_test, tear_down);
154     return result;
155 }
156
157 static int test_cmp_calc_protection_pkey(void)
158 {
159     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
160     fixture->pubkey = loadedpubkey;
161     fixture->privkey = loadedprivkey;
162     if (!TEST_ptr(fixture->msg = load_pkimsg(ir_protected_f))) {
163         tear_down(fixture);
164         fixture = NULL;
165     }
166     EXECUTE_TEST(execute_calc_protection_signature_test, tear_down);
167     return result;
168 }
169
170 static int test_cmp_calc_protection_pbmac(void)
171 {
172     unsigned char sec_insta[] = { 'i', 'n', 's', 't', 'a' };
173
174     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
175     if (!TEST_ptr(fixture->secret = ASN1_OCTET_STRING_new())
176             || !TEST_true(ASN1_OCTET_STRING_set
177                           (fixture->secret, sec_insta, sizeof(sec_insta)))
178             || !TEST_ptr(fixture->msg = load_pkimsg(ip_PBM_f))) {
179         tear_down(fixture);
180         fixture = NULL;
181     }
182     EXECUTE_TEST(execute_calc_protection_pbmac_test, tear_down);
183     return result;
184 }
185 static int execute_MSG_protect_test(CMP_PROTECT_TEST_FIXTURE *fixture)
186 {
187     return TEST_int_eq(fixture->expected,
188                        ossl_cmp_msg_protect(fixture->cmp_ctx, fixture->msg));
189 }
190
191 #define SET_OPT_UNPROTECTED_SEND(ctx, val) \
192     OSSL_CMP_CTX_set_option((ctx), OSSL_CMP_OPT_UNPROTECTED_SEND, (val))
193 static int test_MSG_protect_unprotected_request(void)
194 {
195     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
196
197     fixture->expected = 1;
198     if (!TEST_ptr(fixture->msg = OSSL_CMP_MSG_dup(ir_unprotected))
199             || !TEST_true(SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 1))) {
200         tear_down(fixture);
201         fixture = NULL;
202     }
203     EXECUTE_TEST(execute_MSG_protect_test, tear_down);
204     return result;
205 }
206
207 static int test_MSG_protect_with_msg_sig_alg_protection_plus_rsa_key(void)
208 {
209     const size_t size = sizeof(rand_data) / 2;
210
211     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
212     fixture->expected = 1;
213
214     if (!TEST_ptr(fixture->msg =
215                   OSSL_CMP_MSG_dup(ir_unprotected))
216             || !TEST_true(SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 0))
217             /*
218              * Use half of the 16 bytes of random input
219              * for each reference and secret value
220              */
221             || !TEST_true(OSSL_CMP_CTX_set1_referenceValue(fixture->cmp_ctx,
222                                                            rand_data, size))
223             || !TEST_true(OSSL_CMP_CTX_set1_secretValue(fixture->cmp_ctx,
224                                                         rand_data + size,
225                                                         size))) {
226         tear_down(fixture);
227         fixture = NULL;
228     }
229     EXECUTE_TEST(execute_MSG_protect_test, tear_down);
230     return result;
231 }
232
233 static int test_MSG_protect_with_certificate_and_key(void)
234 {
235     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
236     fixture->expected = 1;
237
238     if (!TEST_ptr(fixture->msg =
239                   OSSL_CMP_MSG_dup(ir_unprotected))
240             || !TEST_true(SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 0))
241             || !TEST_true(OSSL_CMP_CTX_set1_pkey(fixture->cmp_ctx, loadedkey))
242             || !TEST_true(OSSL_CMP_CTX_set1_clCert(fixture->cmp_ctx, cert))) {
243         tear_down(fixture);
244         fixture = NULL;
245     }
246     EXECUTE_TEST(execute_MSG_protect_test, tear_down);
247     return result;
248 }
249
250 static int test_MSG_protect_certificate_based_without_cert(void)
251 {
252     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
253     OSSL_CMP_CTX *ctx = fixture->cmp_ctx;
254
255     fixture->expected = 0;
256     if (!TEST_ptr(fixture->msg =
257                   OSSL_CMP_MSG_dup(ir_unprotected))
258             || !TEST_true(SET_OPT_UNPROTECTED_SEND(ctx, 0))
259             || !TEST_true(OSSL_CMP_CTX_set0_newPkey(ctx, 1, loadedkey))) {
260         tear_down(fixture);
261         fixture = NULL;
262     }
263     EVP_PKEY_up_ref(loadedkey);
264     EXECUTE_TEST(execute_MSG_protect_test, tear_down);
265     return result;
266 }
267
268 static int test_MSG_protect_no_key_no_secret(void)
269 {
270     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
271     fixture->expected = 0;
272     if (!TEST_ptr(fixture->msg = OSSL_CMP_MSG_dup(ir_unprotected))
273             || !TEST_true(SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 0))) {
274         tear_down(fixture);
275         fixture = NULL;
276     }
277     EXECUTE_TEST(execute_MSG_protect_test, tear_down);
278     return result;
279 }
280
281 static int test_MSG_protect_pbmac_no_sender(int with_ref)
282 {
283     static unsigned char secret[] = { 47, 11, 8, 15 };
284     static unsigned char ref[] = { 0xca, 0xfe, 0xba, 0xbe };
285
286     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
287     fixture->expected = with_ref;
288     if (!TEST_ptr(fixture->msg = OSSL_CMP_MSG_dup(ir_unprotected))
289             || !SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 0)
290             || !ossl_cmp_hdr_set1_sender(fixture->msg->header, NULL)
291             || !OSSL_CMP_CTX_set1_secretValue(fixture->cmp_ctx,
292                                               secret, sizeof(secret))
293             || (!OSSL_CMP_CTX_set1_referenceValue(fixture->cmp_ctx,
294                                                   with_ref ? ref : NULL,
295                                                   sizeof(ref)))) {
296         tear_down(fixture);
297         fixture = NULL;
298     }
299     EXECUTE_TEST(execute_MSG_protect_test, tear_down);
300     return result;
301 }
302
303 static int test_MSG_protect_pbmac_no_sender_with_ref(void)
304 {
305     return test_MSG_protect_pbmac_no_sender(1);
306 }
307
308 static int test_MSG_protect_pbmac_no_sender_no_ref(void)
309 {
310     return test_MSG_protect_pbmac_no_sender(0);
311 }
312
313 static int execute_MSG_add_extraCerts_test(CMP_PROTECT_TEST_FIXTURE *fixture)
314 {
315     return TEST_true(ossl_cmp_msg_add_extraCerts(fixture->cmp_ctx,
316                                                  fixture->msg));
317 }
318
319 static int test_MSG_add_extraCerts(void)
320 {
321     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
322     if (!TEST_ptr(fixture->msg = OSSL_CMP_MSG_dup(ir_protected))) {
323         tear_down(fixture);
324         fixture = NULL;
325     }
326     EXECUTE_TEST(execute_MSG_add_extraCerts_test, tear_down);
327     return result;
328 }
329
330 #ifndef OPENSSL_NO_EC
331 /* The cert chain tests use EC certs so we skip them in no-ec builds */
332 static int execute_cmp_build_cert_chain_test(CMP_PROTECT_TEST_FIXTURE *fixture)
333 {
334     STACK_OF(X509) *result = NULL;
335     int ret = 0;
336
337     if (TEST_ptr(result = ossl_cmp_build_cert_chain(fixture->certs,
338                                                     fixture->cert))) {
339         /* Check whether chain built is equal to the expected one */
340         ret = TEST_int_eq(0, STACK_OF_X509_cmp(result, fixture->chain));
341         sk_X509_pop_free(result, X509_free);
342     }
343     return ret;
344 }
345
346 static int test_cmp_build_cert_chain(void)
347 {
348     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
349     fixture->cert = endentity2;
350     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
351             || !TEST_ptr(fixture->chain = sk_X509_new_null())
352             || !TEST_true(sk_X509_push(fixture->certs, endentity1))
353             || !TEST_true(sk_X509_push(fixture->certs, root))
354             || !TEST_true(sk_X509_push(fixture->certs, intermediate))
355             || !TEST_true(sk_X509_push(fixture->chain, endentity2))
356             || !TEST_true(sk_X509_push(fixture->chain, intermediate))) {
357         tear_down(fixture);
358         fixture = NULL;
359     }
360     EXECUTE_TEST(execute_cmp_build_cert_chain_test, tear_down);
361     return result;
362 }
363
364 static int test_cmp_build_cert_chain_missing_intermediate(void)
365 {
366     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
367     fixture->cert = endentity2;
368     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
369             || !TEST_ptr(fixture->chain = sk_X509_new_null())
370             || !TEST_true(sk_X509_push(fixture->certs, endentity1))
371             || !TEST_true(sk_X509_push(fixture->certs, root))
372             || !TEST_true(sk_X509_push(fixture->chain, endentity2))) {
373         tear_down(fixture);
374         fixture = NULL;
375     }
376     EXECUTE_TEST(execute_cmp_build_cert_chain_test, tear_down);
377     return result;
378 }
379
380 static int test_cmp_build_cert_chain_missing_root(void)
381 {
382     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
383     fixture->cert = endentity2;
384     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
385             || !TEST_ptr(fixture->chain = sk_X509_new_null())
386             || !TEST_true(sk_X509_push(fixture->certs, endentity1))
387             || !TEST_true(sk_X509_push(fixture->certs, intermediate))
388             || !TEST_true(sk_X509_push(fixture->chain, endentity2))
389             || !TEST_true(sk_X509_push(fixture->chain, intermediate))) {
390         tear_down(fixture);
391         fixture = NULL;
392     }
393     EXECUTE_TEST(execute_cmp_build_cert_chain_test, tear_down);
394     return result;
395 }
396
397 static int test_cmp_build_cert_chain_no_certs(void)
398 {
399     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
400     fixture->cert = endentity2;
401     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
402             || !TEST_ptr(fixture->chain = sk_X509_new_null())
403             || !TEST_true(sk_X509_push(fixture->chain, endentity2))) {
404         tear_down(fixture);
405         fixture = NULL;
406     }
407     EXECUTE_TEST(execute_cmp_build_cert_chain_test, tear_down);
408     return result;
409 }
410 #endif /* OPENSSL_NO_EC */
411
412 static int execute_X509_STORE_test(CMP_PROTECT_TEST_FIXTURE *fixture)
413 {
414     X509_STORE *store = X509_STORE_new();
415     STACK_OF(X509) *sk = NULL;
416     int res = 0;
417
418     if (!TEST_true(ossl_cmp_X509_STORE_add1_certs(store,
419                                                   fixture->certs,
420                                                   fixture->callback_arg)))
421         goto err;
422     sk = X509_STORE_get1_all_certs(store);
423     if (!TEST_int_eq(0, STACK_OF_X509_cmp(sk, fixture->chain)))
424         goto err;
425     res = 1;
426  err:
427     X509_STORE_free(store);
428     sk_X509_pop_free(sk, X509_free);
429     return res;
430
431 }
432
433 static int test_X509_STORE(void)
434 {
435     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
436     fixture->callback_arg = 0; /* self-issued allowed */
437     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
438             || !sk_X509_push(fixture->certs, endentity1)
439             || !sk_X509_push(fixture->certs, endentity2)
440             || !sk_X509_push(fixture->certs, root)
441             || !sk_X509_push(fixture->certs, intermediate)
442             || !TEST_ptr(fixture->chain = sk_X509_dup(fixture->certs))) {
443         tear_down(fixture);
444         fixture = NULL;
445     }
446     EXECUTE_TEST(execute_X509_STORE_test, tear_down);
447     return result;
448 }
449
450 static int test_X509_STORE_only_self_issued(void)
451 {
452     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
453     fixture->certs = sk_X509_new_null();
454     fixture->chain = sk_X509_new_null();
455     fixture->callback_arg = 1; /* only self-issued */
456     if (!TEST_true(sk_X509_push(fixture->certs, endentity1))
457             || !TEST_true(sk_X509_push(fixture->certs, endentity2))
458             || !TEST_true(sk_X509_push(fixture->certs, root))
459             || !TEST_true(sk_X509_push(fixture->certs, intermediate))
460             || !TEST_true(sk_X509_push(fixture->chain, root))) {
461         tear_down(fixture);
462         fixture = NULL;
463     }
464     EXECUTE_TEST(execute_X509_STORE_test, tear_down);
465     return result;
466 }
467
468
469 void cleanup_tests(void)
470 {
471     EVP_PKEY_free(loadedprivkey);
472     EVP_PKEY_free(loadedpubkey);
473     EVP_PKEY_free(loadedkey);
474     X509_free(cert);
475     X509_free(endentity1);
476     X509_free(endentity2);
477     X509_free(root);
478     X509_free(intermediate);
479     OSSL_CMP_MSG_free(ir_protected);
480     OSSL_CMP_MSG_free(ir_unprotected);
481
482 }
483
484 int setup_tests(void)
485 {
486     char *server_f;
487     char *server_key_f;
488     char *server_cert_f;
489     char *endentity1_f;
490     char *endentity2_f;
491     char *root_f;
492     char *intermediate_f;
493
494     if (!test_skip_common_options()) {
495         TEST_error("Error parsing test options\n");
496         return 0;
497     }
498
499     RAND_bytes(rand_data, OSSL_CMP_TRANSACTIONID_LENGTH);
500     if (!TEST_ptr(server_f = test_get_argument(0))
501             || !TEST_ptr(ir_protected_f = test_get_argument(1))
502             || !TEST_ptr(ir_unprotected_f = test_get_argument(2))
503             || !TEST_ptr(ip_PBM_f = test_get_argument(3))
504             || !TEST_ptr(server_cert_f = test_get_argument(4))
505             || !TEST_ptr(server_key_f = test_get_argument(5))
506             || !TEST_ptr(endentity1_f = test_get_argument(6))
507             || !TEST_ptr(endentity2_f = test_get_argument(7))
508             || !TEST_ptr(root_f = test_get_argument(8))
509             || !TEST_ptr(intermediate_f = test_get_argument(9))) {
510         TEST_error("usage: cmp_protect_test server.pem "
511                    "IR_protected.der IR_unprotected.der IP_PBM.der "
512                    "server.crt server.pem"
513                    "EndEntity1.crt EndEntity2.crt "
514                    "Root_CA.crt Intermediate_CA.crt\n");
515         return 0;
516     }
517     if (!TEST_ptr(loadedkey = load_pem_key(server_key_f))
518             || !TEST_ptr(cert = load_pem_cert(server_cert_f)))
519         return 0;
520
521     if (!TEST_ptr(loadedprivkey = load_pem_key(server_f)))
522         return 0;
523     if (TEST_true(EVP_PKEY_up_ref(loadedprivkey)))
524         loadedpubkey = loadedprivkey;
525     if (!TEST_ptr(ir_protected = load_pkimsg(ir_protected_f))
526             || !TEST_ptr(ir_unprotected = load_pkimsg(ir_unprotected_f)))
527         return 0;
528     if (!TEST_ptr(endentity1 = load_pem_cert(endentity1_f))
529             || !TEST_ptr(endentity2 = load_pem_cert(endentity2_f))
530             || !TEST_ptr(root = load_pem_cert(root_f))
531             || !TEST_ptr(intermediate = load_pem_cert(intermediate_f)))
532         return 0;
533     if (!TEST_int_eq(1, RAND_bytes(rand_data, OSSL_CMP_TRANSACTIONID_LENGTH)))
534         return 0;
535
536     /* Message protection tests */
537     ADD_TEST(test_cmp_calc_protection_no_key_no_secret);
538     ADD_TEST(test_cmp_calc_protection_pkey);
539     ADD_TEST(test_cmp_calc_protection_pbmac);
540
541     ADD_TEST(test_MSG_protect_with_msg_sig_alg_protection_plus_rsa_key);
542     ADD_TEST(test_MSG_protect_with_certificate_and_key);
543     ADD_TEST(test_MSG_protect_certificate_based_without_cert);
544     ADD_TEST(test_MSG_protect_unprotected_request);
545     ADD_TEST(test_MSG_protect_no_key_no_secret);
546     ADD_TEST(test_MSG_protect_pbmac_no_sender_with_ref);
547     ADD_TEST(test_MSG_protect_pbmac_no_sender_no_ref);
548     ADD_TEST(test_MSG_add_extraCerts);
549
550 #ifndef OPENSSL_NO_EC
551     ADD_TEST(test_cmp_build_cert_chain);
552     ADD_TEST(test_cmp_build_cert_chain_missing_root);
553     ADD_TEST(test_cmp_build_cert_chain_missing_intermediate);
554     ADD_TEST(test_cmp_build_cert_chain_no_certs);
555 #endif
556
557     ADD_TEST(test_X509_STORE);
558     ADD_TEST(test_X509_STORE_only_self_issued);
559
560     return 1;
561 }