2 * Copyright (C) 2013 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 #include "test_suite.h"
19 #include <asn1/asn1.h>
21 #include <utils/chunk.h>
23 /*******************************************************************************
24 * algorithm_identifier
27 START_TEST(test_asn1_algorithmIdentifier
)
35 { OID_ECDSA_WITH_SHA1
, chunk_from_chars(0x30, 0x09, 0x06, 0x07,
36 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x01) },
37 { OID_SHA1_WITH_RSA
, chunk_from_chars(0x30, 0x0d, 0x06, 0x09,
38 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00) },
44 for (i
= 0; i
< countof(test
); i
++)
46 algid
= asn1_algorithmIdentifier(test
[i
].n
);
47 ck_assert(chunk_equals(algid
, test
[i
].algid
));
52 /*******************************************************************************
53 * parse_algorithm_identifier
56 START_TEST(test_asn1_parse_algorithmIdentifier
)
65 { OID_ECDSA_WITH_SHA1
, TRUE
, chunk_empty
},
66 { OID_SHA1_WITH_RSA
, TRUE
, chunk_from_chars(0x05, 0x00) },
67 { OID_3DES_EDE_CBC
, FALSE
, chunk_from_chars(0x04, 0x01, 0xaa) },
68 { OID_PBKDF2
, FALSE
, chunk_from_chars(0x30, 0x01, 0xaa) }
71 chunk_t algid
, parameters
;
74 for (i
= 0; i
< countof(test
); i
++)
76 algid
= asn1_wrap(ASN1_SEQUENCE
, "mc",
77 asn1_build_known_oid(test
[i
].alg
), test
[i
].parameters
);
78 parameters
= chunk_empty
;
81 alg
= asn1_parse_algorithmIdentifier(algid
, 0, NULL
);
85 alg
= asn1_parse_algorithmIdentifier(algid
, 0, ¶meters
);
88 ck_assert(parameters
.len
== 0 && parameters
.ptr
== NULL
);
92 ck_assert(chunk_equals(parameters
, test
[i
].parameters
));
95 ck_assert(alg
== test
[i
].alg
);
101 /*******************************************************************************
105 START_TEST(test_asn1_known_oid
)
112 testdata_t test
[] = {
113 { OID_UNKNOWN
, chunk_empty
},
114 { OID_UNKNOWN
, chunk_from_chars(0x55, 0x04, 0x02) },
115 { OID_COUNTRY
, chunk_from_chars(0x55, 0x04, 0x06) },
116 { OID_STRONGSWAN
, chunk_from_chars(0x2b, 0x06, 0x01, 0x04, 0x01,
117 0x82, 0xa0, 0x2a, 0x01) }
122 for (i
= 0; i
< countof(test
); i
++)
124 ck_assert(asn1_known_oid(test
[i
].oid
) == test
[i
].n
);
129 /*******************************************************************************
133 START_TEST(test_asn1_build_known_oid
)
140 testdata_t test
[] = {
141 { OID_UNKNOWN
, chunk_empty
},
142 { OID_MAX
, chunk_empty
},
143 { OID_COUNTRY
, chunk_from_chars(0x06, 0x03, 0x55, 0x04, 0x06) },
144 { OID_STRONGSWAN
, chunk_from_chars(0x06, 0x09, 0x2b, 0x06, 0x01, 0x04,
145 0x01, 0x82, 0xa0, 0x2a, 0x01) }
149 chunk_t oid
= chunk_empty
;
151 for (i
= 0; i
< countof(test
); i
++)
153 oid
= asn1_build_known_oid(test
[i
].n
);
154 if (test
[i
].oid
.len
== 0)
156 ck_assert(oid
.len
== 0 && oid
.ptr
== NULL
);
160 ck_assert(chunk_equals(oid
, test
[i
].oid
));
167 /*******************************************************************************
171 START_TEST(test_asn1_oid_from_string
)
178 testdata_t test
[] = {
180 { " ", chunk_empty
},
181 { "0.2.262.1", chunk_from_chars(
182 0x02, 0x82, 0x06, 0x01) },
183 { "1.2.840.10045.4.1", chunk_from_chars(
184 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x01) },
185 { "1.3.6.1.4.1.36906.1", chunk_from_chars(
186 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa0, 0x2a, 0x01) },
187 { "2.16.840.1.101.3.4.2.1", chunk_from_chars(
188 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01) },
189 { "0.10.100.1000.10000.100000.1000000.10000000.100000000.268435455",
190 chunk_from_chars(0x0a,0x64, 0x87, 0x68, 0xce, 0x10, 0x86, 0x8d,
191 0x20, 0xbd, 0x84, 0x40, 0x84, 0xe2, 0xad, 0x00,
192 0xaf, 0xd7, 0xc2, 0x00, 0xff, 0xff, 0xff, 0x7f) },
193 { "0.1.2.3.4.5.6.7.8.9.10.128.129.130.131.132.133.134.135.136.137."
194 "256.257.258.259.260.261.262.263.264.265.384.385.386.387.388."
195 "2097153", chunk_from_chars(
196 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
197 0x81, 0x00, 0x81, 0x01, 0x81, 0x02, 0x81, 0x03, 0x81, 0x04,
198 0x81, 0x05, 0x81, 0x06, 0x81, 0x07, 0x81, 0x08, 0x81, 0x09,
199 0x82, 0x00, 0x82, 0x01, 0x82, 0x02, 0x82, 0x03, 0x82, 0x04,
200 0x82, 0x05, 0x82, 0x06, 0x82, 0x07, 0x82, 0x08, 0x82, 0x09,
201 0x83, 0x00, 0x83, 0x01, 0x83, 0x02, 0x83, 0x03, 0x83, 0x04,
202 0x81, 0x80, 0x80, 0x01) },
203 { "0.1.2.3.4.5.6.7.8.9.10.128.129.130.131.132.133.134.135.136.137."
204 "256.257.258.259.260.261.262.263.264.265.384.385.386.387.388."
205 "1.2097153", chunk_empty
},
206 { "1.a.2.b.3", chunk_empty
}
210 chunk_t oid
= chunk_empty
;
212 for (i
= 0; i
< countof(test
); i
++)
214 oid
= asn1_oid_from_string(test
[i
].string
);
215 if (test
[i
].oid
.len
== 0)
217 ck_assert(oid
.len
== 0 && oid
.ptr
== NULL
);
221 ck_assert(chunk_equals(oid
, test
[i
].oid
));
228 /*******************************************************************************
232 START_TEST(test_asn1_oid_to_string
)
239 testdata_t test
[] = {
240 { NULL
, chunk_empty
},
241 { "0.2.262.1", chunk_from_chars(
242 0x02, 0x82, 0x06, 0x01) },
243 { "1.2.840.10045.4.1", chunk_from_chars(
244 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x01) },
245 { "1.3.6.1.4.1.36906.1", chunk_from_chars(
246 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa0, 0x2a, 0x01) },
247 { "2.16.840.1.101.3.4.2.1", chunk_from_chars(
248 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01) },
249 { "0.10.100.1000.10000.100000.1000000.10000000.100000000.268435455",
250 chunk_from_chars( 0x0a, 0x64, 0x87, 0x68, 0xce, 0x10, 0x86, 0x8d,
251 0x20, 0xbd, 0x84, 0x40, 0x84, 0xe2, 0xad, 0x00,
252 0xaf, 0xd7, 0xc2, 0x00, 0xff, 0xff, 0xff, 0x7f) },
253 { NULL
, chunk_from_chars(
254 0x0a, 0x02, 0x64, 0x87, 0x68, 0xce, 0x10, 0x86, 0x8d, 0x20,
255 0xbd, 0x84, 0x40, 0x84, 0xe2, 0xad, 0x00, 0xaf, 0xd7, 0xc2, 0x00,
256 0xff, 0xff, 0xff, 0x7f) },
257 { NULL
, chunk_from_chars(0x0a, 0x87) }
263 for (i
= 0; i
< countof(test
); i
++)
265 string
= asn1_oid_to_string(test
[i
].oid
);
266 if (test
[i
].string
== NULL
)
268 ck_assert(string
== NULL
);
272 ck_assert(streq(string
, test
[i
].string
));
279 /*******************************************************************************
283 START_TEST(test_asn1_length
)
288 ck_assert(asn1_length(&a
) == ASN1_INVALID_LENGTH
);
290 a
= chunk_from_chars(0x04);
291 ck_assert(asn1_length(&a
) == ASN1_INVALID_LENGTH
);
293 a
= chunk_from_chars(0x04, 0x00);
294 ck_assert(asn1_length(&a
) == 0);
296 a
= chunk_from_chars(0x04, 0x01);
297 ck_assert(asn1_length(&a
) == ASN1_INVALID_LENGTH
);
299 a
= chunk_from_chars(0x04, 0x01, 0xaa);
300 ck_assert(asn1_length(&a
) == 1);
302 a
= chunk_from_chars(0x04, 0x7f, 0xaa);
304 ck_assert(asn1_length(&a
) == 127);
306 a
= chunk_from_chars(0x04, 0x80, 0xaa);
308 ck_assert(asn1_length(&a
) == ASN1_INVALID_LENGTH
);
310 a
= chunk_from_chars(0x04, 0x81);
311 ck_assert(asn1_length(&a
) == ASN1_INVALID_LENGTH
);
313 a
= chunk_from_chars(0x04, 0x81, 0x80, 0xaa);
314 ck_assert(asn1_length(&a
) == ASN1_INVALID_LENGTH
);
316 a
= chunk_from_chars(0x04, 0x81, 0x80, 0xaa);
318 ck_assert(asn1_length(&a
) == 128);
320 a
= chunk_from_chars(0x04, 0x82, 0x01, 0x02, 0xaa);
322 ck_assert(asn1_length(&a
) == 258);
324 a
= chunk_from_chars(0x04, 0x83, 0x01, 0x02, 0x03, 0xaa);
326 ck_assert(asn1_length(&a
) == 66051);
330 /*******************************************************************************
334 START_TEST(test_asn1_unwrap
)
336 chunk_t c0
= chunk_from_chars(0x30);
337 chunk_t c1
= chunk_from_chars(0x30, 0x01, 0xaa);
338 chunk_t c2
= chunk_from_chars(0x30, 0x80);
339 chunk_t c3
= chunk_from_chars(0x30, 0x81);
340 chunk_t c4
= chunk_from_chars(0x30, 0x81, 0x01, 0xaa);
341 chunk_t c5
= chunk_from_chars(0x30, 0x81, 0x02, 0xaa);
344 chunk_t inner_ref
= chunk_from_chars(0xaa);
346 ck_assert(asn1_unwrap(&c0
, &inner
) == ASN1_INVALID
);
348 ck_assert(asn1_unwrap(&c1
, &inner
) == ASN1_SEQUENCE
);
350 ck_assert(chunk_equals(inner
, inner_ref
));
352 ck_assert(asn1_unwrap(&c2
, &inner
) == ASN1_INVALID
);
354 ck_assert(asn1_unwrap(&c3
, &inner
) == ASN1_INVALID
);
356 ck_assert(asn1_unwrap(&c4
, &inner
) == ASN1_SEQUENCE
);
358 ck_assert(chunk_equals(inner
, inner_ref
));
360 ck_assert(asn1_unwrap(&c5
, &inner
) == ASN1_INVALID
);
364 /*******************************************************************************
368 START_TEST(test_is_asn1
)
376 chunk_t chunk_zero
= { buf
, 0 };
377 chunk_t chunk_mean
= { 0, 1 };
379 testdata_t test
[] = {
380 { FALSE
, chunk_zero
},
381 { FALSE
, chunk_empty
},
382 { FALSE
, chunk_mean
},
383 { TRUE
, chunk_from_chars(0x30, 0x00) },
384 { TRUE
, chunk_from_chars(0x31, 0x00) },
385 { TRUE
, chunk_from_chars(0x04, 0x00) },
386 { FALSE
, chunk_from_chars(0x02, 0x00) },
387 { FALSE
, chunk_from_chars(0x30, 0x01) },
388 { FALSE
, chunk_from_chars(0x30, 0x80) },
389 { TRUE
, chunk_from_chars(0x30, 0x01, 0xa1) },
390 { FALSE
, chunk_from_chars(0x30, 0x01, 0xa1, 0xa2) },
391 { TRUE
, chunk_from_chars(0x30, 0x01, 0xa1, 0x0a) },
392 { FALSE
, chunk_from_chars(0x30, 0x01, 0xa1, 0xa2, 0x0a) },
397 for (i
= 0; i
< countof(test
); i
++)
399 ck_assert(is_asn1(test
[i
].chunk
) == test
[i
].asn1
);
404 /*******************************************************************************
408 START_TEST(test_asn1_is_printablestring
)
416 testdata_t test
[] = {
422 { FALSE
, "!" }, { FALSE
, "*" }, { FALSE
, "$" }, { FALSE
, "%" },
423 { FALSE
, "[" }, { FALSE
, "]" }, { FALSE
, "{" }, { FALSE
, "}" },
424 { FALSE
, "|" }, { FALSE
, "~" }, { FALSE
, "^" }, { FALSE
, "_" },
425 { FALSE
, "\"" }, { FALSE
, "\\" }, { FALSE
, "ä" }, { FALSE
, "Ã " },
426 { TRUE
, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
427 "0123456789 '()+,-./:=?" },
433 ck_assert(asn1_is_printablestring(chunk_empty
));
435 for (i
= 0; i
< countof(test
); i
++)
437 chunk
= chunk_from_str(test
[i
].string
);
438 ck_assert(asn1_is_printablestring(chunk
) == test
[i
].printable
);
443 /*******************************************************************************
447 START_TEST(test_asn1_to_time
)
455 testdata_t test
[] = {
456 { 352980, 0x18, "197001050203Z" },
457 { 352984, 0x18, "19700105020304Z" },
458 { 352980, 0x17, "7001050203Z" },
459 { 347580, 0x17, "7001050203+0130" },
460 { 358380, 0x17, "7001050203-0130" },
461 { 352984, 0x17, "700105020304Z" },
462 { 347584, 0x17, "700105020304+0130" },
463 { 358384, 0x17, "700105020304-0130" },
464 { 0, 0x17, "700105020304+01" },
465 { 0, 0x17, "700105020304-01" },
466 { 0, 0x17, "700105020304" },
467 { 0, 0x17, "70010502Z" },
468 { 0, 0x17, "7001050203xxZ" },
469 { 0, 0x17, "7000050203Z" },
470 { 0, 0x17, "7013050203Z" },
471 { 5097600, 0x17, "7003010000Z" },
472 { 68256000, 0x17, "7203010000Z" },
473 { 951868800, 0x17, "0003010000Z" },
474 { 4107542400, 0x18, "210003010000Z" }
480 for (i
= 0; i
< countof(test
); i
++)
482 if (test
[i
].time
> TIME_32_BIT_SIGNED_MAX
&& sizeof(time_t) == 4)
486 chunk
= chunk_from_str(test
[i
].string
);
487 ck_assert(asn1_to_time(&chunk
, test
[i
].type
) == test
[i
].time
);
492 /*******************************************************************************
496 START_TEST(test_asn1_from_time
)
504 testdata_t test
[] = {
505 { 352984, 0x18, chunk_from_chars(
506 0x18, 0x0f, 0x31, 0x39, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35,
507 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) },
508 { 352984, 0x17, chunk_from_chars(
509 0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35,
510 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) },
511 { 1078099200, 0x17, chunk_from_chars(
512 0x17, 0x0d, 0x30, 0x34, 0x30, 0x33, 0x30, 0x31,
513 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) },
514 { 4107542400, 0x18, chunk_from_chars(
515 0x18, 0x0f, 0x32, 0x31, 0x30, 0x30, 0x30, 0x33, 0x30, 0x31,
516 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) }
522 for (i
= 0; i
< countof(test
); i
++)
524 if (test
[i
].time
> TIME_32_BIT_SIGNED_MAX
&& sizeof(time_t) == 4)
528 chunk
= asn1_from_time(&test
[i
].time
, test
[i
].type
);
529 ck_assert(chunk_equals(chunk
, test
[i
].chunk
));
534 /*******************************************************************************
538 START_TEST(test_asn1_parse_time
)
545 testdata_t test
[] = {
546 { 352984, chunk_from_chars(
547 0x18, 0x0f, 0x31, 0x39, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35,
548 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) },
549 { 352984, chunk_from_chars(
550 0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35,
551 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) },
552 { 0, chunk_from_chars(0x05, 0x00) }
557 for (i
= 0; i
< countof(test
); i
++)
559 ck_assert(asn1_parse_time(test
[i
].chunk
, 0) == test
[i
].time
);
564 /*******************************************************************************
568 START_TEST(test_asn1_build_object
)
576 u_char b0
[] = { 0x05, 0x00 };
577 u_char b1
[] = { 0x04, 0x7f };
578 u_char b2
[] = { 0x04, 0x81, 0x80 };
579 u_char b3
[] = { 0x04, 0x81, 0xff };
580 u_char b4
[] = { 0x04, 0x82, 0x01, 0x00 };
581 u_char b5
[] = { 0x04, 0x82, 0xff, 0xff };
582 u_char b6
[] = { 0x04, 0x83, 0x01, 0x00, 0x00 };
584 testdata_t test
[] = {
585 { 0, sizeof(b0
), b0
},
586 { 127, sizeof(b1
), b1
},
587 { 128, sizeof(b2
), b2
},
588 { 255, sizeof(b3
), b3
},
589 { 256, sizeof(b4
), b4
},
590 { 65535, sizeof(b5
), b5
},
591 { 65536, sizeof(b6
), b6
}
594 chunk_t a
= chunk_empty
;
598 for (i
= 0; i
< countof(test
); i
++)
600 pos
= asn1_build_object(&a
, test
[i
].b
[0], test
[i
].len
);
601 ck_assert(pos
== (a
.ptr
+ test
[i
].size
));
602 ck_assert(a
.len
== test
[i
].size
+ test
[i
].len
);
603 ck_assert(memeq(a
.ptr
, test
[i
].b
, test
[i
].size
));
609 /*******************************************************************************
613 START_TEST(test_asn1_simple_object
)
615 chunk_t a
= chunk_empty
;
616 chunk_t b
= chunk_from_chars(0x04, 0x05, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5);
617 chunk_t c
= chunk_from_chars(0xa1, 0xa2, 0xa3, 0xa4, 0xa5);
619 a
= asn1_simple_object(0x04, c
);
620 ck_assert(chunk_equals(a
, b
));
625 /*******************************************************************************
626 * parse_simple_object
629 START_TEST(test_asn1_parse_simple_object
)
637 testdata_t test
[] = {
638 { FALSE
, 0x04, chunk_from_chars(0x04) },
639 { FALSE
, 0x04, chunk_from_chars(0x02, 0x01, 0x55) },
640 { FALSE
, 0x04, chunk_from_chars(0x04, 0x01) },
641 { TRUE
, 0x04, chunk_from_chars(0x04, 0x01, 0x55) },
642 { TRUE
, 0x06, chunk_from_chars(0x06, 0x02, 0x55, 0x03) },
643 { TRUE
, 0x06, chunk_from_chars(0x06, 0x00) },
644 { TRUE
, 0x13, chunk_from_chars(0x13, 0x01, 0x55), }
650 for (i
= 0; i
< countof(test
); i
++)
652 res
= asn1_parse_simple_object(&test
[i
].chunk
, test
[i
].type
, 0, "test");
653 ck_assert(res
== test
[i
].res
);
654 if (res
&& test
[i
].chunk
.len
)
656 ck_assert(*test
[i
].chunk
.ptr
== 0x55);
662 /*******************************************************************************
666 START_TEST(test_asn1_bitstring
)
668 chunk_t a
= chunk_empty
;
669 chunk_t b
= chunk_from_chars(0x03, 0x05, 0x00, 0xa1, 0xa2, 0xa3, 0xa4);
670 chunk_t c
= chunk_from_chars(0xa1, 0xa2, 0xa3, 0xa4);
671 chunk_t d
= chunk_clone(c
);
673 a
= asn1_bitstring("c", c
);
674 ck_assert(chunk_equals(a
, b
));
677 a
= asn1_bitstring("m", d
);
678 ck_assert(chunk_equals(a
, b
));
683 /*******************************************************************************
687 START_TEST(test_asn1_integer
)
694 chunk_t b0
= chunk_from_chars(0x02, 0x01, 0x00);
695 chunk_t b1
= chunk_from_chars(0x02, 0x01, 0x7f);
696 chunk_t b2
= chunk_from_chars(0x02, 0x02, 0x00, 0x80);
698 chunk_t c0
= chunk_empty
;
699 chunk_t c1
= chunk_from_chars(0x7f);
700 chunk_t c2
= chunk_from_chars(0x80);
701 chunk_t c3
= chunk_from_chars(0x00, 0x80);
703 testdata_t test
[] = {
710 chunk_t a
= chunk_empty
;
713 for (i
= 0; i
< countof(test
); i
++)
715 a
= asn1_integer("c", test
[i
].c
);
716 ck_assert(chunk_equals(a
, test
[i
].b
));
719 a
= asn1_integer("m", chunk_clone(test
[i
].c
));
720 ck_assert(chunk_equals(a
, test
[i
].b
));
726 /*******************************************************************************
727 * parse_integer_uint64
730 START_TEST(test_asn1_parse_integer_uint64
)
738 testdata_t test
[] = {
739 { 67305985ULL, chunk_from_chars(
740 0x04, 0x03, 0x02, 0x01) },
741 { 578437695752307201ULL, chunk_from_chars(
742 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01) },
743 { 18446744073709551615ULL, chunk_from_chars(
744 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff) }
749 for (i
= 0; i
< countof(test
); i
++)
751 ck_assert(asn1_parse_integer_uint64(test
[i
].chunk
) == test
[i
].n
);
756 Suite
*asn1_suite_create()
761 s
= suite_create("asn1");
763 tc
= tcase_create("algorithmIdentifier");
764 tcase_add_test(tc
, test_asn1_algorithmIdentifier
);
765 suite_add_tcase(s
, tc
);
767 tc
= tcase_create("parse_algorithmIdentifier");
768 tcase_add_test(tc
, test_asn1_parse_algorithmIdentifier
);
769 suite_add_tcase(s
, tc
);
771 tc
= tcase_create("known_oid");
772 tcase_add_test(tc
, test_asn1_known_oid
);
773 suite_add_tcase(s
, tc
);
775 tc
= tcase_create("build_known_oid");
776 tcase_add_test(tc
, test_asn1_build_known_oid
);
777 suite_add_tcase(s
, tc
);
779 tc
= tcase_create("oid_from_string");
780 tcase_add_test(tc
, test_asn1_oid_from_string
);
781 suite_add_tcase(s
, tc
);
783 tc
= tcase_create("oid_to_string");
784 tcase_add_test(tc
, test_asn1_oid_to_string
);
785 suite_add_tcase(s
, tc
);
787 tc
= tcase_create("length");
788 tcase_add_test(tc
, test_asn1_length
);
789 suite_add_tcase(s
, tc
);
791 tc
= tcase_create("unwrap");
792 tcase_add_test(tc
, test_asn1_unwrap
);
793 suite_add_tcase(s
, tc
);
795 tc
= tcase_create("is_asn1");
796 tcase_add_test(tc
, test_is_asn1
);
797 suite_add_tcase(s
, tc
);
799 tc
= tcase_create("is_printablestring");
800 tcase_add_test(tc
, test_asn1_is_printablestring
);
801 suite_add_tcase(s
, tc
);
803 tc
= tcase_create("to_time");
804 tcase_add_test(tc
, test_asn1_to_time
);
805 suite_add_tcase(s
, tc
);
807 tc
= tcase_create("from_time");
808 tcase_add_test(tc
, test_asn1_from_time
);
809 suite_add_tcase(s
, tc
);
811 tc
= tcase_create("parse_time");
812 tcase_add_test(tc
, test_asn1_parse_time
);
813 suite_add_tcase(s
, tc
);
815 tc
= tcase_create("build_object");
816 tcase_add_test(tc
, test_asn1_build_object
);
817 suite_add_tcase(s
, tc
);
819 tc
= tcase_create("simple_object");
820 tcase_add_test(tc
, test_asn1_simple_object
);
821 suite_add_tcase(s
, tc
);
823 tc
= tcase_create("parse_simple_object");
824 tcase_add_test(tc
, test_asn1_parse_simple_object
);
825 suite_add_tcase(s
, tc
);
827 tc
= tcase_create("bitstring");
828 tcase_add_test(tc
, test_asn1_bitstring
);
829 suite_add_tcase(s
, tc
);
831 tc
= tcase_create("integer");
832 tcase_add_test(tc
, test_asn1_integer
);
833 suite_add_tcase(s
, tc
);
835 tc
= tcase_create("parse_integer_uint64");
836 tcase_add_test(tc
, test_asn1_parse_integer_uint64
);
837 suite_add_tcase(s
, tc
);