diffie-hellman: Add enum names that match proposal keywords
[strongswan.git] / src / libstrongswan / tests / suites / test_proposal.c
1 /*
2 * Copyright (C) 2016-2018 Tobias Brunner
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include "test_suite.h"
17
18 #include <crypto/proposal/proposal.h>
19
20 START_TEST(test_dh_group_mapping)
21 {
22 enum_name_t *e = diffie_hellman_group_names_short;
23 diffie_hellman_group_t group;
24 const proposal_token_t *token;
25 char *name;
26
27 do
28 {
29 for (group = e->first; group <= e->last; group++)
30 {
31 if (group == MODP_CUSTOM)
32 { /* can't be configured */
33 continue;
34 }
35 name = e->names[group - e->first];
36 token = lib->proposal->get_token(lib->proposal, name);
37 ck_assert_msg(token, "%s can't be mapped", name);
38 ck_assert_int_eq(token->type, DIFFIE_HELLMAN_GROUP);
39 ck_assert_int_eq(token->algorithm, group);
40 }
41 }
42 while ((e = e->next));
43 }
44 END_TEST
45
46 static struct {
47 protocol_id_t proto;
48 char *proposal;
49 char *expected;
50 } create_data[] = {
51 { PROTO_IKE, "", NULL },
52 { PROTO_IKE, "sha256", NULL },
53 { PROTO_IKE, "sha256-modp3072", NULL },
54 { PROTO_IKE, "null-sha256-modp3072", "IKE:NULL/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/MODP_3072" },
55 { PROTO_IKE, "aes128", NULL },
56 { PROTO_IKE, "aes128-sha256", NULL },
57 { PROTO_IKE, "aes128-sha256-modpnone", NULL },
58 { PROTO_IKE, "aes128-prfsha256", NULL },
59 { PROTO_IKE, "aes128-prfsha256-modp2048", NULL },
60 { PROTO_IKE, "aes128-sha256-modp3072", "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/MODP_3072" },
61 { PROTO_IKE, "aes128-sha256-prfsha384-modp3072", "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_384/MODP_3072" },
62 { PROTO_IKE, "aes128gcm16-modp3072", NULL },
63 { PROTO_IKE, "aes128gcm16-prfsha256-modp3072", "IKE:AES_GCM_16_128/PRF_HMAC_SHA2_256/MODP_3072" },
64 { PROTO_IKE, "aes128gcm16-sha256-modp3072", "IKE:AES_GCM_16_128/PRF_HMAC_SHA2_256/MODP_3072" },
65 { PROTO_IKE, "aes128gcm16-aes128-modp3072", NULL },
66 { PROTO_IKE, "aes128gcm16-aes128-sha256-modp3072", NULL },
67 { PROTO_ESP, "", NULL },
68 { PROTO_ESP, "sha256", NULL },
69 { PROTO_ESP, "aes128-sha256", "ESP:AES_CBC_128/HMAC_SHA2_256_128/NO_EXT_SEQ" },
70 { PROTO_ESP, "aes128-sha256-esn", "ESP:AES_CBC_128/HMAC_SHA2_256_128/EXT_SEQ" },
71 { PROTO_ESP, "aes128-sha256-noesn", "ESP:AES_CBC_128/HMAC_SHA2_256_128/NO_EXT_SEQ" },
72 { PROTO_ESP, "aes128-sha256-esn-noesn", "ESP:AES_CBC_128/HMAC_SHA2_256_128/EXT_SEQ/NO_EXT_SEQ" },
73 { PROTO_ESP, "aes128-sha256-prfsha256-modp3072", "ESP:AES_CBC_128/HMAC_SHA2_256_128/MODP_3072/NO_EXT_SEQ" },
74 { PROTO_ESP, "aes128gcm16-aes128-sha256-modp3072", NULL },
75 { PROTO_ESP, "aes128gmac", "ESP:NULL_AES_GMAC_128/NO_EXT_SEQ" },
76 { PROTO_AH, "", NULL },
77 { PROTO_AH, "aes128", NULL },
78 { PROTO_AH, "aes128-sha256", "AH:HMAC_SHA2_256_128/NO_EXT_SEQ" },
79 { PROTO_AH, "sha256-sha1", "AH:HMAC_SHA2_256_128/HMAC_SHA1_96/NO_EXT_SEQ" },
80 { PROTO_AH, "aes128gmac-sha256", "AH:AES_128_GMAC/HMAC_SHA2_256_128/NO_EXT_SEQ" },
81 { PROTO_AH, "aes128gmac-sha256-prfsha256", "AH:AES_128_GMAC/HMAC_SHA2_256_128/NO_EXT_SEQ" },
82 { PROTO_AH, "aes128gmac-aes256gmac-aes128-sha256", "AH:AES_128_GMAC/AES_256_GMAC/HMAC_SHA2_256_128/NO_EXT_SEQ" },
83 { PROTO_AH, "sha256-esn", "AH:HMAC_SHA2_256_128/EXT_SEQ" },
84 { PROTO_AH, "sha256-noesn", "AH:HMAC_SHA2_256_128/NO_EXT_SEQ" },
85 { PROTO_AH, "sha256-esn-noesn", "AH:HMAC_SHA2_256_128/EXT_SEQ/NO_EXT_SEQ" },
86 };
87
88 static void assert_proposal_eq(proposal_t *proposal, char *expected)
89 {
90 char str[BUF_LEN];
91
92 if (!expected)
93 {
94 ck_assert(!proposal);
95 return;
96 }
97 snprintf(str, sizeof(str), "%P", proposal);
98 ck_assert_str_eq(expected, str);
99 }
100
101 START_TEST(test_create_from_string)
102 {
103 proposal_t *proposal;
104
105 proposal = proposal_create_from_string(create_data[_i].proto,
106 create_data[_i].proposal);
107 assert_proposal_eq(proposal, create_data[_i].expected);
108 DESTROY_IF(proposal);
109 }
110 END_TEST
111
112 static struct {
113 protocol_id_t proto;
114 char *self;
115 char *other;
116 char *expected;
117 proposal_selection_flag_t flags;
118 } select_data[] = {
119 { PROTO_ESP, "aes128", "aes128", "aes128" },
120 { PROTO_ESP, "aes128", "aes256", NULL },
121 { PROTO_ESP, "aes128-aes256", "aes256-aes128", "aes128" },
122 { PROTO_ESP, "aes256-aes128", "aes128-aes256", "aes256" },
123 { PROTO_ESP, "aes128-aes256-sha1-sha256", "aes256-aes128-sha256-sha1", "aes128-sha1" },
124 { PROTO_ESP, "aes256-aes128-sha256-sha1", "aes128-aes256-sha1-sha256", "aes256-sha256" },
125 { PROTO_ESP, "aes128-sha256-modp3072", "aes128-sha256", NULL },
126 { PROTO_ESP, "aes128-sha256-modp3072", "aes128-sha256", "aes128-sha256", PROPOSAL_SKIP_DH },
127 { PROTO_ESP, "aes128-sha256", "aes128-sha256-modp3072", NULL },
128 { PROTO_ESP, "aes128-sha256", "aes128-sha256-modp3072", "aes128-sha256", PROPOSAL_SKIP_DH },
129 { PROTO_ESP, "aes128-sha256-modp3072", "aes128-sha256-modp3072", "aes128-sha256", PROPOSAL_SKIP_DH },
130 { PROTO_ESP, "aes128-sha256-modp3072", "aes128-sha256-ecp256", "aes128-sha256", PROPOSAL_SKIP_DH },
131 { PROTO_ESP, "aes128-sha256-modp3072", "aes128-sha256-modpnone", NULL },
132 { PROTO_ESP, "aes128-sha256-modpnone", "aes128-sha256-modp3072", NULL },
133 { PROTO_ESP, "aes128-sha256-modp3072-modpnone", "aes128-sha256", "aes128-sha256" },
134 { PROTO_ESP, "aes128-sha256", "aes128-sha256-modp3072-modpnone", "aes128-sha256" },
135 { PROTO_ESP, "aes128-sha256-modp3072-modpnone", "aes128-sha256-modpnone-modp3072", "aes128-sha256-modp3072" },
136 { PROTO_ESP, "aes128-sha256-modpnone-modp3072", "aes128-sha256-modp3072-modpnone", "aes128-sha256" },
137 { PROTO_ESP, "aes128-sha256-esn", "aes128-sha256-esn", "aes128-sha256-esn" },
138 { PROTO_ESP, "aes128-sha256-noesn", "aes128-sha256-esn", NULL },
139 { PROTO_ESP, "aes128-sha256-noesn-esn", "aes128-sha256-esn", "aes128-sha256-esn" },
140 { PROTO_ESP, "aes128-sha256-noesn-esn", "aes128-sha256", "aes128-sha256" },
141 { PROTO_ESP, "aes128-sha256-esn-noesn", "aes128-sha256-noesn-esn", "aes128-sha256-esn" },
142 { PROTO_IKE, "aes128-sha256-modp3072", "aes128-sha256-modp3072", "aes128-sha256-modp3072" },
143 { PROTO_IKE, "aes128-sha256-modp3072", "aes128-sha256-modp3072-modpnone", "aes128-sha256-modp3072" },
144 { PROTO_IKE, "aes128-sha256-modp3072-modpnone", "aes128-sha256-modp3072", "aes128-sha256-modp3072" },
145 };
146
147 START_TEST(test_select)
148 {
149 proposal_t *self, *other, *selected, *expected;
150
151 self = proposal_create_from_string(select_data[_i].proto,
152 select_data[_i].self);
153 other = proposal_create_from_string(select_data[_i].proto,
154 select_data[_i].other);
155 selected = self->select(self, other, select_data[_i].flags);
156 if (select_data[_i].expected)
157 {
158 expected = proposal_create_from_string(select_data[_i].proto,
159 select_data[_i].expected);
160 ck_assert(selected);
161 ck_assert_msg(expected->equals(expected, selected), "proposal %P does "
162 "not match expected %P", selected, expected);
163 expected->destroy(expected);
164 }
165 else
166 {
167 ck_assert(!selected);
168 }
169 DESTROY_IF(selected);
170 other->destroy(other);
171 self->destroy(self);
172 }
173 END_TEST
174
175 START_TEST(test_select_spi)
176 {
177 proposal_t *self, *other, *selected;
178
179 self = proposal_create_from_string(PROTO_ESP, "aes128-sha256-modp3072");
180 other = proposal_create_from_string(PROTO_ESP, "aes128-sha256-modp3072");
181 other->set_spi(other, 0x12345678);
182
183 selected = self->select(self, other, 0);
184 ck_assert(selected);
185 ck_assert_int_eq(selected->get_spi(selected), other->get_spi(other));
186 selected->destroy(selected);
187
188 selected = self->select(self, other, PROPOSAL_PREFER_SUPPLIED);
189 ck_assert(selected);
190 ck_assert_int_eq(selected->get_spi(selected), self->get_spi(self));
191 selected->destroy(selected);
192
193 other->destroy(other);
194 self->destroy(self);
195 }
196 END_TEST
197
198 START_TEST(test_matches)
199 {
200 proposal_t *self, *other;
201
202 self = proposal_create_from_string(select_data[_i].proto,
203 select_data[_i].self);
204 other = proposal_create_from_string(select_data[_i].proto,
205 select_data[_i].other);
206 if (select_data[_i].expected)
207 {
208 ck_assert(self->matches(self, other, select_data[_i].flags));
209 ck_assert(other->matches(other, self, select_data[_i].flags));
210 ck_assert(self->matches(self, other,
211 select_data[_i].flags | PROPOSAL_PREFER_SUPPLIED));
212 ck_assert(other->matches(other, self,
213 select_data[_i].flags | PROPOSAL_PREFER_SUPPLIED));
214 }
215 else
216 {
217 ck_assert(!self->matches(self, other, select_data[_i].flags));
218 ck_assert(!other->matches(other, self, select_data[_i].flags));
219 ck_assert(!self->matches(self, other,
220 select_data[_i].flags | PROPOSAL_PREFER_SUPPLIED));
221 ck_assert(!other->matches(other, self,
222 select_data[_i].flags | PROPOSAL_PREFER_SUPPLIED));
223 }
224 other->destroy(other);
225 self->destroy(self);
226 }
227 END_TEST
228
229 static struct {
230 protocol_id_t proto;
231 char *self[5];
232 char *other[5];
233 char *expected;
234 proposal_selection_flag_t flags;
235 } select_proposal_data[] = {
236 { PROTO_ESP, {}, {}, NULL },
237 { PROTO_ESP, { "aes128" }, {}, NULL },
238 { PROTO_ESP, {}, { "aes128" }, NULL },
239 { PROTO_ESP, { "aes128" }, { "aes256" }, NULL },
240 { PROTO_ESP, { "aes128" }, { "aes128" }, "aes128" },
241 { PROTO_ESP, { "aes128", "aes256" }, { "aes256", "aes128" }, "aes128" },
242 { PROTO_ESP, { "aes128", "aes256" }, { "aes256", "aes128" }, "aes256",
243 PROPOSAL_PREFER_SUPPLIED },
244 { PROTO_ESP, { "aes128-modp1024", "aes256-modp1024" },
245 { "aes256-modp2048", "aes128-modp2048" }, NULL },
246 { PROTO_ESP, { "aes128-modp1024", "aes256-modp1024" },
247 { "aes256-modp2048", "aes128-modp2048" }, "aes128",
248 PROPOSAL_SKIP_DH },
249 { PROTO_ESP, { "aes128-modp1024", "aes256-modp1024" },
250 { "aes256-modp2048", "aes128-modp2048" }, "aes256",
251 PROPOSAL_PREFER_SUPPLIED | PROPOSAL_SKIP_DH },
252 };
253
254 START_TEST(test_select_proposal)
255 {
256 linked_list_t *self, *other;
257 proposal_t *proposal, *selected, *expected;
258 int i;
259
260 self = linked_list_create();
261 other = linked_list_create();
262
263 for (i = 0; i < countof(select_proposal_data[_i].self); i++)
264 {
265 if (!select_proposal_data[_i].self[i])
266 {
267 break;
268 }
269 proposal = proposal_create_from_string(select_proposal_data[_i].proto,
270 select_proposal_data[_i].self[i]);
271 self->insert_last(self, proposal);
272 }
273 for (i = 0; i < countof(select_proposal_data[_i].other); i++)
274 {
275 if (!select_proposal_data[_i].other[i])
276 {
277 break;
278 }
279 proposal = proposal_create_from_string(select_proposal_data[_i].proto,
280 select_proposal_data[_i].other[i]);
281 other->insert_last(other, proposal);
282 }
283 selected = proposal_select(self, other, select_proposal_data[_i].flags);
284 if (select_proposal_data[_i].expected)
285 {
286 expected = proposal_create_from_string(select_proposal_data[_i].proto,
287 select_proposal_data[_i].expected);
288 ck_assert(selected);
289 ck_assert_msg(expected->equals(expected, selected), "proposal %P does "
290 "not match expected %P", selected, expected);
291 expected->destroy(expected);
292 }
293 else
294 {
295 ck_assert(!selected);
296 }
297 DESTROY_IF(selected);
298 other->destroy_offset(other, offsetof(proposal_t, destroy));
299 self->destroy_offset(self, offsetof(proposal_t, destroy));
300 }
301 END_TEST
302
303 START_TEST(test_promote_dh_group)
304 {
305 proposal_t *proposal;
306
307 proposal = proposal_create_from_string(PROTO_IKE,
308 "aes128-sha256-modp3072-ecp256");
309 ck_assert(proposal->promote_dh_group(proposal, ECP_256_BIT));
310 assert_proposal_eq(proposal, "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/ECP_256/MODP_3072");
311 proposal->destroy(proposal);
312 }
313 END_TEST
314
315 START_TEST(test_promote_dh_group_already_front)
316 {
317 proposal_t *proposal;
318
319 proposal = proposal_create_from_string(PROTO_IKE,
320 "aes128-sha256-modp3072-ecp256");
321 ck_assert(proposal->promote_dh_group(proposal, MODP_3072_BIT));
322 assert_proposal_eq(proposal, "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/MODP_3072/ECP_256");
323 proposal->destroy(proposal);
324 }
325 END_TEST
326
327 START_TEST(test_promote_dh_group_not_contained)
328 {
329 proposal_t *proposal;
330
331 proposal = proposal_create_from_string(PROTO_IKE,
332 "aes128-sha256-modp3072-ecp256");
333
334 ck_assert(!proposal->promote_dh_group(proposal, MODP_2048_BIT));
335 assert_proposal_eq(proposal, "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/MODP_3072/ECP_256");
336 proposal->destroy(proposal);
337 }
338 END_TEST
339
340 START_TEST(test_unknown_transform_types_print)
341 {
342 proposal_t *proposal;
343
344 proposal = proposal_create(PROTO_IKE, 0);
345 proposal->add_algorithm(proposal, 242, 42, 128);
346 assert_proposal_eq(proposal, "IKE:UNKNOWN_242_42_128");
347 proposal->destroy(proposal);
348
349 proposal = proposal_create_from_string(PROTO_IKE,
350 "aes128-sha256-ecp256");
351 proposal->add_algorithm(proposal, 242, 42, 128);
352 proposal->add_algorithm(proposal, 243, 1, 0);
353 assert_proposal_eq(proposal, "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/ECP_256/UNKNOWN_242_42_128/UNKNOWN_243_1");
354 proposal->destroy(proposal);
355 }
356 END_TEST
357
358 START_TEST(test_unknown_transform_types_equals)
359 {
360 proposal_t *self, *other;
361
362 self = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
363 other = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
364 other->add_algorithm(other, 242, 42, 0);
365 ck_assert(!self->equals(self, other));
366 ck_assert(!other->equals(other, self));
367 self->add_algorithm(self, 242, 42, 0);
368 ck_assert(self->equals(self, other));
369 ck_assert(other->equals(other, self));
370 other->destroy(other);
371 self->destroy(self);
372 }
373 END_TEST
374
375 START_TEST(test_unknown_transform_types_select_fail)
376 {
377 proposal_t *self, *other, *selected;
378
379 self = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
380 other = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
381 other->add_algorithm(other, 242, 42, 0);
382
383 selected = self->select(self, other, 0);
384 ck_assert(!selected);
385 other->destroy(other);
386 self->destroy(self);
387 }
388 END_TEST
389
390 START_TEST(test_unknown_transform_types_select_fail_subtype)
391 {
392 proposal_t *self, *other, *selected;
393
394 self = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
395 self->add_algorithm(self, 242, 8, 0);
396 other = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
397 other->add_algorithm(other, 242, 42, 0);
398
399 selected = self->select(self, other, 0);
400 ck_assert(!selected);
401 other->destroy(other);
402 self->destroy(self);
403 }
404 END_TEST
405
406 START_TEST(test_unknown_transform_types_select_success)
407 {
408 proposal_t *self, *other, *selected;
409
410 self = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
411 self->add_algorithm(self, 242, 42, 128);
412 other = proposal_create_from_string(PROTO_IKE, "aes128-sha256-ecp256");
413 other->add_algorithm(other, 242, 42, 128);
414 other->add_algorithm(other, 242, 1, 0);
415
416 selected = self->select(self, other, 0);
417 ck_assert(selected);
418 assert_proposal_eq(selected, "IKE:AES_CBC_128/HMAC_SHA2_256_128/PRF_HMAC_SHA2_256/ECP_256/UNKNOWN_242_42_128");
419 selected->destroy(selected);
420 other->destroy(other);
421 self->destroy(self);
422 }
423 END_TEST
424
425 START_TEST(test_chacha20_poly1305_key_length)
426 {
427 proposal_t *proposal;
428 uint16_t alg, ks;
429
430 proposal = proposal_create_from_string(PROTO_IKE, "chacha20poly1305-prfsha256-ecp256");
431 proposal->get_algorithm(proposal, ENCRYPTION_ALGORITHM, &alg, &ks);
432 ck_assert_int_eq(alg, ENCR_CHACHA20_POLY1305);
433 ck_assert_int_eq(ks, 0);
434 assert_proposal_eq(proposal, "IKE:CHACHA20_POLY1305/PRF_HMAC_SHA2_256/ECP_256");
435 proposal->destroy(proposal);
436 }
437 END_TEST
438
439 static struct {
440 protocol_id_t proto;
441 char *orig;
442 char *expected;
443 proposal_selection_flag_t flags;
444 } clone_data[] = {
445 { PROTO_ESP, "aes128", "aes128" },
446 { PROTO_ESP, "aes128-serpent", "aes128-serpent" },
447 { PROTO_ESP, "aes128-serpent", "aes128", PROPOSAL_SKIP_PRIVATE },
448 { PROTO_ESP, "aes128-sha256-modp3072", "aes128-sha256-modp3072" },
449 { PROTO_ESP, "aes128-sha256-modp3072", "aes128-sha256", PROPOSAL_SKIP_DH },
450 { PROTO_ESP, "aes128-serpent-modp3072", "aes128-serpent",
451 PROPOSAL_SKIP_DH },
452 { PROTO_ESP, "aes128-serpent-modp3072", "aes128",
453 PROPOSAL_SKIP_PRIVATE | PROPOSAL_SKIP_DH },
454 };
455
456 START_TEST(test_clone)
457 {
458 proposal_t *orig, *result, *expected;
459
460 orig = proposal_create_from_string(clone_data[_i].proto,
461 clone_data[_i].orig);
462 orig->set_spi(orig, 0x12345678);
463
464 result = orig->clone(orig, clone_data[_i].flags);
465
466 expected = proposal_create_from_string(clone_data[_i].proto,
467 clone_data[_i].expected);
468 ck_assert_msg(expected->equals(expected, result), "proposal %P does "
469 "not match expected %P", result, expected);
470 ck_assert_int_eq(orig->get_spi(orig), result->get_spi(result));
471
472 expected->destroy(expected);
473 result->destroy(result);
474 orig->destroy(orig);
475 }
476 END_TEST
477
478 Suite *proposal_suite_create()
479 {
480 Suite *s;
481 TCase *tc;
482
483 s = suite_create("proposal");
484
485 tc = tcase_create("proposal keywords");
486 tcase_add_test(tc, test_dh_group_mapping);
487 suite_add_tcase(s, tc);
488
489 tc = tcase_create("create_from_string");
490 tcase_add_loop_test(tc, test_create_from_string, 0, countof(create_data));
491 suite_add_tcase(s, tc);
492
493 tc = tcase_create("select");
494 tcase_add_loop_test(tc, test_select, 0, countof(select_data));
495 tcase_add_test(tc, test_select_spi);
496 suite_add_tcase(s, tc);
497
498 tc = tcase_create("matches");
499 tcase_add_loop_test(tc, test_matches, 0, countof(select_data));
500 suite_add_tcase(s, tc);
501
502 tc = tcase_create("select_proposal");
503 tcase_add_loop_test(tc, test_select_proposal, 0,
504 countof(select_proposal_data));
505 suite_add_tcase(s, tc);
506
507 tc = tcase_create("promote_dh_group");
508 tcase_add_test(tc, test_promote_dh_group);
509 tcase_add_test(tc, test_promote_dh_group_already_front);
510 tcase_add_test(tc, test_promote_dh_group_not_contained);
511 suite_add_tcase(s, tc);
512
513 tc = tcase_create("unknown transform types");
514 tcase_add_test(tc, test_unknown_transform_types_print);
515 tcase_add_test(tc, test_unknown_transform_types_equals);
516 tcase_add_test(tc, test_unknown_transform_types_select_fail);
517 tcase_add_test(tc, test_unknown_transform_types_select_fail_subtype);
518 tcase_add_test(tc, test_unknown_transform_types_select_success);
519 suite_add_tcase(s, tc);
520
521 tc = tcase_create("chacha20/poly1305");
522 tcase_add_test(tc, test_chacha20_poly1305_key_length);
523 suite_add_tcase(s, tc);
524
525 tc = tcase_create("clone");
526 tcase_add_loop_test(tc, test_clone, 0, countof(clone_data));
527 suite_add_tcase(s, tc);
528
529 return s;
530 }