Uncrustified

Signed-off-by: Matthias Schulz <mschulz@hilscher.com>
This commit is contained in:
Matthias Schulz 2023-10-19 16:09:08 +02:00
parent 03bd095a76
commit edc32eaf1a
3 changed files with 22 additions and 21 deletions

View file

@ -156,9 +156,9 @@ typedef int (*mbedtls_x509_csr_ext_cb_t)(void *p_ctx,
* \return 0 if successful, or a specific X509 error code
*/
int mbedtls_x509_csr_parse_der_with_ext_cb(mbedtls_x509_csr *csr,
const unsigned char *buf, size_t buflen,
mbedtls_x509_csr_ext_cb_t cb,
void *p_ctx);
const unsigned char *buf, size_t buflen,
mbedtls_x509_csr_ext_cb_t cb,
void *p_ctx);
/**
* \brief Load a Certificate Signing Request (CSR), DER or PEM format

View file

@ -153,7 +153,7 @@ static int x509_csr_parse_extensions(mbedtls_x509_csr *csr,
/* Forbid repeated extensions */
if ((csr->ext_types & ext_type) != 0) {
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
MBEDTLS_ERR_ASN1_INVALID_DATA);
MBEDTLS_ERR_ASN1_INVALID_DATA);
}
csr->ext_types |= ext_type;
@ -162,7 +162,7 @@ static int x509_csr_parse_extensions(mbedtls_x509_csr *csr,
case MBEDTLS_X509_EXT_KEY_USAGE:
/* Parse key usage */
if ((ret = mbedtls_x509_get_key_usage(p, end_ext_data,
&csr->key_usage)) != 0) {
&csr->key_usage)) != 0) {
return ret;
}
break;
@ -170,7 +170,7 @@ static int x509_csr_parse_extensions(mbedtls_x509_csr *csr,
case MBEDTLS_X509_EXT_SUBJECT_ALT_NAME:
/* Parse subject alt name */
if ((ret = mbedtls_x509_get_subject_alt_name(p, end_ext_data,
&csr->subject_alt_names)) != 0) {
&csr->subject_alt_names)) != 0) {
return ret;
}
break;
@ -178,16 +178,16 @@ static int x509_csr_parse_extensions(mbedtls_x509_csr *csr,
case MBEDTLS_X509_EXT_NS_CERT_TYPE:
/* Parse netscape certificate type */
if ((ret = mbedtls_x509_get_ns_cert_type(p, end_ext_data,
&csr->ns_cert_type)) != 0) {
&csr->ns_cert_type)) != 0) {
return ret;
}
break;
default:
/*
* If this is a non-critical extension, which the oid layer
* supports, but there isn't an x509 parser for it,
* skip the extension.
*/
* If this is a non-critical extension, which the oid layer
* supports, but there isn't an x509 parser for it,
* skip the extension.
*/
if (is_critical) {
return MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE;
} else {
@ -274,9 +274,9 @@ static int x509_csr_parse_attributes(mbedtls_x509_csr *csr,
* Parse a CSR in DER format
*/
static int mbedtls_x509_csr_parse_der_internal(mbedtls_x509_csr *csr,
const unsigned char *buf, size_t buflen,
mbedtls_x509_csr_ext_cb_t cb,
void *p_ctx)
const unsigned char *buf, size_t buflen,
mbedtls_x509_csr_ext_cb_t cb,
void *p_ctx)
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t len;
@ -452,9 +452,9 @@ int mbedtls_x509_csr_parse_der(mbedtls_x509_csr *csr,
* Parse a CSR in DER format with callback for unknown extensions
*/
int mbedtls_x509_csr_parse_der_with_ext_cb(mbedtls_x509_csr *csr,
const unsigned char *buf, size_t buflen,
mbedtls_x509_csr_ext_cb_t cb,
void *p_ctx)
const unsigned char *buf, size_t buflen,
mbedtls_x509_csr_ext_cb_t cb,
void *p_ctx)
{
return mbedtls_x509_csr_parse_der_internal(csr, buf, buflen, cb, p_ctx);
}

View file

@ -250,7 +250,8 @@ int verify_parse_san(mbedtls_x509_subject_alternative_name *san,
ret = mbedtls_oid_get_numeric_string(p,
n,
&san->san.other_name.value.hardware_module_name.oid);
&san->san.other_name.value.hardware_module_name
.oid);
MBEDTLS_X509_SAFE_SNPRINTF;
ret = mbedtls_snprintf(p, n, ", hardware serial number : ");
@ -416,7 +417,7 @@ int parse_crt_ext_cb(void *p_ctx, mbedtls_x509_crt const *crt, mbedtls_x509_buf
#if defined(MBEDTLS_X509_CSR_PARSE_C)
int parse_csr_ext_accept_cb(void *p_ctx, mbedtls_x509_csr const *csr, mbedtls_x509_buf const *oid,
int critical, const unsigned char *cp, const unsigned char *end)
int critical, const unsigned char *cp, const unsigned char *end)
{
(void) p_ctx;
(void) csr;
@ -429,7 +430,7 @@ int parse_csr_ext_accept_cb(void *p_ctx, mbedtls_x509_csr const *csr, mbedtls_x5
}
int parse_csr_ext_reject_cb(void *p_ctx, mbedtls_x509_csr const *csr, mbedtls_x509_buf const *oid,
int critical, const unsigned char *cp, const unsigned char *end)
int critical, const unsigned char *cp, const unsigned char *end)
{
(void) p_ctx;
(void) csr;
@ -1288,7 +1289,7 @@ void mbedtls_x509_csr_parse_with_ext_cb(data_t *csr_der, char *ref_out, int ref_
my_ret = mbedtls_x509_csr_parse_der_with_ext_cb(&csr, csr_der->x, csr_der->len,
accept ? parse_csr_ext_accept_cb :
parse_csr_ext_reject_cb,
parse_csr_ext_reject_cb,
NULL);
TEST_EQUAL(my_ret, ref_ret);