Lines Matching refs:crt

66 static int verify_none(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
69 ((void) crt);
76 static int verify_all(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
79 ((void) crt);
148 static int verify_fatal(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
152 ((void) crt);
204 static int verify_print(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
215 ret = mbedtls_x509_serial_gets(p, n, &crt->serial);
221 ret = mbedtls_x509_dn_gets(p, n, &crt->subject);
324 static int parse_crt_ext_cb(void *p_ctx, mbedtls_x509_crt const *crt, mbedtls_x509_buf const *oid,
327 (void) crt;
465 mbedtls_x509_crt crt;
468 mbedtls_x509_crt_init(&crt);
471 crt.ext_types = ext_type;
473 TEST_EQUAL(mbedtls_x509_crt_has_ext_type(&crt, has_ext_type), expected_result);
476 mbedtls_x509_crt_free(&crt);
498 mbedtls_x509_crt crt;
505 mbedtls_x509_crt_init(&crt);
509 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), parse_result);
514 if (crt.ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME) {
515 cur = &crt.subject_alt_names;
534 mbedtls_x509_crt_free(&crt);
542 mbedtls_x509_crt crt;
546 mbedtls_x509_crt_init(&crt);
550 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
551 res = mbedtls_x509_crt_info(buf, 2000, "", &crt);
559 mbedtls_x509_crt_free(&crt);
659 mbedtls_x509_crt crt;
673 mbedtls_x509_crt_init(&crt);
677 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
684 ret = mbedtls_x509_crt_verify_restartable(&crt, &ca, NULL,
696 ret = mbedtls_x509_crt_verify_restartable(&crt, &ca, NULL,
703 mbedtls_x509_crt_free(&crt);
715 mbedtls_x509_crt crt;
724 mbedtls_x509_crt_init(&crt);
757 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
761 res = mbedtls_x509_crt_verify_with_profile(&crt,
779 res = mbedtls_x509_crt_verify_with_ca_cb(&crt,
793 mbedtls_x509_crt_free(&crt);
805 mbedtls_x509_crt crt;
809 mbedtls_x509_crt_init(&crt);
813 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
820 ret = mbedtls_x509_crt_verify_with_ca_cb(&crt, ca_callback_fail, &ca,
827 mbedtls_x509_crt_free(&crt);
838 mbedtls_x509_crt crt;
843 mbedtls_x509_crt_init(&crt);
849 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
856 ret = mbedtls_x509_crt_verify_with_profile(&crt, &ca, NULL,
865 mbedtls_x509_crt_free(&crt);
877 mbedtls_x509_crt crt;
881 mbedtls_x509_crt_init(&crt);
886 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
887 crt.subject.next->val.p = (unsigned char *) new_subject_ou;
888 crt.subject.next->val.len = strlen(new_subject_ou);
890 res = mbedtls_x509_dn_gets(buf, 2000, &crt.subject);
900 mbedtls_x509_crt_free(&crt);
908 mbedtls_x509_crt crt;
912 mbedtls_x509_crt_init(&crt);
917 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
919 res = mbedtls_x509_dn_gets(buf, 2000, &crt.subject);
921 res = mbedtls_x509_dn_gets(buf, 2000, &crt.issuer);
932 mbedtls_x509_crt_free(&crt);
1038 mbedtls_x509_crt crt;
1040 mbedtls_x509_crt_init(&crt);
1043 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
1046 TEST_EQUAL(mbedtls_x509_time_is_past(&crt.valid_from), result);
1048 TEST_EQUAL(mbedtls_x509_time_is_past(&crt.valid_to), result);
1054 mbedtls_x509_crt_free(&crt);
1062 mbedtls_x509_crt crt;
1064 mbedtls_x509_crt_init(&crt);
1067 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
1070 TEST_EQUAL(mbedtls_x509_time_is_future(&crt.valid_from), result);
1072 TEST_EQUAL(mbedtls_x509_time_is_future(&crt.valid_to), result);
1078 mbedtls_x509_crt_free(&crt);
1086 mbedtls_x509_crt crt;
1088 mbedtls_x509_crt_init(&crt);
1091 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), result);
1094 mbedtls_x509_crt_free(&crt);
1102 mbedtls_x509_crt crt;
1103 mbedtls_x509_crt_init(&crt);
1106 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
1107 TEST_EQUAL(mbedtls_x509_crt_get_ca_istrue(&crt), result);
1109 mbedtls_x509_crt_free(&crt);
1117 mbedtls_x509_crt crt;
1125 mbedtls_x509_crt_init(&crt);
1128 TEST_EQUAL(mbedtls_x509_crt_parse_der(&crt, buf->x, buf->len), result);
1131 res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
1140 mbedtls_x509_crt_free(&crt);
1141 mbedtls_x509_crt_init(&crt);
1143 TEST_EQUAL(mbedtls_x509_crt_parse_der_nocopy(&crt, buf->x, buf->len), result);
1148 res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
1158 mbedtls_x509_crt_free(&crt);
1159 mbedtls_x509_crt_init(&crt);
1161 TEST_EQUAL(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len, 0, NULL, NULL),
1165 res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
1175 mbedtls_x509_crt_free(&crt);
1176 mbedtls_x509_crt_init(&crt);
1178 TEST_EQUAL(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len, 1, NULL, NULL),
1182 res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
1192 mbedtls_x509_crt_free(&crt);
1200 mbedtls_x509_crt crt;
1214 mbedtls_x509_crt_init(&crt);
1217 TEST_EQUAL(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len, 0, parse_crt_ext_cb,
1221 res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
1231 mbedtls_x509_crt_free(&crt);
1232 mbedtls_x509_crt_init(&crt);
1234 TEST_EQUAL(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len, 1, parse_crt_ext_cb,
1238 res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
1248 mbedtls_x509_crt_free(&crt);
1428 * We expect chain_dir to contain certificates 00.crt, 01.crt, etc.
1429 * with NN.crt signed by NN-1.crt
1563 mbedtls_x509_crt crt;
1565 mbedtls_x509_crt_init(&crt);
1568 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
1570 TEST_EQUAL(mbedtls_x509_crt_check_key_usage(&crt, usage), ret);
1573 mbedtls_x509_crt_free(&crt);
1582 mbedtls_x509_crt crt;
1584 mbedtls_x509_crt_init(&crt);
1587 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, crt_file), 0);
1589 TEST_EQUAL(mbedtls_x509_crt_check_extended_key_usage(&crt, (const char *) oid->x, oid->len),
1593 mbedtls_x509_crt_free(&crt);
1665 mbedtls_x509_crt crt;
1667 mbedtls_x509_crt_init(&crt);
1669 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, file), ref_ret);
1672 TEST_EQUAL(crt.subject_key_id.tag, MBEDTLS_ASN1_OCTET_STRING);
1673 TEST_EQUAL(memcmp(crt.subject_key_id.p, subjectKeyId->x, subjectKeyId->len), 0);
1674 TEST_EQUAL(crt.subject_key_id.len, subjectKeyId->len);
1676 TEST_EQUAL(crt.subject_key_id.tag, 0);
1677 TEST_EQUAL(crt.subject_key_id.len, 0);
1681 mbedtls_x509_crt_free(&crt);
1692 mbedtls_x509_crt crt;
1696 mbedtls_x509_crt_init(&crt);
1698 TEST_EQUAL(mbedtls_x509_crt_parse_file(&crt, file), ref_ret);
1703 TEST_EQUAL(crt.authority_key_id.keyIdentifier.tag, MBEDTLS_ASN1_OCTET_STRING);
1704 TEST_EQUAL(memcmp(crt.authority_key_id.keyIdentifier.p, keyId->x, keyId->len), 0);
1705 TEST_EQUAL(crt.authority_key_id.keyIdentifier.len, keyId->len);
1707 TEST_EQUAL(crt.authority_key_id.keyIdentifier.tag, 0);
1708 TEST_EQUAL(crt.authority_key_id.keyIdentifier.len, 0);
1714 mbedtls_x509_sequence *issuerPtr = &crt.authority_key_id.authorityCertIssuer;
1728 TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.tag,
1730 TEST_EQUAL(memcmp(crt.authority_key_id.authorityCertSerialNumber.p,
1732 TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.len, serial->len);
1734 TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.tag, 0);
1735 TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.len, 0);
1739 TEST_EQUAL(crt.authority_key_id.keyIdentifier.tag, 0);
1740 TEST_EQUAL(crt.authority_key_id.keyIdentifier.len, 0);
1742 TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.tag, 0);
1743 TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.len, 0);
1747 mbedtls_x509_crt_free(&crt);