Lines Matching refs:ret

213     int ret;  in x509_get_version()  local
216 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_version()
219 if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) in x509_get_version()
225 return( ret ); in x509_get_version()
230 if( ( ret = mbedtls_asn1_get_int( p, end, ver ) ) != 0 ) in x509_get_version()
231 return( MBEDTLS_ERR_X509_INVALID_VERSION + ret ); in x509_get_version()
250 int ret; in x509_get_dates() local
253 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_dates()
255 return( MBEDTLS_ERR_X509_INVALID_DATE + ret ); in x509_get_dates()
259 if( ( ret = mbedtls_x509_get_time( p, end, from ) ) != 0 ) in x509_get_dates()
260 return( ret ); in x509_get_dates()
262 if( ( ret = mbedtls_x509_get_time( p, end, to ) ) != 0 ) in x509_get_dates()
263 return( ret ); in x509_get_dates()
279 int ret; in x509_get_uid() local
286 if( ( ret = mbedtls_asn1_get_tag( p, end, &uid->len, in x509_get_uid()
289 if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) in x509_get_uid()
292 return( ret ); in x509_get_uid()
306 int ret; in x509_get_basic_constraints() local
317 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_basic_constraints()
319 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_basic_constraints()
324 if( ( ret = mbedtls_asn1_get_bool( p, end, ca_istrue ) ) != 0 ) in x509_get_basic_constraints()
326 if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) in x509_get_basic_constraints()
327 ret = mbedtls_asn1_get_int( p, end, ca_istrue ); in x509_get_basic_constraints()
329 if( ret != 0 ) in x509_get_basic_constraints()
330 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_basic_constraints()
339 if( ( ret = mbedtls_asn1_get_int( p, end, max_pathlen ) ) != 0 ) in x509_get_basic_constraints()
340 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_basic_constraints()
355 int ret; in x509_get_ns_cert_type() local
358 if( ( ret = mbedtls_asn1_get_bitstring( p, end, &bs ) ) != 0 ) in x509_get_ns_cert_type()
359 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_ns_cert_type()
374 int ret; in x509_get_key_usage() local
378 if( ( ret = mbedtls_asn1_get_bitstring( p, end, &bs ) ) != 0 ) in x509_get_key_usage()
379 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_key_usage()
404 int ret; in x509_get_ext_key_usage() local
406 if( ( ret = mbedtls_asn1_get_sequence_of( p, end, ext_key_usage, MBEDTLS_ASN1_OID ) ) != 0 ) in x509_get_ext_key_usage()
407 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_ext_key_usage()
447 int ret; in x509_get_subject_alt_name() local
454 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_subject_alt_name()
456 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_subject_alt_name()
470 if( ( ret = mbedtls_asn1_get_len( p, end, &tag_len ) ) != 0 ) in x509_get_subject_alt_name()
471 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_subject_alt_name()
524 int ret; in x509_get_crt_ext() local
528 if( ( ret = mbedtls_x509_get_ext( p, end, &crt->v3_ext, 3 ) ) != 0 ) in x509_get_crt_ext()
530 if( ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) in x509_get_crt_ext()
533 return( ret ); in x509_get_crt_ext()
548 if( ( ret = mbedtls_asn1_get_tag( p, end, &len, in x509_get_crt_ext()
550 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_crt_ext()
557 if( ( ret = mbedtls_asn1_get_tag( p, end, &extn_oid.len, MBEDTLS_ASN1_OID ) ) != 0 ) in x509_get_crt_ext()
558 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_crt_ext()
568 if( ( ret = mbedtls_asn1_get_bool( p, end_ext_data, &is_critical ) ) != 0 && in x509_get_crt_ext()
569 ( ret != MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) ) in x509_get_crt_ext()
570 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_crt_ext()
573 if( ( ret = mbedtls_asn1_get_tag( p, end_ext_data, &len, in x509_get_crt_ext()
575 return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); in x509_get_crt_ext()
586 ret = mbedtls_oid_get_x509_ext_type( &extn_oid, &ext_type ); in x509_get_crt_ext()
588 if( ret != 0 ) in x509_get_crt_ext()
614 if( ( ret = x509_get_basic_constraints( p, end_ext_octet, in x509_get_crt_ext()
616 return( ret ); in x509_get_crt_ext()
621 if( ( ret = x509_get_key_usage( p, end_ext_octet, in x509_get_crt_ext()
623 return( ret ); in x509_get_crt_ext()
628 if( ( ret = x509_get_ext_key_usage( p, end_ext_octet, in x509_get_crt_ext()
630 return( ret ); in x509_get_crt_ext()
635 if( ( ret = x509_get_subject_alt_name( p, end_ext_octet, in x509_get_crt_ext()
637 return( ret ); in x509_get_crt_ext()
642 if( ( ret = x509_get_ns_cert_type( p, end_ext_octet, in x509_get_crt_ext()
644 return( ret ); in x509_get_crt_ext()
665 int ret; in x509_crt_parse_der_core() local
691 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in x509_crt_parse_der_core()
723 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in x509_crt_parse_der_core()
727 return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret ); in x509_crt_parse_der_core()
740 if( ( ret = x509_get_version( &p, end, &crt->version ) ) != 0 || in x509_crt_parse_der_core()
741 ( ret = mbedtls_x509_get_serial( &p, end, &crt->serial ) ) != 0 || in x509_crt_parse_der_core()
742 ( ret = mbedtls_x509_get_alg( &p, end, &crt->sig_oid, in x509_crt_parse_der_core()
746 return( ret ); in x509_crt_parse_der_core()
757 if( ( ret = mbedtls_x509_get_sig_alg( &crt->sig_oid, &sig_params1, in x509_crt_parse_der_core()
762 return( ret ); in x509_crt_parse_der_core()
770 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in x509_crt_parse_der_core()
774 return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret ); in x509_crt_parse_der_core()
777 if( ( ret = mbedtls_x509_get_name( &p, p + len, &crt->issuer ) ) != 0 ) in x509_crt_parse_der_core()
780 return( ret ); in x509_crt_parse_der_core()
791 if( ( ret = x509_get_dates( &p, end, &crt->valid_from, in x509_crt_parse_der_core()
795 return( ret ); in x509_crt_parse_der_core()
803 if( ( ret = mbedtls_asn1_get_tag( &p, end, &len, in x509_crt_parse_der_core()
807 return( MBEDTLS_ERR_X509_INVALID_FORMAT + ret ); in x509_crt_parse_der_core()
810 if( len && ( ret = mbedtls_x509_get_name( &p, p + len, &crt->subject ) ) != 0 ) in x509_crt_parse_der_core()
813 return( ret ); in x509_crt_parse_der_core()
821 if( ( ret = mbedtls_pk_parse_subpubkey( &p, end, &crt->pk ) ) != 0 ) in x509_crt_parse_der_core()
824 return( ret ); in x509_crt_parse_der_core()
837 ret = x509_get_uid( &p, end, &crt->issuer_id, 1 ); in x509_crt_parse_der_core()
838 if( ret != 0 ) in x509_crt_parse_der_core()
841 return( ret ); in x509_crt_parse_der_core()
847 ret = x509_get_uid( &p, end, &crt->subject_id, 2 ); in x509_crt_parse_der_core()
848 if( ret != 0 ) in x509_crt_parse_der_core()
851 return( ret ); in x509_crt_parse_der_core()
859 ret = x509_get_crt_ext( &p, end, crt ); in x509_crt_parse_der_core()
860 if( ret != 0 ) in x509_crt_parse_der_core()
863 return( ret ); in x509_crt_parse_der_core()
883 if( ( ret = mbedtls_x509_get_alg( &p, end, &sig_oid2, &sig_params2 ) ) != 0 ) in x509_crt_parse_der_core()
886 return( ret ); in x509_crt_parse_der_core()
899 if( ( ret = mbedtls_x509_get_sig( &p, end, &crt->sig ) ) != 0 ) in x509_crt_parse_der_core()
902 return( ret ); in x509_crt_parse_der_core()
922 int ret; in mbedtls_x509_crt_parse_der() local
952 if( ( ret = x509_crt_parse_der_core( crt, buf, buflen ) ) != 0 ) in mbedtls_x509_crt_parse_der()
960 return( ret ); in mbedtls_x509_crt_parse_der()
1003 int ret; in mbedtls_x509_crt_parse() local
1013 ret = mbedtls_pem_read_buffer( &pem, in mbedtls_x509_crt_parse()
1018 if( ret == 0 ) in mbedtls_x509_crt_parse()
1026 else if( ret == MBEDTLS_ERR_PEM_BAD_INPUT_DATA ) in mbedtls_x509_crt_parse()
1028 return( ret ); in mbedtls_x509_crt_parse()
1030 else if( ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT ) in mbedtls_x509_crt_parse()
1041 first_error = ret; in mbedtls_x509_crt_parse()
1049 ret = mbedtls_x509_crt_parse_der( chain, pem.buf, pem.buflen ); in mbedtls_x509_crt_parse()
1053 if( ret != 0 ) in mbedtls_x509_crt_parse()
1058 if( ret == MBEDTLS_ERR_X509_ALLOC_FAILED ) in mbedtls_x509_crt_parse()
1059 return( ret ); in mbedtls_x509_crt_parse()
1062 first_error = ret; in mbedtls_x509_crt_parse()
1087 int ret; in mbedtls_x509_crt_parse_file() local
1091 if( ( ret = mbedtls_pk_load_file( path, &buf, &n ) ) != 0 ) in mbedtls_x509_crt_parse_file()
1092 return( ret ); in mbedtls_x509_crt_parse_file()
1094 ret = mbedtls_x509_crt_parse( chain, buf, n ); in mbedtls_x509_crt_parse_file()
1099 return( ret ); in mbedtls_x509_crt_parse_file()
1104 int ret = 0; in mbedtls_x509_crt_parse_path() local
1151 ret++; in mbedtls_x509_crt_parse_path()
1153 ret += w_ret; in mbedtls_x509_crt_parse_path()
1158 ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; in mbedtls_x509_crt_parse_path()
1173 if( ( ret = mbedtls_mutex_lock( &mbedtls_threading_readdir_mutex ) ) != 0 ) in mbedtls_x509_crt_parse_path()
1176 return( ret ); in mbedtls_x509_crt_parse_path()
1187 ret = MBEDTLS_ERR_X509_BUFFER_TOO_SMALL; in mbedtls_x509_crt_parse_path()
1192 ret = MBEDTLS_ERR_X509_FILE_IO_ERROR; in mbedtls_x509_crt_parse_path()
1203 ret++; in mbedtls_x509_crt_parse_path()
1205 ret += t_ret; in mbedtls_x509_crt_parse_path()
1213 ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR; in mbedtls_x509_crt_parse_path()
1218 return( ret ); in mbedtls_x509_crt_parse_path()
1262 ret = mbedtls_snprintf( p, n, "%s" i, sep ); \
1274 int ret; in x509_info_cert_type() local
1301 int ret; in x509_info_key_usage() local
1325 int ret; in x509_info_ext_key_usage() local
1337 ret = mbedtls_snprintf( p, n, "%s%s", sep, desc ); in x509_info_ext_key_usage()
1359 int ret; in mbedtls_x509_crt_info() local
1369 ret = mbedtls_snprintf( p, n, "\nCertificate is uninitialised!\n" ); in mbedtls_x509_crt_info()
1375 ret = mbedtls_snprintf( p, n, "%scert. version : %d\n", in mbedtls_x509_crt_info()
1378 ret = mbedtls_snprintf( p, n, "%sserial number : ", in mbedtls_x509_crt_info()
1382 ret = mbedtls_x509_serial_gets( p, n, &crt->serial ); in mbedtls_x509_crt_info()
1385 ret = mbedtls_snprintf( p, n, "\n%sissuer name : ", prefix ); in mbedtls_x509_crt_info()
1387 ret = mbedtls_x509_dn_gets( p, n, &crt->issuer ); in mbedtls_x509_crt_info()
1390 ret = mbedtls_snprintf( p, n, "\n%ssubject name : ", prefix ); in mbedtls_x509_crt_info()
1392 ret = mbedtls_x509_dn_gets( p, n, &crt->subject ); in mbedtls_x509_crt_info()
1395 ret = mbedtls_snprintf( p, n, "\n%sissued on : " \ in mbedtls_x509_crt_info()
1402 ret = mbedtls_snprintf( p, n, "\n%sexpires on : " \ in mbedtls_x509_crt_info()
1409 ret = mbedtls_snprintf( p, n, "\n%ssigned using : ", prefix ); in mbedtls_x509_crt_info()
1412 ret = mbedtls_x509_sig_alg_gets( p, n, &crt->sig_oid, crt->sig_pk, in mbedtls_x509_crt_info()
1417 if( ( ret = mbedtls_x509_key_size_helper( key_size_str, BEFORE_COLON, in mbedtls_x509_crt_info()
1420 return( ret ); in mbedtls_x509_crt_info()
1423 ret = mbedtls_snprintf( p, n, "\n%s%-" BC "s: %d bits", prefix, key_size_str, in mbedtls_x509_crt_info()
1433 ret = mbedtls_snprintf( p, n, "\n%sbasic constraints : CA=%s", prefix, in mbedtls_x509_crt_info()
1439 ret = mbedtls_snprintf( p, n, ", max_pathlen=%d", crt->max_pathlen - 1 ); in mbedtls_x509_crt_info()
1446 ret = mbedtls_snprintf( p, n, "\n%ssubject alt name : ", prefix ); in mbedtls_x509_crt_info()
1449 if( ( ret = x509_info_subject_alt_name( &p, &n, in mbedtls_x509_crt_info()
1451 return( ret ); in mbedtls_x509_crt_info()
1456 ret = mbedtls_snprintf( p, n, "\n%scert. type : ", prefix ); in mbedtls_x509_crt_info()
1459 if( ( ret = x509_info_cert_type( &p, &n, crt->ns_cert_type ) ) != 0 ) in mbedtls_x509_crt_info()
1460 return( ret ); in mbedtls_x509_crt_info()
1465 ret = mbedtls_snprintf( p, n, "\n%skey usage : ", prefix ); in mbedtls_x509_crt_info()
1468 if( ( ret = x509_info_key_usage( &p, &n, crt->key_usage ) ) != 0 ) in mbedtls_x509_crt_info()
1469 return( ret ); in mbedtls_x509_crt_info()
1474 ret = mbedtls_snprintf( p, n, "\n%sext key usage : ", prefix ); in mbedtls_x509_crt_info()
1477 if( ( ret = x509_info_ext_key_usage( &p, &n, in mbedtls_x509_crt_info()
1479 return( ret ); in mbedtls_x509_crt_info()
1482 ret = mbedtls_snprintf( p, n, "\n" ); in mbedtls_x509_crt_info()
1520 int ret; in mbedtls_x509_crt_verify_info() local
1530 ret = mbedtls_snprintf( p, n, "%s%s\n", prefix, cur->string ); in mbedtls_x509_crt_verify_info()
1537 ret = mbedtls_snprintf( p, n, "%sUnknown reason " in mbedtls_x509_crt_verify_info()
1902 int ret; in x509_crt_verify_top() local
2008 if( ( ret = f_vrfy( p_vrfy, trust_ca, path_cnt + 1, in x509_crt_verify_top()
2011 return( ret ); in x509_crt_verify_top()
2019 if( ( ret = f_vrfy( p_vrfy, child, path_cnt, flags ) ) != 0 ) in x509_crt_verify_top()
2020 return( ret ); in x509_crt_verify_top()
2036 int ret; in x509_crt_verify_child() local
2105 ret = x509_crt_verify_top( parent, grandparent, ca_crl, profile, in x509_crt_verify_child()
2107 if( ret != 0 ) in x509_crt_verify_child()
2108 return( ret ); in x509_crt_verify_child()
2134 ret = x509_crt_verify_child( parent, grandparent, trust_ca, ca_crl, in x509_crt_verify_child()
2137 if( ret != 0 ) in x509_crt_verify_child()
2138 return( ret ); in x509_crt_verify_child()
2142 ret = x509_crt_verify_top( parent, trust_ca, ca_crl, profile, in x509_crt_verify_child()
2145 if( ret != 0 ) in x509_crt_verify_child()
2146 return( ret ); in x509_crt_verify_child()
2152 if( ( ret = f_vrfy( p_vrfy, child, path_cnt, flags ) ) != 0 ) in x509_crt_verify_child()
2153 return( ret ); in x509_crt_verify_child()
2187 int ret; in mbedtls_x509_crt_verify_with_profile() local
2269 ret = x509_crt_verify_top( crt, parent, ca_crl, profile, in mbedtls_x509_crt_verify_with_profile()
2271 if( ret != 0 ) in mbedtls_x509_crt_verify_with_profile()
2272 return( ret ); in mbedtls_x509_crt_verify_with_profile()
2284 ret = x509_crt_verify_child( crt, parent, trust_ca, ca_crl, profile, in mbedtls_x509_crt_verify_with_profile()
2286 if( ret != 0 ) in mbedtls_x509_crt_verify_with_profile()
2287 return( ret ); in mbedtls_x509_crt_verify_with_profile()
2291 ret = x509_crt_verify_top( crt, trust_ca, ca_crl, profile, in mbedtls_x509_crt_verify_with_profile()
2293 if( ret != 0 ) in mbedtls_x509_crt_verify_with_profile()
2294 return( ret ); in mbedtls_x509_crt_verify_with_profile()