10 ((void) certificate_depth);
11 ((void) preverify_ok);
20 ((void) certificate_depth);
21 ((void) preverify_ok);
31 typedef UINT32 uint32_t;
40 #define GET_ULONG_BE(n,b,i) \
42 (n) = ( (unsigned long) (b)[(i) ] << 24 ) \
43 | ( (unsigned long) (b)[(i) + 1] << 16 ) \
44 | ( (unsigned long) (b)[(i) + 2] << 8 ) \
45 | ( (unsigned long) (b)[(i) + 3] ); \
50 #define PUT_ULONG_BE(n,b,i) \
52 (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
53 (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
54 (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
55 (b)[(i) + 3] = (unsigned char) ( (n) ); \
59 int unhexify(
unsigned char *obuf,
const char *ibuf)
62 int len = strlen(ibuf) / 2;
63 assert(!(strlen(ibuf) %1));
68 if( c >=
'0' && c <=
'9' )
70 else if( c >=
'a' && c <=
'f' )
72 else if( c >=
'A' && c <=
'F' )
78 if( c2 >=
'0' && c2 <=
'9' )
80 else if( c2 >=
'a' && c2 <=
'f' )
82 else if( c2 >=
'A' && c2 <=
'F' )
87 *obuf++ = ( c << 4 ) | c2;
93 void hexify(
unsigned char *obuf,
const unsigned char *ibuf,
int len)
105 *obuf++ =
'a' + h - 10;
110 *obuf++ =
'a' + l - 10;
126 static int rnd_std_rand(
void *rng_state,
unsigned char *output,
size_t len )
130 if( rng_state != NULL )
133 for( i = 0; i < len; ++i )
144 static int rnd_zero_rand(
void *rng_state,
unsigned char *output,
size_t len )
146 if( rng_state != NULL )
149 memset( output, 0, len );
176 if( rng_state == NULL )
185 memcpy( output, info->
buf, use_len );
186 info->
buf += use_len;
190 if( len - use_len > 0 )
191 return(
rnd_std_rand( NULL, output + use_len, len - use_len ) );
220 uint32_t i, *k, sum, delta=0x9E3779B9;
221 unsigned char result[4];
223 if( rng_state == NULL )
230 size_t use_len = ( len > 4 ) ? 4 : len;
233 for( i = 0; i < 32; i++ )
235 info->
v0 += (((info->
v1 << 4) ^ (info->
v1 >> 5)) + info->
v1) ^ (sum + k[sum & 3]);
237 info->
v1 += (((info->
v0 << 4) ^ (info->
v0 >> 5)) + info->
v0) ^ (sum + k[(sum>>11) & 3]);
241 memcpy( output, result, use_len );
251 #ifdef POLARSSL_X509_PARSE_C
252 #ifdef POLARSSL_BIGNUM_C
255 FCT_SUITE_BGN(test_suite_x509parse)
257 #ifdef POLARSSL_PEM_C
258 #ifdef POLARSSL_FS_IO
260 FCT_TEST_BGN(x509_certificate_information_1)
267 memset( buf, 0, 2000 );
272 fct_chk( res != -1 );
273 fct_chk( res != -2 );
275 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 01\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Server 1\nissued on : 2011-02-12 14:44:06\nexpires on : 2021-02-12 14:44:06\nsigned using : RSA+SHA1\nRSA key size : 2048 bits\n" ) == 0 );
281 #ifdef POLARSSL_PEM_C
282 #ifdef POLARSSL_FS_IO
284 FCT_TEST_BGN(x509_certificate_information_2)
291 memset( buf, 0, 2000 );
296 fct_chk( res != -1 );
297 fct_chk( res != -2 );
299 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 02\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=localhost\nissued on : 2011-02-12 14:44:06\nexpires on : 2021-02-12 14:44:06\nsigned using : RSA+SHA1\nRSA key size : 2048 bits\n" ) == 0 );
305 #ifdef POLARSSL_PEM_C
306 #ifdef POLARSSL_FS_IO
308 FCT_TEST_BGN(x509_certificate_information_3)
315 memset( buf, 0, 2000 );
320 fct_chk( res != -1 );
321 fct_chk( res != -2 );
323 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 00\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nissued on : 2011-02-12 14:44:00\nexpires on : 2021-02-12 14:44:00\nsigned using : RSA+SHA1\nRSA key size : 2048 bits\n" ) == 0 );
329 #ifdef POLARSSL_PEM_C
330 #ifdef POLARSSL_FS_IO
332 FCT_TEST_BGN(x509_certificate_information_md2_digest)
339 memset( buf, 0, 2000 );
344 fct_chk( res != -1 );
345 fct_chk( res != -2 );
347 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 09\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert MD2\nissued on : 2009-07-12 10:56:59\nexpires on : 2011-07-12 10:56:59\nsigned using : RSA+MD2\nRSA key size : 2048 bits\n" ) == 0 );
353 #ifdef POLARSSL_PEM_C
354 #ifdef POLARSSL_FS_IO
356 FCT_TEST_BGN(x509_certificate_information_md4_digest)
363 memset( buf, 0, 2000 );
368 fct_chk( res != -1 );
369 fct_chk( res != -2 );
371 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 05\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert MD4\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+MD4\nRSA key size : 2048 bits\n" ) == 0 );
377 #ifdef POLARSSL_PEM_C
378 #ifdef POLARSSL_FS_IO
380 FCT_TEST_BGN(x509_certificate_information_md5_digest)
387 memset( buf, 0, 2000 );
392 fct_chk( res != -1 );
393 fct_chk( res != -2 );
395 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 06\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert MD5\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+MD5\nRSA key size : 2048 bits\n" ) == 0 );
401 #ifdef POLARSSL_PEM_C
402 #ifdef POLARSSL_FS_IO
404 FCT_TEST_BGN(x509_certificate_information_sha1_digest)
411 memset( buf, 0, 2000 );
416 fct_chk( res != -1 );
417 fct_chk( res != -2 );
419 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 07\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA1\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA1\nRSA key size : 2048 bits\n" ) == 0 );
425 #ifdef POLARSSL_PEM_C
426 #ifdef POLARSSL_FS_IO
428 FCT_TEST_BGN(x509_certificate_information_sha224_digest)
435 memset( buf, 0, 2000 );
440 fct_chk( res != -1 );
441 fct_chk( res != -2 );
443 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 08\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA224\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA224\nRSA key size : 2048 bits\n" ) == 0 );
449 #ifdef POLARSSL_PEM_C
450 #ifdef POLARSSL_FS_IO
452 FCT_TEST_BGN(x509_certificate_information_sha256_digest)
459 memset( buf, 0, 2000 );
464 fct_chk( res != -1 );
465 fct_chk( res != -2 );
467 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 09\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA256\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA256\nRSA key size : 2048 bits\n" ) == 0 );
473 #ifdef POLARSSL_PEM_C
474 #ifdef POLARSSL_FS_IO
476 FCT_TEST_BGN(x509_certificate_information_sha384_digest)
483 memset( buf, 0, 2000 );
488 fct_chk( res != -1 );
489 fct_chk( res != -2 );
491 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 0A\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA384\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA384\nRSA key size : 2048 bits\n" ) == 0 );
497 #ifdef POLARSSL_PEM_C
498 #ifdef POLARSSL_FS_IO
500 FCT_TEST_BGN(x509_certificate_information_sha512_digest)
507 memset( buf, 0, 2000 );
512 fct_chk( res != -1 );
513 fct_chk( res != -2 );
515 fct_chk( strcmp( buf,
"cert. version : 3\nserial number : 0B\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nsubject name : C=NL, O=PolarSSL, CN=PolarSSL Cert SHA512\nissued on : 2011-02-12 14:44:07\nexpires on : 2021-02-12 14:44:07\nsigned using : RSA+SHA512\nRSA key size : 2048 bits\n" ) == 0 );
521 #ifdef POLARSSL_PEM_C
522 #ifdef POLARSSL_FS_IO
524 FCT_TEST_BGN(x509_crl_information_1)
530 memset( &crl, 0,
sizeof(
x509_crl ) );
531 memset( buf, 0, 2000 );
536 fct_chk( res != -1 );
537 fct_chk( res != -2 );
539 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-20 10:24:19\nnext update : 2011-02-20 11:24:19\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA1\n" ) == 0 );
545 #ifdef POLARSSL_PEM_C
546 #ifdef POLARSSL_FS_IO
548 FCT_TEST_BGN(x509_crl_information_md2_digest)
554 memset( &crl, 0,
sizeof(
x509_crl ) );
555 memset( buf, 0, 2000 );
560 fct_chk( res != -1 );
561 fct_chk( res != -2 );
563 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2009-07-19 19:56:37\nnext update : 2009-09-17 19:56:37\nRevoked certificates:\nserial number: 01 revocation date: 2009-02-09 21:12:36\nserial number: 03 revocation date: 2009-02-09 21:12:36\nsigned using : RSA+MD2\n" ) == 0 );
569 #ifdef POLARSSL_PEM_C
570 #ifdef POLARSSL_FS_IO
572 FCT_TEST_BGN(x509_crl_information_md4_digest)
578 memset( &crl, 0,
sizeof(
x509_crl ) );
579 memset( buf, 0, 2000 );
584 fct_chk( res != -1 );
585 fct_chk( res != -2 );
587 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+MD4\n" ) == 0 );
593 #ifdef POLARSSL_PEM_C
594 #ifdef POLARSSL_FS_IO
596 FCT_TEST_BGN(x509_crl_information_md5_digest)
602 memset( &crl, 0,
sizeof(
x509_crl ) );
603 memset( buf, 0, 2000 );
608 fct_chk( res != -1 );
609 fct_chk( res != -2 );
611 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+MD5\n" ) == 0 );
617 #ifdef POLARSSL_PEM_C
618 #ifdef POLARSSL_FS_IO
620 FCT_TEST_BGN(x509_crl_information_sha1_digest)
626 memset( &crl, 0,
sizeof(
x509_crl ) );
627 memset( buf, 0, 2000 );
632 fct_chk( res != -1 );
633 fct_chk( res != -2 );
635 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA1\n" ) == 0 );
641 #ifdef POLARSSL_PEM_C
642 #ifdef POLARSSL_FS_IO
644 FCT_TEST_BGN(x509_crl_information_sha224_digest)
650 memset( &crl, 0,
sizeof(
x509_crl ) );
651 memset( buf, 0, 2000 );
656 fct_chk( res != -1 );
657 fct_chk( res != -2 );
659 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA224\n" ) == 0 );
665 #ifdef POLARSSL_PEM_C
666 #ifdef POLARSSL_FS_IO
668 FCT_TEST_BGN(x509_crl_information_sha256_digest)
674 memset( &crl, 0,
sizeof(
x509_crl ) );
675 memset( buf, 0, 2000 );
680 fct_chk( res != -1 );
681 fct_chk( res != -2 );
683 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA256\n" ) == 0 );
689 #ifdef POLARSSL_PEM_C
690 #ifdef POLARSSL_FS_IO
692 FCT_TEST_BGN(x509_crl_information_sha384_digest)
698 memset( &crl, 0,
sizeof(
x509_crl ) );
699 memset( buf, 0, 2000 );
704 fct_chk( res != -1 );
705 fct_chk( res != -2 );
707 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA384\n" ) == 0 );
713 #ifdef POLARSSL_PEM_C
714 #ifdef POLARSSL_FS_IO
716 FCT_TEST_BGN(x509_crl_information_sha512_digest)
722 memset( &crl, 0,
sizeof(
x509_crl ) );
723 memset( buf, 0, 2000 );
728 fct_chk( res != -1 );
729 fct_chk( res != -2 );
731 fct_chk( strcmp( buf,
"CRL version : 1\nissuer name : C=NL, O=PolarSSL, CN=PolarSSL Test CA\nthis update : 2011-02-12 14:44:07\nnext update : 2011-04-13 14:44:07\nRevoked certificates:\nserial number: 01 revocation date: 2011-02-12 14:44:07\nserial number: 03 revocation date: 2011-02-12 14:44:07\nsigned using : RSA+SHA512\n" ) == 0 );
737 #ifdef POLARSSL_MD5_C
738 #ifdef POLARSSL_PEM_C
739 #ifdef POLARSSL_FS_IO
741 FCT_TEST_BGN(x509_parse_key_1_no_password_when_required)
762 #ifdef POLARSSL_MD5_C
763 #ifdef POLARSSL_PEM_C
764 #ifdef POLARSSL_FS_IO
766 FCT_TEST_BGN(x509_parse_key_2_correct_password)
787 #ifdef POLARSSL_MD5_C
788 #ifdef POLARSSL_PEM_C
789 #ifdef POLARSSL_FS_IO
791 FCT_TEST_BGN(x509_parse_key_3_wrong_password)
812 #ifdef POLARSSL_MD5_C
813 #ifdef POLARSSL_DES_C
814 #ifdef POLARSSL_PEM_C
815 #ifdef POLARSSL_FS_IO
817 FCT_TEST_BGN(x509_parse_key_4_des_encrypted)
839 #ifdef POLARSSL_MD5_C
840 #ifdef POLARSSL_DES_C
841 #ifdef POLARSSL_PEM_C
842 #ifdef POLARSSL_FS_IO
844 FCT_TEST_BGN(x509_parse_key_5_3des_encrypted)
866 #ifdef POLARSSL_MD5_C
867 #ifdef POLARSSL_AES_C
868 #ifdef POLARSSL_PEM_C
869 #ifdef POLARSSL_FS_IO
871 FCT_TEST_BGN(x509_parse_key_6_aes_128_encrypted)
893 #ifdef POLARSSL_MD5_C
894 #ifdef POLARSSL_AES_C
895 #ifdef POLARSSL_PEM_C
896 #ifdef POLARSSL_FS_IO
898 FCT_TEST_BGN(x509_parse_key_7_aes_192_encrypted)
920 #ifdef POLARSSL_MD5_C
921 #ifdef POLARSSL_AES_C
922 #ifdef POLARSSL_PEM_C
923 #ifdef POLARSSL_FS_IO
925 FCT_TEST_BGN(x509_parse_key_8_aes_256_encrypted)
947 #ifdef POLARSSL_MD5_C
948 #ifdef POLARSSL_PEM_C
949 #ifdef POLARSSL_FS_IO
951 FCT_TEST_BGN(x509_parse_key_9_pkcs8_wrapped)
972 #ifdef POLARSSL_MD5_C
973 #ifdef POLARSSL_PEM_C
974 #ifdef POLARSSL_FS_IO
976 FCT_TEST_BGN(x509_parse_public_key_1_pkcs8_wrapped)
997 #ifdef POLARSSL_PEM_C
998 #ifdef POLARSSL_FS_IO
1000 FCT_TEST_BGN(x509_get_distinguished_name_1)
1007 memset( buf, 0, 2000 );
1012 fct_chk( res != -1 );
1013 fct_chk( res != -2 );
1015 fct_chk( strcmp( buf,
"C=NL, O=PolarSSL, CN=PolarSSL Server 1" ) == 0 );
1021 #ifdef POLARSSL_PEM_C
1022 #ifdef POLARSSL_FS_IO
1024 FCT_TEST_BGN(x509_get_distinguished_name_2)
1031 memset( buf, 0, 2000 );
1036 fct_chk( res != -1 );
1037 fct_chk( res != -2 );
1039 fct_chk( strcmp( buf,
"C=NL, O=PolarSSL, CN=PolarSSL Test CA" ) == 0 );
1045 #ifdef POLARSSL_PEM_C
1046 #ifdef POLARSSL_FS_IO
1048 FCT_TEST_BGN(x509_get_distinguished_name_3)
1055 memset( buf, 0, 2000 );
1060 fct_chk( res != -1 );
1061 fct_chk( res != -2 );
1063 fct_chk( strcmp( buf,
"C=NL, O=PolarSSL, CN=localhost" ) == 0 );
1069 #ifdef POLARSSL_PEM_C
1070 #ifdef POLARSSL_FS_IO
1072 FCT_TEST_BGN(x509_get_distinguished_name_4)
1079 memset( buf, 0, 2000 );
1084 fct_chk( res != -1 );
1085 fct_chk( res != -2 );
1087 fct_chk( strcmp( buf,
"C=NL, O=PolarSSL, CN=PolarSSL Test CA" ) == 0 );
1093 #ifdef POLARSSL_PEM_C
1094 #ifdef POLARSSL_FS_IO
1096 FCT_TEST_BGN(x509_time_expired_1)
1109 #ifdef POLARSSL_PEM_C
1110 #ifdef POLARSSL_FS_IO
1112 FCT_TEST_BGN(x509_time_expired_2)
1125 #ifdef POLARSSL_PEM_C
1126 #ifdef POLARSSL_FS_IO
1128 FCT_TEST_BGN(x509_time_expired_3)
1141 #ifdef POLARSSL_PEM_C
1142 #ifdef POLARSSL_FS_IO
1144 FCT_TEST_BGN(x509_time_expired_4)
1157 #ifdef POLARSSL_PEM_C
1158 #ifdef POLARSSL_FS_IO
1160 FCT_TEST_BGN(x509_time_expired_5)
1173 #ifdef POLARSSL_PEM_C
1174 #ifdef POLARSSL_FS_IO
1176 FCT_TEST_BGN(x509_time_expired_6polarssl_fs_io)
1189 #ifdef POLARSSL_PEM_C
1190 #ifdef POLARSSL_FS_IO
1192 FCT_TEST_BGN(x509_certificate_verification_1_revoked_cert_expired_crl)
1202 memset( &crl, 0,
sizeof(
x509_crl ) );
1217 #ifdef POLARSSL_PEM_C
1218 #ifdef POLARSSL_FS_IO
1220 FCT_TEST_BGN(x509_certificate_verification_2_revoked_cert_expired_crl)
1230 memset( &crl, 0,
sizeof(
x509_crl ) );
1236 res =
x509parse_verify( &crt, &ca, &crl,
"PolarSSL Server 1", &flags, NULL, NULL );
1245 #ifdef POLARSSL_PEM_C
1246 #ifdef POLARSSL_FS_IO
1248 FCT_TEST_BGN(x509_certificate_verification_3_revoked_cert_expired_crl_cn_mismatch)
1258 memset( &crl, 0,
sizeof(
x509_crl ) );
1264 res =
x509parse_verify( &crt, &ca, &crl,
"PolarSSL Wrong CN", &flags, NULL, NULL );
1273 #ifdef POLARSSL_PEM_C
1274 #ifdef POLARSSL_FS_IO
1276 FCT_TEST_BGN(x509_certificate_verification_4_valid_cert_expired_crl)
1286 memset( &crl, 0,
sizeof(
x509_crl ) );
1301 #ifdef POLARSSL_PEM_C
1302 #ifdef POLARSSL_FS_IO
1304 FCT_TEST_BGN(x509_certificate_verification_5_revoked_cert)
1314 memset( &crl, 0,
sizeof(
x509_crl ) );
1329 #ifdef POLARSSL_PEM_C
1330 #ifdef POLARSSL_FS_IO
1332 FCT_TEST_BGN(x509_certificate_verification_6_revoked_cert)
1342 memset( &crl, 0,
sizeof(
x509_crl ) );
1348 res =
x509parse_verify( &crt, &ca, &crl,
"PolarSSL Server 1", &flags, NULL, NULL );
1357 #ifdef POLARSSL_PEM_C
1358 #ifdef POLARSSL_FS_IO
1360 FCT_TEST_BGN(x509_certificate_verification_7_revoked_cert_cn_mismatch)
1370 memset( &crl, 0,
sizeof(
x509_crl ) );
1376 res =
x509parse_verify( &crt, &ca, &crl,
"PolarSSL Wrong CN", &flags, NULL, NULL );
1385 #ifdef POLARSSL_PEM_C
1386 #ifdef POLARSSL_FS_IO
1388 FCT_TEST_BGN(x509_certificate_verification_8_valid_cert)
1398 memset( &crl, 0,
sizeof(
x509_crl ) );
1406 fct_chk( res == ( 0 ) );
1407 fct_chk( flags == ( 0 ) );
1413 #ifdef POLARSSL_PEM_C
1414 #ifdef POLARSSL_FS_IO
1416 FCT_TEST_BGN(x509_certificate_verification_9_not_trusted_cert)
1426 memset( &crl, 0,
sizeof(
x509_crl ) );
1441 #ifdef POLARSSL_PEM_C
1442 #ifdef POLARSSL_FS_IO
1444 FCT_TEST_BGN(x509_certificate_verification_10_not_trusted_cert_expired_crl)
1454 memset( &crl, 0,
sizeof(
x509_crl ) );
1469 #ifdef POLARSSL_MD4_C
1470 #ifdef POLARSSL_PEM_C
1471 #ifdef POLARSSL_FS_IO
1473 FCT_TEST_BGN(x509_certificate_verification_12_valid_cert_md4_digest)
1483 memset( &crl, 0,
sizeof(
x509_crl ) );
1491 fct_chk( res == ( 0 ) );
1492 fct_chk( flags == ( 0 ) );
1499 #ifdef POLARSSL_MD5_C
1500 #ifdef POLARSSL_PEM_C
1501 #ifdef POLARSSL_FS_IO
1503 FCT_TEST_BGN(x509_certificate_verification_13_valid_cert_md5_digest)
1513 memset( &crl, 0,
sizeof(
x509_crl ) );
1521 fct_chk( res == ( 0 ) );
1522 fct_chk( flags == ( 0 ) );
1529 #ifdef POLARSSL_SHA1_C
1530 #ifdef POLARSSL_PEM_C
1531 #ifdef POLARSSL_FS_IO
1533 FCT_TEST_BGN(x509_certificate_verification_14_valid_cert_sha1_digest)
1543 memset( &crl, 0,
sizeof(
x509_crl ) );
1551 fct_chk( res == ( 0 ) );
1552 fct_chk( flags == ( 0 ) );
1559 #ifdef POLARSSL_SHA2_C
1560 #ifdef POLARSSL_PEM_C
1561 #ifdef POLARSSL_FS_IO
1563 FCT_TEST_BGN(x509_certificate_verification_15_valid_cert_sha224_digest)
1573 memset( &crl, 0,
sizeof(
x509_crl ) );
1581 fct_chk( res == ( 0 ) );
1582 fct_chk( flags == ( 0 ) );
1589 #ifdef POLARSSL_SHA2_C
1590 #ifdef POLARSSL_PEM_C
1591 #ifdef POLARSSL_FS_IO
1593 FCT_TEST_BGN(x509_certificate_verification_16_valid_cert_sha256_digest)
1603 memset( &crl, 0,
sizeof(
x509_crl ) );
1611 fct_chk( res == ( 0 ) );
1612 fct_chk( flags == ( 0 ) );
1619 #ifdef POLARSSL_SHA4_C
1620 #ifdef POLARSSL_PEM_C
1621 #ifdef POLARSSL_FS_IO
1623 FCT_TEST_BGN(x509_certificate_verification_17_valid_cert_sha384_digest)
1633 memset( &crl, 0,
sizeof(
x509_crl ) );
1641 fct_chk( res == ( 0 ) );
1642 fct_chk( flags == ( 0 ) );
1649 #ifdef POLARSSL_SHA4_C
1650 #ifdef POLARSSL_PEM_C
1651 #ifdef POLARSSL_FS_IO
1653 FCT_TEST_BGN(x509_certificate_verification_18_valid_cert_sha512_digest)
1663 memset( &crl, 0,
sizeof(
x509_crl ) );
1671 fct_chk( res == ( 0 ) );
1672 fct_chk( flags == ( 0 ) );
1679 #ifdef POLARSSL_SHA4_C
1680 #ifdef POLARSSL_PEM_C
1681 #ifdef POLARSSL_FS_IO
1683 FCT_TEST_BGN(x509_certificate_verification_19_valid_cert_denying_callback)
1693 memset( &crl, 0,
sizeof(
x509_crl ) );
1702 fct_chk( flags == ( 0 ) );
1709 #ifdef POLARSSL_PEM_C
1710 #ifdef POLARSSL_FS_IO
1712 FCT_TEST_BGN(x509_certificate_verification_20_not_trusted_cert_allowing_callback)
1722 memset( &crl, 0,
sizeof(
x509_crl ) );
1730 fct_chk( res == ( 0 ) );
1731 fct_chk( flags == ( 0 ) );
1737 #ifdef POLARSSL_MD5_C
1738 #ifdef POLARSSL_PEM_C
1739 #ifdef POLARSSL_SELF_TEST
1741 FCT_TEST_BGN(x509_parse_selftest)
1751 FCT_TEST_BGN(x509_certificate_asn1_incorrect_first_tag)
1754 unsigned char buf[2000];
1755 unsigned char output[2000];
1759 memset( buf, 0, 2000 );
1760 memset( output, 0, 2000 );
1769 fct_chk( res != -1 );
1770 fct_chk( res != -2 );
1772 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
1778 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_data_length_does_not_match)
1781 unsigned char buf[2000];
1782 unsigned char output[2000];
1786 memset( buf, 0, 2000 );
1787 memset( output, 0, 2000 );
1789 data_len =
unhexify( buf,
"300000" );
1796 fct_chk( res != -1 );
1797 fct_chk( res != -2 );
1799 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
1805 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_no_more_data)
1808 unsigned char buf[2000];
1809 unsigned char output[2000];
1813 memset( buf, 0, 2000 );
1814 memset( output, 0, 2000 );
1816 data_len =
unhexify( buf,
"3000" );
1823 fct_chk( res != -1 );
1824 fct_chk( res != -2 );
1826 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
1832 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_length_data_incorrect)
1835 unsigned char buf[2000];
1836 unsigned char output[2000];
1840 memset( buf, 0, 2000 );
1841 memset( output, 0, 2000 );
1843 data_len =
unhexify( buf,
"30023085" );
1850 fct_chk( res != -1 );
1851 fct_chk( res != -2 );
1853 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
1859 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_length_data_incomplete)
1862 unsigned char buf[2000];
1863 unsigned char output[2000];
1867 memset( buf, 0, 2000 );
1868 memset( output, 0, 2000 );
1870 data_len =
unhexify( buf,
"30023083" );
1877 fct_chk( res != -1 );
1878 fct_chk( res != -2 );
1880 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
1886 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_length_data_incomplete)
1889 unsigned char buf[2000];
1890 unsigned char output[2000];
1894 memset( buf, 0, 2000 );
1895 memset( output, 0, 2000 );
1897 data_len =
unhexify( buf,
"30023081" );
1904 fct_chk( res != -1 );
1905 fct_chk( res != -2 );
1907 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
1913 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_length_data_incomplete)
1916 unsigned char buf[2000];
1917 unsigned char output[2000];
1921 memset( buf, 0, 2000 );
1922 memset( output, 0, 2000 );
1924 data_len =
unhexify( buf,
"3003308200" );
1931 fct_chk( res != -1 );
1932 fct_chk( res != -2 );
1934 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
1940 FCT_TEST_BGN(x509_certificate_asn1_correct_first_tag_second_tag_no_tbscertificate)
1943 unsigned char buf[2000];
1944 unsigned char output[2000];
1948 memset( buf, 0, 2000 );
1949 memset( output, 0, 2000 );
1951 data_len =
unhexify( buf,
"300100" );
1958 fct_chk( res != -1 );
1959 fct_chk( res != -2 );
1961 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
1967 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_no_version_tag_serial_missing)
1970 unsigned char buf[2000];
1971 unsigned char output[2000];
1975 memset( buf, 0, 2000 );
1976 memset( output, 0, 2000 );
1978 data_len =
unhexify( buf,
"3003300100" );
1985 fct_chk( res != -1 );
1986 fct_chk( res != -2 );
1988 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
1994 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_invalid_version_tag)
1997 unsigned char buf[2000];
1998 unsigned char output[2000];
2002 memset( buf, 0, 2000 );
2003 memset( output, 0, 2000 );
2005 data_len =
unhexify( buf,
"30053003a00101" );
2012 fct_chk( res != -1 );
2013 fct_chk( res != -2 );
2015 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2021 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_version_tag_no_length)
2024 unsigned char buf[2000];
2025 unsigned char output[2000];
2029 memset( buf, 0, 2000 );
2030 memset( output, 0, 2000 );
2032 data_len =
unhexify( buf,
"30053003a00102" );
2039 fct_chk( res != -1 );
2040 fct_chk( res != -2 );
2042 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2048 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_version_tag_invalid_length)
2051 unsigned char buf[2000];
2052 unsigned char output[2000];
2056 memset( buf, 0, 2000 );
2057 memset( output, 0, 2000 );
2059 data_len =
unhexify( buf,
"30163014a012021000000000000000000000000000000000" );
2066 fct_chk( res != -1 );
2067 fct_chk( res != -2 );
2069 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2075 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_version_tag_no_serial)
2078 unsigned char buf[2000];
2079 unsigned char output[2000];
2083 memset( buf, 0, 2000 );
2084 memset( output, 0, 2000 );
2086 data_len =
unhexify( buf,
"30073005a003020104" );
2093 fct_chk( res != -1 );
2094 fct_chk( res != -2 );
2096 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2102 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_invalid_length_version_tag)
2105 unsigned char buf[2000];
2106 unsigned char output[2000];
2110 memset( buf, 0, 2000 );
2111 memset( output, 0, 2000 );
2113 data_len =
unhexify( buf,
"30083006a00402010400" );
2120 fct_chk( res != -1 );
2121 fct_chk( res != -2 );
2123 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2129 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_incorrect_serial_tag)
2132 unsigned char buf[2000];
2133 unsigned char output[2000];
2137 memset( buf, 0, 2000 );
2138 memset( output, 0, 2000 );
2140 data_len =
unhexify( buf,
"30083006a00302010400" );
2147 fct_chk( res != -1 );
2148 fct_chk( res != -2 );
2150 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2156 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_incorrect_serial_length)
2159 unsigned char buf[2000];
2160 unsigned char output[2000];
2164 memset( buf, 0, 2000 );
2165 memset( output, 0, 2000 );
2167 data_len =
unhexify( buf,
"30083006a00302010482" );
2174 fct_chk( res != -1 );
2175 fct_chk( res != -2 );
2177 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2183 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_serial_no_alg)
2186 unsigned char buf[2000];
2187 unsigned char output[2000];
2191 memset( buf, 0, 2000 );
2192 memset( output, 0, 2000 );
2194 data_len =
unhexify( buf,
"300d300ba0030201048204deadbeef" );
2201 fct_chk( res != -1 );
2202 fct_chk( res != -2 );
2204 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2210 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_serial_no_alg_oid)
2213 unsigned char buf[2000];
2214 unsigned char output[2000];
2218 memset( buf, 0, 2000 );
2219 memset( output, 0, 2000 );
2221 data_len =
unhexify( buf,
"300e300ca0030201048204deadbeef00" );
2228 fct_chk( res != -1 );
2229 fct_chk( res != -2 );
2231 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2237 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_alg_oid_no_data_in_sequence)
2240 unsigned char buf[2000];
2241 unsigned char output[2000];
2245 memset( buf, 0, 2000 );
2246 memset( output, 0, 2000 );
2248 data_len =
unhexify( buf,
"300f300da0030201048204deadbeef3000" );
2255 fct_chk( res != -1 );
2256 fct_chk( res != -2 );
2258 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2264 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_alg_with_params)
2267 unsigned char buf[2000];
2268 unsigned char output[2000];
2272 memset( buf, 0, 2000 );
2273 memset( output, 0, 2000 );
2275 data_len =
unhexify( buf,
"30163014a0030201048204deadbeef30070604cafed00d01" );
2282 fct_chk( res != -1 );
2283 fct_chk( res != -2 );
2285 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2291 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_data_no_params_unknown_version)
2294 unsigned char buf[2000];
2295 unsigned char output[2000];
2299 memset( buf, 0, 2000 );
2300 memset( output, 0, 2000 );
2302 data_len =
unhexify( buf,
"30153013a0030201048204deadbeef30060604cafed00d" );
2309 fct_chk( res != -1 );
2310 fct_chk( res != -2 );
2312 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2318 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_data_unknown_version)
2321 unsigned char buf[2000];
2322 unsigned char output[2000];
2326 memset( buf, 0, 2000 );
2327 memset( output, 0, 2000 );
2329 data_len =
unhexify( buf,
"30173015a0030201048204deadbeef30080604cafed00d0500" );
2336 fct_chk( res != -1 );
2337 fct_chk( res != -2 );
2339 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2345 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_data_length_mismatch)
2348 unsigned char buf[2000];
2349 unsigned char output[2000];
2353 memset( buf, 0, 2000 );
2354 memset( output, 0, 2000 );
2356 data_len =
unhexify( buf,
"30183016a0030201048204deadbeef30090604cafed00d050000" );
2363 fct_chk( res != -1 );
2364 fct_chk( res != -2 );
2366 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2372 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_unknown_alg_id)
2375 unsigned char buf[2000];
2376 unsigned char output[2000];
2380 memset( buf, 0, 2000 );
2381 memset( output, 0, 2000 );
2383 data_len =
unhexify( buf,
"30173015a0030201028204deadbeef30080604cafed00d0500" );
2390 fct_chk( res != -1 );
2391 fct_chk( res != -2 );
2393 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2399 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_specific_alg_id)
2402 unsigned char buf[2000];
2403 unsigned char output[2000];
2407 memset( buf, 0, 2000 );
2408 memset( output, 0, 2000 );
2410 data_len =
unhexify( buf,
"301c301aa0030201028204deadbeef300d06092a864886f70d0101020500" );
2417 fct_chk( res != -1 );
2418 fct_chk( res != -2 );
2420 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2426 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_correct_alg_unknown_specific_alg_id)
2429 unsigned char buf[2000];
2430 unsigned char output[2000];
2434 memset( buf, 0, 2000 );
2435 memset( output, 0, 2000 );
2437 data_len =
unhexify( buf,
"301c301aa0030201028204deadbeef300d06092a864886f70d0101010500" );
2444 fct_chk( res != -1 );
2445 fct_chk( res != -2 );
2447 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2453 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_set_data)
2456 unsigned char buf[2000];
2457 unsigned char output[2000];
2461 memset( buf, 0, 2000 );
2462 memset( output, 0, 2000 );
2464 data_len =
unhexify( buf,
"301e301ca0030201028204deadbeef300d06092a864886f70d01010205003000" );
2471 fct_chk( res != -1 );
2472 fct_chk( res != -2 );
2474 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2480 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_inner_seq_data)
2483 unsigned char buf[2000];
2484 unsigned char output[2000];
2488 memset( buf, 0, 2000 );
2489 memset( output, 0, 2000 );
2491 data_len =
unhexify( buf,
"3020301ea0030201028204deadbeef300d06092a864886f70d010102050030023100" );
2498 fct_chk( res != -1 );
2499 fct_chk( res != -2 );
2501 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2507 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_inner_set_data)
2510 unsigned char buf[2000];
2511 unsigned char output[2000];
2515 memset( buf, 0, 2000 );
2516 memset( output, 0, 2000 );
2518 data_len =
unhexify( buf,
"30223020a0030201028204deadbeef300d06092a864886f70d0101020500300431023000" );
2525 fct_chk( res != -1 );
2526 fct_chk( res != -2 );
2528 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2534 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_two_inner_set_datas)
2537 unsigned char buf[2000];
2538 unsigned char output[2000];
2542 memset( buf, 0, 2000 );
2543 memset( output, 0, 2000 );
2545 data_len =
unhexify( buf,
"30243022a0030201028204deadbeef300d06092a864886f70d01010205003006310430003000" );
2552 fct_chk( res != -1 );
2553 fct_chk( res != -2 );
2555 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2561 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_oid_data)
2564 unsigned char buf[2000];
2565 unsigned char output[2000];
2569 memset( buf, 0, 2000 );
2570 memset( output, 0, 2000 );
2572 data_len =
unhexify( buf,
"30243022a0030201028204deadbeef300d06092a864886f70d01010205003006310430020600" );
2579 fct_chk( res != -1 );
2580 fct_chk( res != -2 );
2582 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2588 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_invalid_tag)
2591 unsigned char buf[2000];
2592 unsigned char output[2000];
2596 memset( buf, 0, 2000 );
2597 memset( output, 0, 2000 );
2599 data_len =
unhexify( buf,
"302a3028a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600060454657374" );
2606 fct_chk( res != -1 );
2607 fct_chk( res != -2 );
2609 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2615 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_string_data)
2618 unsigned char buf[2000];
2619 unsigned char output[2000];
2623 memset( buf, 0, 2000 );
2624 memset( output, 0, 2000 );
2626 data_len =
unhexify( buf,
"30253023a0030201028204deadbeef300d06092a864886f70d0101020500300731053003060013" );
2633 fct_chk( res != -1 );
2634 fct_chk( res != -2 );
2636 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2642 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_issuer_no_full_following_string)
2645 unsigned char buf[2000];
2646 unsigned char output[2000];
2650 memset( buf, 0, 2000 );
2651 memset( output, 0, 2000 );
2653 data_len =
unhexify( buf,
"302b3029a0030201028204deadbeef300d06092a864886f70d0101020500300d310b3009060013045465737400" );
2660 fct_chk( res != -1 );
2661 fct_chk( res != -2 );
2663 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2669 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_issuer_no_validity)
2672 unsigned char buf[2000];
2673 unsigned char output[2000];
2677 memset( buf, 0, 2000 );
2678 memset( output, 0, 2000 );
2680 data_len =
unhexify( buf,
"302a3028a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374" );
2687 fct_chk( res != -1 );
2688 fct_chk( res != -2 );
2690 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2696 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_too_much_date_data)
2699 unsigned char buf[2000];
2700 unsigned char output[2000];
2704 memset( buf, 0, 2000 );
2705 memset( output, 0, 2000 );
2707 data_len =
unhexify( buf,
"30493047a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301d170c303930313031303030303030170c30393132333132333539353900" );
2714 fct_chk( res != -1 );
2715 fct_chk( res != -2 );
2717 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2723 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_invalid_from_date)
2726 unsigned char buf[2000];
2727 unsigned char output[2000];
2731 memset( buf, 0, 2000 );
2732 memset( output, 0, 2000 );
2734 data_len =
unhexify( buf,
"30483046a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303000000000170c303931323331323300000000" );
2741 fct_chk( res != -1 );
2742 fct_chk( res != -2 );
2744 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2750 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_invalid_to_date)
2753 unsigned char buf[2000];
2754 unsigned char output[2000];
2758 memset( buf, 0, 2000 );
2759 memset( output, 0, 2000 );
2761 data_len =
unhexify( buf,
"30483046a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323300000000" );
2768 fct_chk( res != -1 );
2769 fct_chk( res != -2 );
2771 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2777 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_validity_no_subject)
2780 unsigned char buf[2000];
2781 unsigned char output[2000];
2785 memset( buf, 0, 2000 );
2786 memset( output, 0, 2000 );
2788 data_len =
unhexify( buf,
"30493047a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c30393132333132333539353930" );
2795 fct_chk( res != -1 );
2796 fct_chk( res != -2 );
2798 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2804 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_subject_no_pubkeyinfo)
2807 unsigned char buf[2000];
2808 unsigned char output[2000];
2812 memset( buf, 0, 2000 );
2813 memset( output, 0, 2000 );
2815 data_len =
unhexify( buf,
"30563054a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374" );
2822 fct_chk( res != -1 );
2823 fct_chk( res != -2 );
2825 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2831 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_no_alg)
2834 unsigned char buf[2000];
2835 unsigned char output[2000];
2839 memset( buf, 0, 2000 );
2840 memset( output, 0, 2000 );
2842 data_len =
unhexify( buf,
"30583056a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743000" );
2849 fct_chk( res != -1 );
2850 fct_chk( res != -2 );
2852 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2858 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_valid_subject_unknown_pk_alg)
2861 unsigned char buf[2000];
2862 unsigned char output[2000];
2866 memset( buf, 0, 2000 );
2867 memset( output, 0, 2000 );
2869 data_len =
unhexify( buf,
"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101000500" );
2876 fct_chk( res != -1 );
2877 fct_chk( res != -2 );
2879 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2885 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_no_bitstring)
2888 unsigned char buf[2000];
2889 unsigned char output[2000];
2893 memset( buf, 0, 2000 );
2894 memset( output, 0, 2000 );
2896 data_len =
unhexify( buf,
"30673065a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374300f300d06092A864886F70D0101010500" );
2903 fct_chk( res != -1 );
2904 fct_chk( res != -2 );
2906 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2912 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_no_bitstring_data)
2915 unsigned char buf[2000];
2916 unsigned char output[2000];
2920 memset( buf, 0, 2000 );
2921 memset( output, 0, 2000 );
2923 data_len =
unhexify( buf,
"30693067a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743011300d06092A864886F70D01010105000300" );
2930 fct_chk( res != -1 );
2931 fct_chk( res != -2 );
2933 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2939 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_invalid_bitstring_start)
2942 unsigned char buf[2000];
2943 unsigned char output[2000];
2947 memset( buf, 0, 2000 );
2948 memset( output, 0, 2000 );
2950 data_len =
unhexify( buf,
"306a3068a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743012300d06092A864886F70D0101010500030101" );
2957 fct_chk( res != -1 );
2958 fct_chk( res != -2 );
2960 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2966 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_invalid_internal_bitstring_length)
2969 unsigned char buf[2000];
2970 unsigned char output[2000];
2974 memset( buf, 0, 2000 );
2975 memset( output, 0, 2000 );
2977 data_len =
unhexify( buf,
"306d306ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400300000" );
2984 fct_chk( res != -1 );
2985 fct_chk( res != -2 );
2987 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
2993 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_invalid_internal_bitstring_tag)
2996 unsigned char buf[2000];
2997 unsigned char output[2000];
3001 memset( buf, 0, 2000 );
3002 memset( output, 0, 2000 );
3004 data_len =
unhexify( buf,
"306d306ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400310000" );
3011 fct_chk( res != -1 );
3012 fct_chk( res != -2 );
3014 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3020 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_invalid_mpi)
3023 unsigned char buf[2000];
3024 unsigned char output[2000];
3028 memset( buf, 0, 2000 );
3029 memset( output, 0, 2000 );
3031 data_len =
unhexify( buf,
"30743072a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0302ffff" );
3038 fct_chk( res != -1 );
3039 fct_chk( res != -2 );
3041 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3047 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_total_length_mismatch)
3050 unsigned char buf[2000];
3051 unsigned char output[2000];
3055 memset( buf, 0, 2000 );
3056 memset( output, 0, 2000 );
3058 data_len =
unhexify( buf,
"30753073a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301d300d06092A864886F70D0101010500030b0030080202ffff0202ffff00" );
3065 fct_chk( res != -1 );
3066 fct_chk( res != -2 );
3068 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3074 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_check_failed)
3077 unsigned char buf[2000];
3078 unsigned char output[2000];
3082 memset( buf, 0, 2000 );
3083 memset( output, 0, 2000 );
3085 data_len =
unhexify( buf,
"30743072a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0202ffff" );
3092 fct_chk( res != -1 );
3093 fct_chk( res != -2 );
3095 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3101 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_pubkey_check_failed_expanded_length_notation)
3104 unsigned char buf[2000];
3105 unsigned char output[2000];
3109 memset( buf, 0, 2000 );
3110 memset( output, 0, 2000 );
3112 data_len =
unhexify( buf,
"308183308180a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210fffffffffffffffffffffffffffffffe0202ffff" );
3119 fct_chk( res != -1 );
3120 fct_chk( res != -2 );
3122 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3128 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_optional_uids_extensions_not_present)
3131 unsigned char buf[2000];
3132 unsigned char output[2000];
3136 memset( buf, 0, 2000 );
3137 memset( output, 0, 2000 );
3139 data_len =
unhexify( buf,
"308183308180a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff" );
3146 fct_chk( res != -1 );
3147 fct_chk( res != -2 );
3149 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3155 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_issuerid_wrong_tag)
3158 unsigned char buf[2000];
3159 unsigned char output[2000];
3163 memset( buf, 0, 2000 );
3164 memset( output, 0, 2000 );
3166 data_len =
unhexify( buf,
"308184308181a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff00" );
3173 fct_chk( res != -1 );
3174 fct_chk( res != -2 );
3176 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3182 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_uids_no_ext)
3185 unsigned char buf[2000];
3186 unsigned char output[2000];
3190 memset( buf, 0, 2000 );
3191 memset( output, 0, 2000 );
3193 data_len =
unhexify( buf,
"308189308186a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bb" );
3200 fct_chk( res != -1 );
3201 fct_chk( res != -2 );
3203 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3209 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_uids_invalid_length)
3212 unsigned char buf[2000];
3213 unsigned char output[2000];
3217 memset( buf, 0, 2000 );
3218 memset( output, 0, 2000 );
3220 data_len =
unhexify( buf,
"308189308186a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa185aaa201bb" );
3227 fct_chk( res != -1 );
3228 fct_chk( res != -2 );
3230 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3236 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_empty)
3239 unsigned char buf[2000];
3240 unsigned char output[2000];
3244 memset( buf, 0, 2000 );
3245 memset( output, 0, 2000 );
3247 data_len =
unhexify( buf,
"30818b308188a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba300" );
3254 fct_chk( res != -1 );
3255 fct_chk( res != -2 );
3257 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3263 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_length_mismatch)
3266 unsigned char buf[2000];
3267 unsigned char output[2000];
3271 memset( buf, 0, 2000 );
3272 memset( output, 0, 2000 );
3274 data_len =
unhexify( buf,
"30818e30818ba0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba303300000" );
3281 fct_chk( res != -1 );
3282 fct_chk( res != -2 );
3284 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3290 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_first_ext_invalid)
3293 unsigned char buf[2000];
3294 unsigned char output[2000];
3298 memset( buf, 0, 2000 );
3299 memset( output, 0, 2000 );
3301 data_len =
unhexify( buf,
"30818f30818ca0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30330023000" );
3308 fct_chk( res != -1 );
3309 fct_chk( res != -2 );
3311 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3317 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_first_ext_invalid_tag)
3320 unsigned char buf[2000];
3321 unsigned char output[2000];
3325 memset( buf, 0, 2000 );
3326 memset( output, 0, 2000 );
3328 data_len =
unhexify( buf,
"30819030818da0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba3043002310000" );
3335 fct_chk( res != -1 );
3336 fct_chk( res != -2 );
3338 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3344 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_bool_len_missing)
3347 unsigned char buf[2000];
3348 unsigned char output[2000];
3352 memset( buf, 0, 2000 );
3353 memset( output, 0, 2000 );
3355 data_len =
unhexify( buf,
"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30c300a30060603551d1301010100" );
3362 fct_chk( res != -1 );
3363 fct_chk( res != -2 );
3365 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3371 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_data_missing)
3374 unsigned char buf[2000];
3375 unsigned char output[2000];
3379 memset( buf, 0, 2000 );
3380 memset( output, 0, 2000 );
3382 data_len =
unhexify( buf,
"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30c300a30080603551d1301010100" );
3389 fct_chk( res != -1 );
3390 fct_chk( res != -2 );
3392 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3398 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_no_octet_present)
3401 unsigned char buf[2000];
3402 unsigned char output[2000];
3406 memset( buf, 0, 2000 );
3407 memset( output, 0, 2000 );
3409 data_len =
unhexify( buf,
"308198308195a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba30d300b30090603551d1301010100" );
3416 fct_chk( res != -1 );
3417 fct_chk( res != -2 );
3419 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3425 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_octet_data_missing)
3428 unsigned char buf[2000];
3429 unsigned char output[2000];
3433 memset( buf, 0, 2000 );
3434 memset( output, 0, 2000 );
3436 data_len =
unhexify( buf,
"30819c308199a0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba311300f300d0603551d130101010403300100" );
3443 fct_chk( res != -1 );
3444 fct_chk( res != -2 );
3446 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3452 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_no_pathlen)
3455 unsigned char buf[2000];
3456 unsigned char output[2000];
3460 memset( buf, 0, 2000 );
3461 memset( output, 0, 2000 );
3463 data_len =
unhexify( buf,
"30819f30819ca0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba314301230100603551d130101010406300402010102" );
3470 fct_chk( res != -1 );
3471 fct_chk( res != -2 );
3473 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3479 FCT_TEST_BGN(x509_certificate_asn1_tbscertificate_v3_ext_basiccontraint_tag_octet_len_mismatch)
3482 unsigned char buf[2000];
3483 unsigned char output[2000];
3487 memset( buf, 0, 2000 );
3488 memset( output, 0, 2000 );
3490 data_len =
unhexify( buf,
"3081a230819fa0030201028204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffffa101aaa201bba317301530130603551d130101010409300702010102010100" );
3497 fct_chk( res != -1 );
3498 fct_chk( res != -2 );
3500 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3506 FCT_TEST_BGN(x509_certificate_asn1_correct_pubkey_no_sig_alg)
3509 unsigned char buf[2000];
3510 unsigned char output[2000];
3514 memset( buf, 0, 2000 );
3515 memset( output, 0, 2000 );
3517 data_len =
unhexify( buf,
"308183308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff" );
3524 fct_chk( res != -1 );
3525 fct_chk( res != -2 );
3527 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3533 FCT_TEST_BGN(x509_certificate_asn1_sig_alg_mismatch)
3536 unsigned char buf[2000];
3537 unsigned char output[2000];
3541 memset( buf, 0, 2000 );
3542 memset( output, 0, 2000 );
3544 data_len =
unhexify( buf,
"308192308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0102020500" );
3551 fct_chk( res != -1 );
3552 fct_chk( res != -2 );
3554 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3560 FCT_TEST_BGN(x509_certificate_asn1_sig_alg_no_sig)
3563 unsigned char buf[2000];
3564 unsigned char output[2000];
3568 memset( buf, 0, 2000 );
3569 memset( output, 0, 2000 );
3571 data_len =
unhexify( buf,
"308192308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500" );
3578 fct_chk( res != -1 );
3579 fct_chk( res != -2 );
3581 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3587 FCT_TEST_BGN(x509_certificate_asn1_signature_invalid_sig_data)
3590 unsigned char buf[2000];
3591 unsigned char output[2000];
3595 memset( buf, 0, 2000 );
3596 memset( output, 0, 2000 );
3598 data_len =
unhexify( buf,
"308195308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030100" );
3605 fct_chk( res != -1 );
3606 fct_chk( res != -2 );
3608 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3614 FCT_TEST_BGN(x509_certificate_asn1_signature_data_left)
3617 unsigned char buf[2000];
3618 unsigned char output[2000];
3622 memset( buf, 0, 2000 );
3623 memset( output, 0, 2000 );
3625 data_len =
unhexify( buf,
"308197308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff00" );
3632 fct_chk( res != -1 );
3633 fct_chk( res != -2 );
3635 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3641 FCT_TEST_BGN(x509_certificate_asn1_correct)
3644 unsigned char buf[2000];
3645 unsigned char output[2000];
3649 memset( buf, 0, 2000 );
3650 memset( output, 0, 2000 );
3652 data_len =
unhexify( buf,
"308196308180a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3659 fct_chk( res != -1 );
3660 fct_chk( res != -2 );
3662 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : ?\?=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3668 FCT_TEST_BGN(x509_certificate_asn1_generalizedtime_instead_of_utctime)
3671 unsigned char buf[2000];
3672 unsigned char output[2000];
3676 memset( buf, 0, 2000 );
3677 memset( output, 0, 2000 );
3679 data_len =
unhexify( buf,
"308198308182a0030201008204deadbeef300d06092a864886f70d0101020500300c310a30080600130454657374301e180e3230313030313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3686 fct_chk( res != -1 );
3687 fct_chk( res != -2 );
3689 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : ?\?=Test\nsubject name : ?\?=Test\nissued on : 2010-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3695 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_cn)
3698 unsigned char buf[2000];
3699 unsigned char output[2000];
3703 memset( buf, 0, 2000 );
3704 memset( output, 0, 2000 );
3706 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550403130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3713 fct_chk( res != -1 );
3714 fct_chk( res != -2 );
3716 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : CN=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3722 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_c)
3725 unsigned char buf[2000];
3726 unsigned char output[2000];
3730 memset( buf, 0, 2000 );
3731 memset( output, 0, 2000 );
3733 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550406130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3740 fct_chk( res != -1 );
3741 fct_chk( res != -2 );
3743 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : C=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3749 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_l)
3752 unsigned char buf[2000];
3753 unsigned char output[2000];
3757 memset( buf, 0, 2000 );
3758 memset( output, 0, 2000 );
3760 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550407130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3767 fct_chk( res != -1 );
3768 fct_chk( res != -2 );
3770 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : L=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3776 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_st)
3779 unsigned char buf[2000];
3780 unsigned char output[2000];
3784 memset( buf, 0, 2000 );
3785 memset( output, 0, 2000 );
3787 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b0603550408130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3794 fct_chk( res != -1 );
3795 fct_chk( res != -2 );
3797 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : ST=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3803 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_o)
3806 unsigned char buf[2000];
3807 unsigned char output[2000];
3811 memset( buf, 0, 2000 );
3812 memset( output, 0, 2000 );
3814 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b060355040a130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3821 fct_chk( res != -1 );
3822 fct_chk( res != -2 );
3824 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : O=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3830 FCT_TEST_BGN(x509_certificate_asn1_name_with_x520_ou)
3833 unsigned char buf[2000];
3834 unsigned char output[2000];
3838 memset( buf, 0, 2000 );
3839 memset( output, 0, 2000 );
3841 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b060355040b130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3848 fct_chk( res != -1 );
3849 fct_chk( res != -2 );
3851 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : OU=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3857 FCT_TEST_BGN(x509_certificate_asn1_name_with_unknown_x520_part)
3860 unsigned char buf[2000];
3861 unsigned char output[2000];
3865 memset( buf, 0, 2000 );
3866 memset( output, 0, 2000 );
3868 data_len =
unhexify( buf,
"308199308183a0030201008204deadbeef300d06092a864886f70d0101020500300f310d300b06035504de130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3875 fct_chk( res != -1 );
3876 fct_chk( res != -2 );
3878 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : 0xDE=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3884 FCT_TEST_BGN(x509_certificate_asn1_name_with_pkcs9_email)
3887 unsigned char buf[2000];
3888 unsigned char output[2000];
3892 memset( buf, 0, 2000 );
3893 memset( output, 0, 2000 );
3895 data_len =
unhexify( buf,
"30819f308189a0030201008204deadbeef300d06092a864886f70d010102050030153113301106092a864886f70d010901130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3902 fct_chk( res != -1 );
3903 fct_chk( res != -2 );
3905 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : emailAddress=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3911 FCT_TEST_BGN(x509_certificate_asn1_name_with_unknown_pkcs9_part)
3914 unsigned char buf[2000];
3915 unsigned char output[2000];
3919 memset( buf, 0, 2000 );
3920 memset( output, 0, 2000 );
3922 data_len =
unhexify( buf,
"30819f308189a0030201008204deadbeef300d06092a864886f70d010102050030153113301106092a864886f70d0109ab130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210ffffffffffffffffffffffffffffffff0202ffff300d06092a864886f70d0101020500030200ff" );
3929 fct_chk( res != -1 );
3930 fct_chk( res != -2 );
3932 fct_chk( strcmp( (
char *) output,
"cert. version : 1\nserial number : DE:AD:BE:EF\nissuer name : 0xAB=Test\nsubject name : ?\?=Test\nissued on : 2009-01-01 00:00:00\nexpires on : 2009-12-31 23:59:59\nsigned using : RSA+MD2\nRSA key size : 128 bits\n" ) == 0 );
3938 FCT_TEST_BGN(x509_crl_asn1_incorrect_first_tag)
3941 unsigned char buf[2000];
3942 unsigned char output[2000];
3945 memset( &crl, 0,
sizeof(
x509_crl ) );
3946 memset( buf, 0, 2000 );
3947 memset( output, 0, 2000 );
3956 fct_chk( res != -1 );
3957 fct_chk( res != -2 );
3959 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3965 FCT_TEST_BGN(x509_crl_asn1_correct_first_tag_data_length_does_not_match)
3968 unsigned char buf[2000];
3969 unsigned char output[2000];
3972 memset( &crl, 0,
sizeof(
x509_crl ) );
3973 memset( buf, 0, 2000 );
3974 memset( output, 0, 2000 );
3976 data_len =
unhexify( buf,
"300000" );
3983 fct_chk( res != -1 );
3984 fct_chk( res != -2 );
3986 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
3992 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_tag_missing)
3995 unsigned char buf[2000];
3996 unsigned char output[2000];
3999 memset( &crl, 0,
sizeof(
x509_crl ) );
4000 memset( buf, 0, 2000 );
4001 memset( output, 0, 2000 );
4003 data_len =
unhexify( buf,
"3000" );
4010 fct_chk( res != -1 );
4011 fct_chk( res != -2 );
4013 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4019 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_version_tag_len_missing)
4022 unsigned char buf[2000];
4023 unsigned char output[2000];
4026 memset( &crl, 0,
sizeof(
x509_crl ) );
4027 memset( buf, 0, 2000 );
4028 memset( output, 0, 2000 );
4030 data_len =
unhexify( buf,
"3003300102" );
4037 fct_chk( res != -1 );
4038 fct_chk( res != -2 );
4040 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4046 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_version_correct_alg_missing)
4049 unsigned char buf[2000];
4050 unsigned char output[2000];
4053 memset( &crl, 0,
sizeof(
x509_crl ) );
4054 memset( buf, 0, 2000 );
4055 memset( output, 0, 2000 );
4057 data_len =
unhexify( buf,
"30053003020100" );
4064 fct_chk( res != -1 );
4065 fct_chk( res != -2 );
4067 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4073 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_alg_correct_incorrect_version)
4076 unsigned char buf[2000];
4077 unsigned char output[2000];
4080 memset( &crl, 0,
sizeof(
x509_crl ) );
4081 memset( buf, 0, 2000 );
4082 memset( output, 0, 2000 );
4084 data_len =
unhexify( buf,
"300b3009020102300406000500" );
4091 fct_chk( res != -1 );
4092 fct_chk( res != -2 );
4094 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4100 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_correct_version_sig_oid1_unknown)
4103 unsigned char buf[2000];
4104 unsigned char output[2000];
4107 memset( &crl, 0,
sizeof(
x509_crl ) );
4108 memset( buf, 0, 2000 );
4109 memset( output, 0, 2000 );
4111 data_len =
unhexify( buf,
"300b3009020100300406000500" );
4118 fct_chk( res != -1 );
4119 fct_chk( res != -2 );
4121 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4127 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_oid1_id_unknown)
4130 unsigned char buf[2000];
4131 unsigned char output[2000];
4134 memset( &crl, 0,
sizeof(
x509_crl ) );
4135 memset( buf, 0, 2000 );
4136 memset( output, 0, 2000 );
4138 data_len =
unhexify( buf,
"30143012020100300d06092a864886f70d01010f0500" );
4145 fct_chk( res != -1 );
4146 fct_chk( res != -2 );
4148 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4154 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_oid1_correct_issuer_missing)
4157 unsigned char buf[2000];
4158 unsigned char output[2000];
4161 memset( &crl, 0,
sizeof(
x509_crl ) );
4162 memset( buf, 0, 2000 );
4163 memset( output, 0, 2000 );
4165 data_len =
unhexify( buf,
"30143012020100300d06092a864886f70d01010e0500" );
4172 fct_chk( res != -1 );
4173 fct_chk( res != -2 );
4175 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4181 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_issuer_set_missing)
4184 unsigned char buf[2000];
4185 unsigned char output[2000];
4188 memset( &crl, 0,
sizeof(
x509_crl ) );
4189 memset( buf, 0, 2000 );
4190 memset( output, 0, 2000 );
4192 data_len =
unhexify( buf,
"30163014020100300d06092a864886f70d01010e05003000" );
4199 fct_chk( res != -1 );
4200 fct_chk( res != -2 );
4202 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4208 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_correct_issuer_thisupdate_missing)
4211 unsigned char buf[2000];
4212 unsigned char output[2000];
4215 memset( &crl, 0,
sizeof(
x509_crl ) );
4216 memset( buf, 0, 2000 );
4217 memset( output, 0, 2000 );
4219 data_len =
unhexify( buf,
"30253023020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344" );
4226 fct_chk( res != -1 );
4227 fct_chk( res != -2 );
4229 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4235 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_correct_thisupdate_nextupdate_missing_entries_length_missing)
4238 unsigned char buf[2000];
4239 unsigned char output[2000];
4242 memset( &crl, 0,
sizeof(
x509_crl ) );
4243 memset( buf, 0, 2000 );
4244 memset( output, 0, 2000 );
4246 data_len =
unhexify( buf,
"30343032020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c30393031303130303030303030" );
4253 fct_chk( res != -1 );
4254 fct_chk( res != -2 );
4256 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4262 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_entries_present_invalid_sig_alg)
4265 unsigned char buf[2000];
4266 unsigned char output[2000];
4269 memset( &crl, 0,
sizeof(
x509_crl ) );
4270 memset( buf, 0, 2000 );
4271 memset( output, 0, 2000 );
4273 data_len =
unhexify( buf,
"304a3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c30383132333132333539353900" );
4280 fct_chk( res != -1 );
4281 fct_chk( res != -2 );
4283 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4289 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_entries_present_date_in_entry_invalid)
4292 unsigned char buf[2000];
4293 unsigned char output[2000];
4296 memset( &crl, 0,
sizeof(
x509_crl ) );
4297 memset( buf, 0, 2000 );
4298 memset( output, 0, 2000 );
4300 data_len =
unhexify( buf,
"304a3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd190c30383132333132333539353900" );
4307 fct_chk( res != -1 );
4308 fct_chk( res != -2 );
4310 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4316 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_alg_present_sig_alg_does_not_match)
4319 unsigned char buf[2000];
4320 unsigned char output[2000];
4323 memset( &crl, 0,
sizeof(
x509_crl ) );
4324 memset( buf, 0, 2000 );
4325 memset( output, 0, 2000 );
4327 data_len =
unhexify( buf,
"30583047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010d0500" );
4334 fct_chk( res != -1 );
4335 fct_chk( res != -2 );
4337 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4343 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_present_len_mismatch)
4346 unsigned char buf[2000];
4347 unsigned char output[2000];
4350 memset( &crl, 0,
sizeof(
x509_crl ) );
4351 memset( buf, 0, 2000 );
4352 memset( output, 0, 2000 );
4354 data_len =
unhexify( buf,
"305d3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010e05000302000100" );
4361 fct_chk( res != -1 );
4362 fct_chk( res != -2 );
4364 fct_chk( strcmp( (
char *) output,
"" ) == 0 );
4370 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_sig_present)
4373 unsigned char buf[2000];
4374 unsigned char output[2000];
4377 memset( &crl, 0,
sizeof(
x509_crl ) );
4378 memset( buf, 0, 2000 );
4379 memset( output, 0, 2000 );
4381 data_len =
unhexify( buf,
"305c3047020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030301430128202abcd170c303831323331323335393539300d06092a864886f70d01010e050003020001" );
4388 fct_chk( res != -1 );
4389 fct_chk( res != -2 );
4391 fct_chk( strcmp( (
char *) output,
"CRL version : 1\nissuer name : CN=ABCD\nthis update : 2009-01-01 00:00:00\nnext update : 0000-00-00 00:00:00\nRevoked certificates:\nserial number: AB:CD revocation date: 2008-12-31 23:59:59\nsigned using : RSA+SHA224\n" ) == 0 );
4397 FCT_TEST_BGN(x509_crl_asn1_tbscertlist_no_entries)
4400 unsigned char buf[2000];
4401 unsigned char output[2000];
4404 memset( &crl, 0,
sizeof(
x509_crl ) );
4405 memset( buf, 0, 2000 );
4406 memset( output, 0, 2000 );
4408 data_len =
unhexify( buf,
"30463031020100300d06092a864886f70d01010e0500300f310d300b0603550403130441424344170c303930313031303030303030300d06092a864886f70d01010e050003020001" );
4415 fct_chk( res != -1 );
4416 fct_chk( res != -2 );
4418 fct_chk( strcmp( (
char *) output,
"CRL version : 1\nissuer name : CN=ABCD\nthis update : 2009-01-01 00:00:00\nnext update : 0000-00-00 00:00:00\nRevoked certificates:\nsigned using : RSA+SHA224\n" ) == 0 );
4424 FCT_TEST_BGN(x509_key_asn1_incorrect_first_tag)
4427 unsigned char buf[2000];
4428 unsigned char output[2000];
4432 memset( buf, 0, 2000 );
4433 memset( output, 0, 2000 );
4448 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_incorrect_version_tag)
4451 unsigned char buf[2000];
4452 unsigned char output[2000];
4456 memset( buf, 0, 2000 );
4457 memset( output, 0, 2000 );
4459 data_len =
unhexify( buf,
"300100" );
4472 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_version_tag_missing)
4475 unsigned char buf[2000];
4476 unsigned char output[2000];
4480 memset( buf, 0, 2000 );
4481 memset( output, 0, 2000 );
4483 data_len =
unhexify( buf,
"3000" );
4496 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_invalid_version)
4499 unsigned char buf[2000];
4500 unsigned char output[2000];
4504 memset( buf, 0, 2000 );
4505 memset( output, 0, 2000 );
4507 data_len =
unhexify( buf,
"3003020101" );
4520 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_correct_version_incorrect_tag)
4523 unsigned char buf[2000];
4524 unsigned char output[2000];
4528 memset( buf, 0, 2000 );
4529 memset( output, 0, 2000 );
4531 data_len =
unhexify( buf,
"300402010000" );
4544 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_values_present_length_mismatch)
4547 unsigned char buf[2000];
4548 unsigned char output[2000];
4552 memset( buf, 0, 2000 );
4553 memset( output, 0, 2000 );
4555 data_len =
unhexify( buf,
"301c02010002010102010102010102010102010102010102010102010100" );
4568 FCT_TEST_BGN(x509_key_asn1_rsaprivatekey_values_present_check_privkey_fails)
4571 unsigned char buf[2000];
4572 unsigned char output[2000];
4576 memset( buf, 0, 2000 );
4577 memset( output, 0, 2000 );
4579 data_len =
unhexify( buf,
"301b020100020101020101020101020101020101020101020101020101" );