Lines Matching refs:ret
58 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in x509_csr_get_version() local
60 if ((ret = mbedtls_asn1_get_int(p, end, ver)) != 0) { in x509_csr_get_version()
61 if (ret == MBEDTLS_ERR_ASN1_UNEXPECTED_TAG) { in x509_csr_get_version()
66 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_VERSION, ret); in x509_csr_get_version()
78 int ret; in x509_csr_parse_extensions() local
86 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_csr_parse_extensions()
88 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_csr_parse_extensions()
94 if ((ret = mbedtls_asn1_get_tag(p, end_ext_data, &extn_oid.len, in x509_csr_parse_extensions()
96 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_csr_parse_extensions()
104 if ((ret = mbedtls_asn1_get_tag(p, end_ext_data, &len, in x509_csr_parse_extensions()
106 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_csr_parse_extensions()
117 ret = mbedtls_oid_get_x509_ext_type(&extn_oid, &ext_type); in x509_csr_parse_extensions()
119 if (ret == 0) { in x509_csr_parse_extensions()
131 if ((ret = mbedtls_x509_get_key_usage(p, end_ext_data, in x509_csr_parse_extensions()
133 return ret; in x509_csr_parse_extensions()
139 if ((ret = mbedtls_x509_get_subject_alt_name(p, end_ext_data, in x509_csr_parse_extensions()
141 return ret; in x509_csr_parse_extensions()
147 if ((ret = mbedtls_x509_get_ns_cert_type(p, end_ext_data, in x509_csr_parse_extensions()
149 return ret; in x509_csr_parse_extensions()
173 int ret; in x509_csr_parse_attributes() local
181 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_csr_parse_attributes()
183 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_csr_parse_attributes()
188 if ((ret = mbedtls_asn1_get_tag(p, end_attr_data, &attr_oid.len, in x509_csr_parse_attributes()
190 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_csr_parse_attributes()
199 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_csr_parse_attributes()
201 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_csr_parse_attributes()
204 if ((ret = mbedtls_asn1_get_tag(p, end, &len, in x509_csr_parse_attributes()
207 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret); in x509_csr_parse_attributes()
210 if ((ret = x509_csr_parse_extensions(csr, p, *p + len)) != 0) { in x509_csr_parse_attributes()
211 return ret; in x509_csr_parse_attributes()
237 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_x509_csr_parse_der() local
275 if ((ret = mbedtls_asn1_get_tag(&p, end, &len, in mbedtls_x509_csr_parse_der()
292 if ((ret = mbedtls_asn1_get_tag(&p, end, &len, in mbedtls_x509_csr_parse_der()
295 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret); in mbedtls_x509_csr_parse_der()
304 if ((ret = x509_csr_get_version(&p, end, &csr->version)) != 0) { in mbedtls_x509_csr_parse_der()
306 return ret; in mbedtls_x509_csr_parse_der()
321 if ((ret = mbedtls_asn1_get_tag(&p, end, &len, in mbedtls_x509_csr_parse_der()
324 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret); in mbedtls_x509_csr_parse_der()
327 if ((ret = mbedtls_x509_get_name(&p, p + len, &csr->subject)) != 0) { in mbedtls_x509_csr_parse_der()
329 return ret; in mbedtls_x509_csr_parse_der()
337 if ((ret = mbedtls_pk_parse_subpubkey(&p, end, &csr->pk)) != 0) { in mbedtls_x509_csr_parse_der()
339 return ret; in mbedtls_x509_csr_parse_der()
352 if ((ret = mbedtls_asn1_get_tag(&p, end, &len, in mbedtls_x509_csr_parse_der()
356 return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret); in mbedtls_x509_csr_parse_der()
359 if ((ret = x509_csr_parse_attributes(csr, p, p + len)) != 0) { in mbedtls_x509_csr_parse_der()
361 return ret; in mbedtls_x509_csr_parse_der()
372 if ((ret = mbedtls_x509_get_alg(&p, end, &csr->sig_oid, &sig_params)) != 0) { in mbedtls_x509_csr_parse_der()
374 return ret; in mbedtls_x509_csr_parse_der()
377 if ((ret = mbedtls_x509_get_sig_alg(&csr->sig_oid, &sig_params, in mbedtls_x509_csr_parse_der()
384 if ((ret = mbedtls_x509_get_sig(&p, end, &csr->sig)) != 0) { in mbedtls_x509_csr_parse_der()
386 return ret; in mbedtls_x509_csr_parse_der()
404 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_x509_csr_parse() local
420 ret = mbedtls_pem_read_buffer(&pem, in mbedtls_x509_csr_parse()
424 if (ret == MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT) { in mbedtls_x509_csr_parse()
425 ret = mbedtls_pem_read_buffer(&pem, in mbedtls_x509_csr_parse()
431 if (ret == 0) { in mbedtls_x509_csr_parse()
435 ret = mbedtls_x509_csr_parse_der(csr, pem.buf, pem.buflen); in mbedtls_x509_csr_parse()
439 if (ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT) { in mbedtls_x509_csr_parse()
440 return ret; in mbedtls_x509_csr_parse()
453 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_x509_csr_parse_file() local
457 if ((ret = mbedtls_pk_load_file(path, &buf, &n)) != 0) { in mbedtls_x509_csr_parse_file()
458 return ret; in mbedtls_x509_csr_parse_file()
461 ret = mbedtls_x509_csr_parse(csr, buf, n); in mbedtls_x509_csr_parse_file()
466 return ret; in mbedtls_x509_csr_parse_file()
479 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_x509_csr_info() local
487 ret = mbedtls_snprintf(p, n, "%sCSR version : %d", in mbedtls_x509_csr_info()
491 ret = mbedtls_snprintf(p, n, "\n%ssubject name : ", prefix); in mbedtls_x509_csr_info()
493 ret = mbedtls_x509_dn_gets(p, n, &csr->subject); in mbedtls_x509_csr_info()
496 ret = mbedtls_snprintf(p, n, "\n%ssigned using : ", prefix); in mbedtls_x509_csr_info()
499 ret = mbedtls_x509_sig_alg_gets(p, n, &csr->sig_oid, csr->sig_pk, csr->sig_md, in mbedtls_x509_csr_info()
503 if ((ret = mbedtls_x509_key_size_helper(key_size_str, BEFORE_COLON, in mbedtls_x509_csr_info()
505 return ret; in mbedtls_x509_csr_info()
508 ret = mbedtls_snprintf(p, n, "\n%s%-" BC "s: %d bits\n", prefix, key_size_str, in mbedtls_x509_csr_info()
517 ret = mbedtls_snprintf(p, n, "\n%ssubject alt name :", prefix); in mbedtls_x509_csr_info()
520 if ((ret = mbedtls_x509_info_subject_alt_name(&p, &n, in mbedtls_x509_csr_info()
523 return ret; in mbedtls_x509_csr_info()
528 ret = mbedtls_snprintf(p, n, "\n%scert. type : ", prefix); in mbedtls_x509_csr_info()
531 if ((ret = mbedtls_x509_info_cert_type(&p, &n, csr->ns_cert_type)) != 0) { in mbedtls_x509_csr_info()
532 return ret; in mbedtls_x509_csr_info()
537 ret = mbedtls_snprintf(p, n, "\n%skey usage : ", prefix); in mbedtls_x509_csr_info()
540 if ((ret = mbedtls_x509_info_key_usage(&p, &n, csr->key_usage)) != 0) { in mbedtls_x509_csr_info()
541 return ret; in mbedtls_x509_csr_info()
546 ret = mbedtls_snprintf(p, n, "\n"); in mbedtls_x509_csr_info()