Skip tests using KTLS RX for TLS 1.3.
[openssl.git] / test / cmp_protect_test.c
1 /*
2  * Copyright 2007-2020 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 DEFINE_STACK_OF(X509)
15
16 static const char *ir_protected_f;
17 static const char *ir_unprotected_f;
18 static const char *ip_PBM_f;
19
20 typedef struct test_fixture {
21     const char *test_case_name;
22     OSSL_CMP_CTX *cmp_ctx;
23     /* for protection tests */
24     OSSL_CMP_MSG *msg;
25     OSSL_CMP_PKISI *si; /* for error and response messages */
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 OPENSSL_CTX *libctx = NULL;
37 static OSSL_PROVIDER *default_null_provider = NULL, *provider = NULL;
38
39 static void tear_down(CMP_PROTECT_TEST_FIXTURE *fixture)
40 {
41     OSSL_CMP_CTX_free(fixture->cmp_ctx);
42     OSSL_CMP_MSG_free(fixture->msg);
43     OSSL_CMP_PKISI_free(fixture->si);
44
45     OPENSSL_free(fixture->mem);
46     sk_X509_free(fixture->certs);
47     sk_X509_free(fixture->chain);
48
49     OPENSSL_free(fixture);
50 }
51
52 static CMP_PROTECT_TEST_FIXTURE *set_up(const char *const test_case_name)
53 {
54     CMP_PROTECT_TEST_FIXTURE *fixture;
55
56     if (!TEST_ptr(fixture = OPENSSL_zalloc(sizeof(*fixture))))
57         return NULL;
58     fixture->test_case_name = test_case_name;
59     if (!TEST_ptr(fixture->cmp_ctx = OSSL_CMP_CTX_new(libctx, NULL))) {
60         tear_down(fixture);
61         return NULL;
62     }
63     return fixture;
64 }
65
66 static EVP_PKEY *loadedprivkey = NULL;
67 static EVP_PKEY *loadedpubkey = NULL;
68 static EVP_PKEY *loadedkey = NULL;
69 static X509 *cert = NULL;
70 static unsigned char rand_data[OSSL_CMP_TRANSACTIONID_LENGTH];
71 static OSSL_CMP_MSG *ir_unprotected, *ir_protected;
72 static X509 *endentity1 = NULL, *endentity2 = NULL,
73     *root = NULL, *intermediate = NULL;
74
75 static int execute_calc_protection_fails_test(CMP_PROTECT_TEST_FIXTURE *fixture)
76 {
77     ASN1_BIT_STRING *protection =
78         ossl_cmp_calc_protection(fixture->cmp_ctx, fixture->msg);
79     int res = TEST_ptr_null(protection);
80
81     ASN1_BIT_STRING_free(protection);
82     return res;
83 }
84
85 static int execute_calc_protection_pbmac_test(CMP_PROTECT_TEST_FIXTURE *fixture)
86 {
87     ASN1_BIT_STRING *protection =
88         ossl_cmp_calc_protection(fixture->cmp_ctx, fixture->msg);
89     int res = TEST_ptr(protection)
90             && TEST_true(ASN1_STRING_cmp(protection,
91                                          fixture->msg->protection) == 0);
92
93     ASN1_BIT_STRING_free(protection);
94     return res;
95 }
96
97 /*
98  * This function works similarly to parts of CMP_verify_signature in cmp_vfy.c,
99  * but without the need for a OSSL_CMP_CTX or a X509 certificate
100  */
101 static int verify_signature(OSSL_CMP_MSG *msg,
102                             ASN1_BIT_STRING *protection,
103                             EVP_PKEY *pkey, EVP_MD *digest)
104 {
105     OSSL_CMP_PROTECTEDPART prot_part;
106     unsigned char *prot_part_der = NULL;
107     int len;
108     EVP_MD_CTX *ctx = NULL;
109     int res;
110
111     prot_part.header = OSSL_CMP_MSG_get0_header(msg);
112     prot_part.body = msg->body;
113     len = i2d_OSSL_CMP_PROTECTEDPART(&prot_part, &prot_part_der);
114     res =
115         TEST_int_ge(len, 0)
116         && TEST_ptr(ctx = EVP_MD_CTX_new())
117         && TEST_true(EVP_DigestVerifyInit(ctx, NULL, digest, NULL, pkey))
118         && TEST_int_eq(EVP_DigestVerify(ctx, protection->data,
119                                         protection->length,
120                                         prot_part_der, len), 1);
121     /* cleanup */
122     EVP_MD_CTX_free(ctx);
123     OPENSSL_free(prot_part_der);
124     return res;
125 }
126
127 /* Calls OSSL_CMP_calc_protection and compares and verifies signature */
128 static int execute_calc_protection_signature_test(CMP_PROTECT_TEST_FIXTURE *
129                                                   fixture)
130 {
131     ASN1_BIT_STRING *protection =
132         ossl_cmp_calc_protection(fixture->cmp_ctx, fixture->msg);
133     int ret = (TEST_ptr(protection)
134                    && TEST_true(ASN1_STRING_cmp(protection,
135                                                 fixture->msg->protection) == 0)
136                    && TEST_true(verify_signature(fixture->msg, protection,
137                                                  fixture->pubkey,
138                                                  fixture->cmp_ctx->digest)));
139
140     ASN1_BIT_STRING_free(protection);
141     return ret;
142 }
143
144 static int test_cmp_calc_protection_no_key_no_secret(void)
145 {
146     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
147     if (!TEST_ptr(fixture->msg = load_pkimsg(ir_unprotected_f))
148             || !TEST_ptr(fixture->msg->header->protectionAlg =
149                          X509_ALGOR_new() /* no specific alg needed here */)) {
150         tear_down(fixture);
151         fixture = NULL;
152     }
153
154     EXECUTE_TEST(execute_calc_protection_fails_test, tear_down);
155     return result;
156 }
157
158 static int test_cmp_calc_protection_pkey(void)
159 {
160     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
161     fixture->pubkey = loadedpubkey;
162     if (!TEST_true(OSSL_CMP_CTX_set1_pkey(fixture->cmp_ctx, loadedprivkey))
163             || !TEST_ptr(fixture->msg = load_pkimsg(ir_protected_f))) {
164         tear_down(fixture);
165         fixture = NULL;
166     }
167     EXECUTE_TEST(execute_calc_protection_signature_test, tear_down);
168     return result;
169 }
170
171 static int test_cmp_calc_protection_pbmac(void)
172 {
173     unsigned char sec_insta[] = { 'i', 'n', 's', 't', 'a' };
174
175     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
176     if (!TEST_true(OSSL_CMP_CTX_set1_secretValue(fixture->cmp_ctx,
177                                                  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 = OSSL_CMP_MSG_dup(ir_unprotected))
215             || !TEST_true(SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 0))
216             /*
217              * Use half of the 16 bytes of random input
218              * for each reference and secret value
219              */
220             || !TEST_true(OSSL_CMP_CTX_set1_referenceValue(fixture->cmp_ctx,
221                                                            rand_data, size))
222             || !TEST_true(OSSL_CMP_CTX_set1_secretValue(fixture->cmp_ctx,
223                                                         rand_data + size,
224                                                         size))) {
225         tear_down(fixture);
226         fixture = NULL;
227     }
228     EXECUTE_TEST(execute_MSG_protect_test, tear_down);
229     return result;
230 }
231
232 static int test_MSG_protect_with_certificate_and_key(void)
233 {
234     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
235     fixture->expected = 1;
236
237     if (!TEST_ptr(fixture->msg =
238                   OSSL_CMP_MSG_dup(ir_unprotected))
239             || !TEST_true(SET_OPT_UNPROTECTED_SEND(fixture->cmp_ctx, 0))
240             || !TEST_true(OSSL_CMP_CTX_set1_pkey(fixture->cmp_ctx, loadedkey))
241             || !TEST_true(OSSL_CMP_CTX_set1_cert(fixture->cmp_ctx, cert))) {
242         tear_down(fixture);
243         fixture = NULL;
244     }
245     EXECUTE_TEST(execute_MSG_protect_test, tear_down);
246     return result;
247 }
248
249 static int test_MSG_protect_certificate_based_without_cert(void)
250 {
251     OSSL_CMP_CTX *ctx;
252
253     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
254     ctx = fixture->cmp_ctx;
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     int ret = 0;
335     OSSL_CMP_CTX *ctx = fixture->cmp_ctx;
336     STACK_OF(X509) *chain =
337         ossl_cmp_build_cert_chain(ctx->libctx, ctx->propq,
338                                   fixture->certs, fixture->cert);
339
340     if (TEST_ptr(chain)) {
341         /* Check whether chain built is equal to the expected one */
342         ret = TEST_int_eq(0, STACK_OF_X509_cmp(chain, fixture->chain));
343         sk_X509_pop_free(chain, X509_free);
344     }
345     return ret;
346 }
347
348 static int test_cmp_build_cert_chain(void)
349 {
350     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
351     fixture->cert = endentity2;
352     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
353             || !TEST_ptr(fixture->chain = sk_X509_new_null())
354             || !TEST_true(sk_X509_push(fixture->certs, endentity1))
355             || !TEST_true(sk_X509_push(fixture->certs, root))
356             || !TEST_true(sk_X509_push(fixture->certs, intermediate))
357             || !TEST_true(sk_X509_push(fixture->chain, endentity2))
358             || !TEST_true(sk_X509_push(fixture->chain, intermediate))) {
359         tear_down(fixture);
360         fixture = NULL;
361     }
362     EXECUTE_TEST(execute_cmp_build_cert_chain_test, tear_down);
363     return result;
364 }
365
366 static int test_cmp_build_cert_chain_missing_intermediate(void)
367 {
368     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
369     fixture->cert = endentity2;
370     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
371             || !TEST_ptr(fixture->chain = sk_X509_new_null())
372             || !TEST_true(sk_X509_push(fixture->certs, endentity1))
373             || !TEST_true(sk_X509_push(fixture->certs, root))
374             || !TEST_true(sk_X509_push(fixture->chain, endentity2))) {
375         tear_down(fixture);
376         fixture = NULL;
377     }
378     EXECUTE_TEST(execute_cmp_build_cert_chain_test, tear_down);
379     return result;
380 }
381
382 static int test_cmp_build_cert_chain_missing_root(void)
383 {
384     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
385     fixture->cert = endentity2;
386     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
387             || !TEST_ptr(fixture->chain = sk_X509_new_null())
388             || !TEST_true(sk_X509_push(fixture->certs, endentity1))
389             || !TEST_true(sk_X509_push(fixture->certs, intermediate))
390             || !TEST_true(sk_X509_push(fixture->chain, endentity2))
391             || !TEST_true(sk_X509_push(fixture->chain, intermediate))) {
392         tear_down(fixture);
393         fixture = NULL;
394     }
395     EXECUTE_TEST(execute_cmp_build_cert_chain_test, tear_down);
396     return result;
397 }
398
399 static int test_cmp_build_cert_chain_no_certs(void)
400 {
401     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
402     fixture->cert = endentity2;
403     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
404             || !TEST_ptr(fixture->chain = sk_X509_new_null())
405             || !TEST_true(sk_X509_push(fixture->chain, endentity2))) {
406         tear_down(fixture);
407         fixture = NULL;
408     }
409     EXECUTE_TEST(execute_cmp_build_cert_chain_test, tear_down);
410     return result;
411 }
412 #endif /* OPENSSL_NO_EC */
413
414 static int execute_X509_STORE_test(CMP_PROTECT_TEST_FIXTURE *fixture)
415 {
416     X509_STORE *store = X509_STORE_new();
417     STACK_OF(X509) *sk = NULL;
418     int res = 0;
419
420     if (!TEST_true(ossl_cmp_X509_STORE_add1_certs(store,
421                                                   fixture->certs,
422                                                   fixture->callback_arg)))
423         goto err;
424     sk = X509_STORE_get1_all_certs(store);
425     if (!TEST_int_eq(0, STACK_OF_X509_cmp(sk, fixture->chain)))
426         goto err;
427     res = 1;
428  err:
429     X509_STORE_free(store);
430     sk_X509_pop_free(sk, X509_free);
431     return res;
432
433 }
434
435 static int test_X509_STORE(void)
436 {
437     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
438     fixture->callback_arg = 0; /* self-issued allowed */
439     if (!TEST_ptr(fixture->certs = sk_X509_new_null())
440             || !sk_X509_push(fixture->certs, endentity1)
441             || !sk_X509_push(fixture->certs, endentity2)
442             || !sk_X509_push(fixture->certs, root)
443             || !sk_X509_push(fixture->certs, intermediate)
444             || !TEST_ptr(fixture->chain = sk_X509_dup(fixture->certs))) {
445         tear_down(fixture);
446         fixture = NULL;
447     }
448     EXECUTE_TEST(execute_X509_STORE_test, tear_down);
449     return result;
450 }
451
452 static int test_X509_STORE_only_self_issued(void)
453 {
454     SETUP_TEST_FIXTURE(CMP_PROTECT_TEST_FIXTURE, set_up);
455     fixture->certs = sk_X509_new_null();
456     fixture->chain = sk_X509_new_null();
457     fixture->callback_arg = 1; /* only self-issued */
458     if (!TEST_true(sk_X509_push(fixture->certs, endentity1))
459             || !TEST_true(sk_X509_push(fixture->certs, endentity2))
460             || !TEST_true(sk_X509_push(fixture->certs, root))
461             || !TEST_true(sk_X509_push(fixture->certs, intermediate))
462             || !TEST_true(sk_X509_push(fixture->chain, root))) {
463         tear_down(fixture);
464         fixture = NULL;
465     }
466     EXECUTE_TEST(execute_X509_STORE_test, tear_down);
467     return result;
468 }
469
470
471 void cleanup_tests(void)
472 {
473     EVP_PKEY_free(loadedprivkey);
474     EVP_PKEY_free(loadedpubkey);
475     EVP_PKEY_free(loadedkey);
476     X509_free(cert);
477     X509_free(endentity1);
478     X509_free(endentity2);
479     X509_free(root);
480     X509_free(intermediate);
481     OSSL_CMP_MSG_free(ir_protected);
482     OSSL_CMP_MSG_free(ir_unprotected);
483     OPENSSL_CTX_free(libctx);
484 }
485
486 #define USAGE "server.pem IR_protected.der IR_unprotected.der IP_PBM.der " \
487     "server.crt server.pem EndEntity1.crt EndEntity2.crt Root_CA.crt " \
488     "Intermediate_CA.crt module_name [module_conf_file]\n"
489 OPT_TEST_DECLARE_USAGE(USAGE)
490
491 int setup_tests(void)
492 {
493     char *server_f;
494     char *server_key_f;
495     char *server_cert_f;
496     char *endentity1_f;
497     char *endentity2_f;
498     char *root_f;
499     char *intermediate_f;
500
501     if (!test_skip_common_options()) {
502         TEST_error("Error parsing test options\n");
503         return 0;
504     }
505
506     RAND_bytes(rand_data, OSSL_CMP_TRANSACTIONID_LENGTH);
507     if (!TEST_ptr(server_f = test_get_argument(0))
508             || !TEST_ptr(ir_protected_f = test_get_argument(1))
509             || !TEST_ptr(ir_unprotected_f = test_get_argument(2))
510             || !TEST_ptr(ip_PBM_f = test_get_argument(3))
511             || !TEST_ptr(server_cert_f = test_get_argument(4))
512             || !TEST_ptr(server_key_f = test_get_argument(5))
513             || !TEST_ptr(endentity1_f = test_get_argument(6))
514             || !TEST_ptr(endentity2_f = test_get_argument(7))
515             || !TEST_ptr(root_f = test_get_argument(8))
516             || !TEST_ptr(intermediate_f = test_get_argument(9))) {
517         TEST_error("usage: cmp_protect_test %s", USAGE);
518         return 0;
519     }
520
521     if (!test_get_libctx(&libctx, &default_null_provider, &provider, 10, USAGE))
522         return 0;
523
524     if (!TEST_ptr(loadedkey = load_pem_key(server_key_f, libctx))
525             || !TEST_ptr(cert = load_pem_cert(server_cert_f, libctx)))
526         return 0;
527
528     if (!TEST_ptr(loadedprivkey = load_pem_key(server_f, libctx)))
529         return 0;
530     if (TEST_true(EVP_PKEY_up_ref(loadedprivkey)))
531         loadedpubkey = loadedprivkey;
532     if (!TEST_ptr(ir_protected = load_pkimsg(ir_protected_f))
533             || !TEST_ptr(ir_unprotected = load_pkimsg(ir_unprotected_f)))
534         return 0;
535     if (!TEST_ptr(endentity1 = load_pem_cert(endentity1_f, libctx))
536             || !TEST_ptr(endentity2 = load_pem_cert(endentity2_f, libctx))
537             || !TEST_ptr(root = load_pem_cert(root_f, libctx))
538             || !TEST_ptr(intermediate = load_pem_cert(intermediate_f, libctx)))
539         return 0;
540     if (!TEST_int_eq(1, RAND_bytes(rand_data, OSSL_CMP_TRANSACTIONID_LENGTH)))
541         return 0;
542
543     /* Message protection tests */
544     ADD_TEST(test_cmp_calc_protection_no_key_no_secret);
545     ADD_TEST(test_cmp_calc_protection_pkey);
546     ADD_TEST(test_cmp_calc_protection_pbmac);
547
548     ADD_TEST(test_MSG_protect_with_msg_sig_alg_protection_plus_rsa_key);
549     ADD_TEST(test_MSG_protect_with_certificate_and_key);
550     ADD_TEST(test_MSG_protect_certificate_based_without_cert);
551     ADD_TEST(test_MSG_protect_unprotected_request);
552     ADD_TEST(test_MSG_protect_no_key_no_secret);
553     ADD_TEST(test_MSG_protect_pbmac_no_sender_with_ref);
554     ADD_TEST(test_MSG_protect_pbmac_no_sender_no_ref);
555     ADD_TEST(test_MSG_add_extraCerts);
556
557 #ifndef OPENSSL_NO_EC
558     ADD_TEST(test_cmp_build_cert_chain);
559     ADD_TEST(test_cmp_build_cert_chain_missing_root);
560     ADD_TEST(test_cmp_build_cert_chain_missing_intermediate);
561     ADD_TEST(test_cmp_build_cert_chain_no_certs);
562 #endif
563
564     ADD_TEST(test_X509_STORE);
565     ADD_TEST(test_X509_STORE_only_self_issued);
566
567     return 1;
568 }