Lines Matching refs:ret

406     int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;  in x509_get_version()  local
409 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_get_version()
412 if (ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG) { in x509_get_version()
417 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret); in x509_get_version()
422 if ((ret = mbedtls_asn1_get_int(p, end, ver)) != 0) { in x509_get_version()
423 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_VERSION, ret); in x509_get_version()
444 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_get_dates() local
447 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_get_dates()
449 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_DATE, ret); in x509_get_dates()
454 if ((ret = mbedtls_x509_get_time(p, end, from)) != 0) { in x509_get_dates()
455 return ret; in x509_get_dates()
458 if ((ret = mbedtls_x509_get_time(p, end, to)) != 0) { in x509_get_dates()
459 return ret; in x509_get_dates()
477 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_get_uid() local
485 if ((ret = mbedtls_asn1_get_tag(p, end, &uid->len, in x509_get_uid()
488 if (ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG) { in x509_get_uid()
492 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret); in x509_get_uid()
506 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_get_basic_constraints() local
517 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_get_basic_constraints()
519 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_basic_constraints()
526 if ((ret = mbedtls_asn1_get_bool(p, end, ca_istrue)) != 0) { in x509_get_basic_constraints()
527 if (ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG) { in x509_get_basic_constraints()
528 ret = mbedtls_asn1_get_int(p, end, ca_istrue); in x509_get_basic_constraints()
531 if (ret != 0) { in x509_get_basic_constraints()
532 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_basic_constraints()
544 if ((ret = mbedtls_asn1_get_int(p, end, max_pathlen)) != 0) { in x509_get_basic_constraints()
545 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_basic_constraints()
574 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_get_ext_key_usage() local
576 if ((ret = mbedtls_asn1_get_sequence_of(p, end, ext_key_usage, MBEDTLS_ASN1_OID)) != 0) { in x509_get_ext_key_usage()
577 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_ext_key_usage()
642 int ret, parse_ret = 0; in x509_get_certificate_policies() local
648 ret = mbedtls_asn1_get_tag(p, end, &len, in x509_get_certificate_policies()
650 if (ret != 0) { in x509_get_certificate_policies()
651 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_certificate_policies()
674 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_get_certificate_policies()
676 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_certificate_policies()
681 if ((ret = mbedtls_asn1_get_tag(p, policy_end, &len, in x509_get_certificate_policies()
683 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_certificate_policies()
729 if ((ret = mbedtls_asn1_get_tag(p, policy_end, &len, in x509_get_certificate_policies()
732 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_certificate_policies()
767 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_get_crt_ext() local
775 if ((ret = mbedtls_x509_get_ext(p, end, &crt->v3_ext, 3)) != 0) { in x509_get_crt_ext()
776 return ret; in x509_get_crt_ext()
791 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_get_crt_ext()
793 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_crt_ext()
799 if ((ret = mbedtls_asn1_get_tag(p, end_ext_data, &extn_oid.len, in x509_get_crt_ext()
801 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_crt_ext()
809 if ((ret = mbedtls_asn1_get_bool(p, end_ext_data, &is_critical)) != 0 && in x509_get_crt_ext()
810 (ret != MBEDTLS_ERR_ASN1_UNEXPECTED_TAG)) { in x509_get_crt_ext()
811 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_crt_ext()
815 if ((ret = mbedtls_asn1_get_tag(p, end_ext_data, &len, in x509_get_crt_ext()
817 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_get_crt_ext()
831 ret = mbedtls_oid_get_x509_ext_type(&extn_oid, &ext_type); in x509_get_crt_ext()
833 if (ret != 0) { in x509_get_crt_ext()
836 ret = cb(p_ctx, crt, &extn_oid, is_critical, *p, end_ext_octet); in x509_get_crt_ext()
837 if (ret != 0 && is_critical) { in x509_get_crt_ext()
838 return ret; in x509_get_crt_ext()
865 if ((ret = x509_get_basic_constraints(p, end_ext_octet, in x509_get_crt_ext()
867 return ret; in x509_get_crt_ext()
873 if ((ret = mbedtls_x509_get_key_usage(p, end_ext_octet, in x509_get_crt_ext()
875 return ret; in x509_get_crt_ext()
881 if ((ret = x509_get_ext_key_usage(p, end_ext_octet, in x509_get_crt_ext()
883 return ret; in x509_get_crt_ext()
889 if ((ret = mbedtls_x509_get_subject_alt_name(p, end_ext_octet, in x509_get_crt_ext()
891 return ret; in x509_get_crt_ext()
897 if ((ret = mbedtls_x509_get_ns_cert_type(p, end_ext_octet, in x509_get_crt_ext()
899 return ret; in x509_get_crt_ext()
905 if ((ret = x509_get_certificate_policies(p, end_ext_octet, in x509_get_crt_ext()
909 if (ret == MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE && cb != NULL && in x509_get_crt_ext()
916 return ret; in x509_get_crt_ext()
924 if (ret != MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE) { in x509_get_crt_ext()
925 return ret; in x509_get_crt_ext()
962 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_crt_parse_der_core() local
989 if ((ret = mbedtls_asn1_get_tag(&p, end, &len, in x509_crt_parse_der_core()
1019 if ((ret = mbedtls_asn1_get_tag(&p, end, &len, in x509_crt_parse_der_core()
1022 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret); in x509_crt_parse_der_core()
1035 if ((ret = x509_get_version(&p, end, &crt->version)) != 0 || in x509_crt_parse_der_core()
1036 (ret = mbedtls_x509_get_serial(&p, end, &crt->serial)) != 0 || in x509_crt_parse_der_core()
1037 (ret = mbedtls_x509_get_alg(&p, end, &crt->sig_oid, in x509_crt_parse_der_core()
1040 return ret; in x509_crt_parse_der_core()
1050 if ((ret = mbedtls_x509_get_sig_alg(&crt->sig_oid, &sig_params1, in x509_crt_parse_der_core()
1054 return ret; in x509_crt_parse_der_core()
1062 if ((ret = mbedtls_asn1_get_tag(&p, end, &len, in x509_crt_parse_der_core()
1065 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret); in x509_crt_parse_der_core()
1068 if ((ret = mbedtls_x509_get_name(&p, p + len, &crt->issuer)) != 0) { in x509_crt_parse_der_core()
1070 return ret; in x509_crt_parse_der_core()
1081 if ((ret = x509_get_dates(&p, end, &crt->valid_from, in x509_crt_parse_der_core()
1084 return ret; in x509_crt_parse_der_core()
1092 if ((ret = mbedtls_asn1_get_tag(&p, end, &len, in x509_crt_parse_der_core()
1095 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret); in x509_crt_parse_der_core()
1098 if (len && (ret = mbedtls_x509_get_name(&p, p + len, &crt->subject)) != 0) { in x509_crt_parse_der_core()
1100 return ret; in x509_crt_parse_der_core()
1109 if ((ret = mbedtls_pk_parse_subpubkey(&p, end, &crt->pk)) != 0) { in x509_crt_parse_der_core()
1111 return ret; in x509_crt_parse_der_core()
1124 ret = x509_get_uid(&p, end, &crt->issuer_id, 1); in x509_crt_parse_der_core()
1125 if (ret != 0) { in x509_crt_parse_der_core()
1127 return ret; in x509_crt_parse_der_core()
1132 ret = x509_get_uid(&p, end, &crt->subject_id, 2); in x509_crt_parse_der_core()
1133 if (ret != 0) { in x509_crt_parse_der_core()
1135 return ret; in x509_crt_parse_der_core()
1140 ret = x509_get_crt_ext(&p, end, crt, cb, p_ctx); in x509_crt_parse_der_core()
1141 if (ret != 0) { in x509_crt_parse_der_core()
1143 return ret; in x509_crt_parse_der_core()
1162 if ((ret = mbedtls_x509_get_alg(&p, end, &sig_oid2, &sig_params2)) != 0) { in x509_crt_parse_der_core()
1164 return ret; in x509_crt_parse_der_core()
1177 if ((ret = mbedtls_x509_get_sig(&p, end, &crt->sig)) != 0) { in x509_crt_parse_der_core()
1179 return ret; in x509_crt_parse_der_core()
1202 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_x509_crt_parse_der_internal() local
1232 ret = x509_crt_parse_der_core(crt, buf, buflen, make_copy, cb, p_ctx); in mbedtls_x509_crt_parse_der_internal()
1233 if (ret != 0) { in mbedtls_x509_crt_parse_der_internal()
1242 return ret; in mbedtls_x509_crt_parse_der_internal()
1311 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_x509_crt_parse() local
1320 ret = mbedtls_pem_read_buffer(&pem, in mbedtls_x509_crt_parse()
1325 if (ret == 0) { in mbedtls_x509_crt_parse()
1331 } else if (ret == MBEDTLS_ERR_PEM_BAD_INPUT_DATA) { in mbedtls_x509_crt_parse()
1332 return ret; in mbedtls_x509_crt_parse()
1333 } else if (ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT) { in mbedtls_x509_crt_parse()
1343 first_error = ret; in mbedtls_x509_crt_parse()
1352 ret = mbedtls_x509_crt_parse_der(chain, pem.buf, pem.buflen); in mbedtls_x509_crt_parse()
1356 if (ret != 0) { in mbedtls_x509_crt_parse()
1360 if (ret == MBEDTLS_ERR_X509_ALLOC_FAILED) { in mbedtls_x509_crt_parse()
1361 return ret; in mbedtls_x509_crt_parse()
1365 first_error = ret; in mbedtls_x509_crt_parse()
1392 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_x509_crt_parse_file() local
1396 if ((ret = mbedtls_pk_load_file(path, &buf, &n)) != 0) { in mbedtls_x509_crt_parse_file()
1397 return ret; in mbedtls_x509_crt_parse_file()
1400 ret = mbedtls_x509_crt_parse(chain, buf, n); in mbedtls_x509_crt_parse_file()
1405 return ret; in mbedtls_x509_crt_parse_file()
1410 int ret = 0; in mbedtls_x509_crt_parse_path() local
1456 ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; in mbedtls_x509_crt_parse_path()
1462 ret++; in mbedtls_x509_crt_parse_path()
1464 ret += w_ret; in mbedtls_x509_crt_parse_path()
1469 ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; in mbedtls_x509_crt_parse_path()
1487 if ((ret = mbedtls_mutex_lock(&mbedtls_threading_readdir_mutex)) != 0) { in mbedtls_x509_crt_parse_path()
1489 return ret; in mbedtls_x509_crt_parse_path()
1500 ret = MBEDTLS_ERR_X509_BUFFER_TOO_SMALL; in mbedtls_x509_crt_parse_path()
1513 ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; in mbedtls_x509_crt_parse_path()
1526 ret++; in mbedtls_x509_crt_parse_path()
1528 ret += t_ret; in mbedtls_x509_crt_parse_path()
1537 ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR; in mbedtls_x509_crt_parse_path()
1543 return ret; in mbedtls_x509_crt_parse_path()
1551 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_info_ext_key_usage() local
1563 ret = mbedtls_snprintf(p, n, "%s%s", sep, desc); in x509_info_ext_key_usage()
1580 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_info_cert_policies() local
1592 ret = mbedtls_snprintf(p, n, "%s%s", sep, desc); in x509_info_cert_policies()
1614 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_x509_crt_info() local
1623 ret = mbedtls_snprintf(p, n, "\nCertificate is uninitialised!\n"); in mbedtls_x509_crt_info()
1629 ret = mbedtls_snprintf(p, n, "%scert. version : %d\n", in mbedtls_x509_crt_info()
1632 ret = mbedtls_snprintf(p, n, "%sserial number : ", in mbedtls_x509_crt_info()
1636 ret = mbedtls_x509_serial_gets(p, n, &crt->serial); in mbedtls_x509_crt_info()
1639 ret = mbedtls_snprintf(p, n, "\n%sissuer name : ", prefix); in mbedtls_x509_crt_info()
1641 ret = mbedtls_x509_dn_gets(p, n, &crt->issuer); in mbedtls_x509_crt_info()
1644 ret = mbedtls_snprintf(p, n, "\n%ssubject name : ", prefix); in mbedtls_x509_crt_info()
1646 ret = mbedtls_x509_dn_gets(p, n, &crt->subject); in mbedtls_x509_crt_info()
1649 ret = mbedtls_snprintf(p, n, "\n%sissued on : " \ in mbedtls_x509_crt_info()
1656 ret = mbedtls_snprintf(p, n, "\n%sexpires on : " \ in mbedtls_x509_crt_info()
1663 ret = mbedtls_snprintf(p, n, "\n%ssigned using : ", prefix); in mbedtls_x509_crt_info()
1666 ret = mbedtls_x509_sig_alg_gets(p, n, &crt->sig_oid, crt->sig_pk, in mbedtls_x509_crt_info()
1671 if ((ret = mbedtls_x509_key_size_helper(key_size_str, BEFORE_COLON, in mbedtls_x509_crt_info()
1673 return ret; in mbedtls_x509_crt_info()
1676 ret = mbedtls_snprintf(p, n, "\n%s%-" BC "s: %d bits", prefix, key_size_str, in mbedtls_x509_crt_info()
1685 ret = mbedtls_snprintf(p, n, "\n%sbasic constraints : CA=%s", prefix, in mbedtls_x509_crt_info()
1690 ret = mbedtls_snprintf(p, n, ", max_pathlen=%d", crt->max_pathlen - 1); in mbedtls_x509_crt_info()
1696 ret = mbedtls_snprintf(p, n, "\n%ssubject alt name :", prefix); in mbedtls_x509_crt_info()
1699 if ((ret = mbedtls_x509_info_subject_alt_name(&p, &n, in mbedtls_x509_crt_info()
1702 return ret; in mbedtls_x509_crt_info()
1707 ret = mbedtls_snprintf(p, n, "\n%scert. type : ", prefix); in mbedtls_x509_crt_info()
1710 if ((ret = mbedtls_x509_info_cert_type(&p, &n, crt->ns_cert_type)) != 0) { in mbedtls_x509_crt_info()
1711 return ret; in mbedtls_x509_crt_info()
1716 ret = mbedtls_snprintf(p, n, "\n%skey usage : ", prefix); in mbedtls_x509_crt_info()
1719 if ((ret = mbedtls_x509_info_key_usage(&p, &n, crt->key_usage)) != 0) { in mbedtls_x509_crt_info()
1720 return ret; in mbedtls_x509_crt_info()
1725 ret = mbedtls_snprintf(p, n, "\n%sext key usage : ", prefix); in mbedtls_x509_crt_info()
1728 if ((ret = x509_info_ext_key_usage(&p, &n, in mbedtls_x509_crt_info()
1730 return ret; in mbedtls_x509_crt_info()
1735 ret = mbedtls_snprintf(p, n, "\n%scertificate policies : ", prefix); in mbedtls_x509_crt_info()
1738 if ((ret = x509_info_cert_policies(&p, &n, in mbedtls_x509_crt_info()
1740 return ret; in mbedtls_x509_crt_info()
1744 ret = mbedtls_snprintf(p, n, "\n"); in mbedtls_x509_crt_info()
1765 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_x509_crt_verify_info() local
1775 ret = mbedtls_snprintf(p, n, "%s%s\n", prefix, cur->string); in mbedtls_x509_crt_verify_info()
1781 ret = mbedtls_snprintf(p, n, "%sUnknown reason " in mbedtls_x509_crt_verify_info()
2119 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_crt_find_parent_in() local
2160 ret = x509_crt_check_signature(child, parent, rs_ctx); in x509_crt_find_parent_in()
2163 if (rs_ctx != NULL && ret == MBEDTLS_ERR_ECP_IN_PROGRESS) { in x509_crt_find_parent_in()
2169 return ret; in x509_crt_find_parent_in()
2172 (void) ret; in x509_crt_find_parent_in()
2175 signature_is_good = ret == 0; in x509_crt_find_parent_in()
2237 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_crt_find_parent() local
2253 ret = x509_crt_find_parent_in(child, search_list, in x509_crt_find_parent()
2259 if (rs_ctx != NULL && ret == MBEDTLS_ERR_ECP_IN_PROGRESS) { in x509_crt_find_parent()
2262 return ret; in x509_crt_find_parent()
2265 (void) ret; in x509_crt_find_parent()
2367 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_crt_verify_chain() local
2448 ret = f_ca_cb(p_ca_cb, child, &ver_chain->trust_ca_cb_result); in x509_crt_verify_chain()
2449 if (ret != 0) { in x509_crt_verify_chain()
2463 ret = x509_crt_find_parent(child, cur_trust_ca, &parent, in x509_crt_verify_chain()
2468 if (rs_ctx != NULL && ret == MBEDTLS_ERR_ECP_IN_PROGRESS) { in x509_crt_verify_chain()
2474 return ret; in x509_crt_verify_chain()
2477 (void) ret; in x509_crt_verify_chain()
2611 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_crt_merge_flags_with_cb() local
2621 if ((ret = f_vrfy(p_vrfy, cur->crt, (int) i-1, &cur_flags)) != 0) { in x509_crt_merge_flags_with_cb()
2622 return ret; in x509_crt_merge_flags_with_cb()
2663 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_crt_verify_restartable_ca_cb() local
2673 ret = MBEDTLS_ERR_X509_BAD_INPUT_DATA; in x509_crt_verify_restartable_ca_cb()
2694 ret = x509_crt_verify_chain(crt, trust_ca, ca_crl, in x509_crt_verify_restartable_ca_cb()
2698 if (ret != 0) { in x509_crt_verify_restartable_ca_cb()
2706 ret = x509_crt_merge_flags_with_cb(flags, &ver_chain, f_vrfy, p_vrfy); in x509_crt_verify_restartable_ca_cb()
2717 if (rs_ctx != NULL && ret != MBEDTLS_ERR_ECP_IN_PROGRESS) { in x509_crt_verify_restartable_ca_cb()
2725 if (ret == MBEDTLS_ERR_X509_CERT_VERIFY_FAILED) { in x509_crt_verify_restartable_ca_cb()
2726 ret = MBEDTLS_ERR_X509_FATAL_ERROR; in x509_crt_verify_restartable_ca_cb()
2729 if (ret != 0) { in x509_crt_verify_restartable_ca_cb()
2731 return ret; in x509_crt_verify_restartable_ca_cb()