Apply clang formatting.
Executed with:
`find . -regextype posix-egrep -regex ".*\.([hc]|fmt|function)" | xargs -L1 clang-format-12 -i`
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
diff --git a/include/mbedtls/x509_csr.h b/include/mbedtls/x509_csr.h
index 674f9ce..55dc9b8 100644
--- a/include/mbedtls/x509_csr.h
+++ b/include/mbedtls/x509_csr.h
@@ -43,37 +43,46 @@
/**
* Certificate Signing Request (CSR) structure.
*/
-typedef struct mbedtls_x509_csr
-{
- mbedtls_x509_buf MBEDTLS_PRIVATE(raw); /**< The raw CSR data (DER). */
- mbedtls_x509_buf MBEDTLS_PRIVATE(cri); /**< The raw CertificateRequestInfo body (DER). */
+typedef struct mbedtls_x509_csr {
+ mbedtls_x509_buf MBEDTLS_PRIVATE(raw); /**< The raw CSR data (DER). */
+ mbedtls_x509_buf MBEDTLS_PRIVATE(cri); /**< The raw CertificateRequestInfo
+ body (DER). */
- int MBEDTLS_PRIVATE(version); /**< CSR version (1=v1). */
+ int MBEDTLS_PRIVATE(version); /**< CSR version (1=v1). */
- mbedtls_x509_buf MBEDTLS_PRIVATE(subject_raw); /**< The raw subject data (DER). */
- mbedtls_x509_name MBEDTLS_PRIVATE(subject); /**< The parsed subject data (named information object). */
+ mbedtls_x509_buf MBEDTLS_PRIVATE(subject_raw); /**< The raw subject data
+ (DER). */
+ mbedtls_x509_name MBEDTLS_PRIVATE(subject); /**< The parsed subject data
+ (named information object).
+ */
- mbedtls_pk_context MBEDTLS_PRIVATE(pk); /**< Container for the public key context. */
+ mbedtls_pk_context MBEDTLS_PRIVATE(pk); /**< Container for the public key
+ context. */
mbedtls_x509_buf MBEDTLS_PRIVATE(sig_oid);
mbedtls_x509_buf MBEDTLS_PRIVATE(sig);
- mbedtls_md_type_t MBEDTLS_PRIVATE(sig_md); /**< Internal representation of the MD algorithm of the signature algorithm, e.g. MBEDTLS_MD_SHA256 */
- mbedtls_pk_type_t MBEDTLS_PRIVATE(sig_pk); /**< Internal representation of the Public Key algorithm of the signature algorithm, e.g. MBEDTLS_PK_RSA */
- void *MBEDTLS_PRIVATE(sig_opts); /**< Signature options to be passed to mbedtls_pk_verify_ext(), e.g. for RSASSA-PSS */
-}
-mbedtls_x509_csr;
+ mbedtls_md_type_t MBEDTLS_PRIVATE(sig_md); /**< Internal representation of
+ the MD algorithm of the
+ signature algorithm, e.g.
+ MBEDTLS_MD_SHA256 */
+ mbedtls_pk_type_t MBEDTLS_PRIVATE(sig_pk); /**< Internal representation of
+ the Public Key algorithm of
+ the signature algorithm, e.g.
+ MBEDTLS_PK_RSA */
+ void *MBEDTLS_PRIVATE(sig_opts); /**< Signature options to be passed to
+ mbedtls_pk_verify_ext(), e.g. for
+ RSASSA-PSS */
+} mbedtls_x509_csr;
/**
* Container for writing a CSR
*/
-typedef struct mbedtls_x509write_csr
-{
+typedef struct mbedtls_x509write_csr {
mbedtls_pk_context *MBEDTLS_PRIVATE(key);
mbedtls_asn1_named_data *MBEDTLS_PRIVATE(subject);
mbedtls_md_type_t MBEDTLS_PRIVATE(md_alg);
mbedtls_asn1_named_data *MBEDTLS_PRIVATE(extensions);
-}
-mbedtls_x509write_csr;
+} mbedtls_x509write_csr;
#if defined(MBEDTLS_X509_CSR_PARSE_C)
/**
@@ -87,8 +96,9 @@
*
* \return 0 if successful, or a specific X509 error code
*/
-int mbedtls_x509_csr_parse_der( mbedtls_x509_csr *csr,
- const unsigned char *buf, size_t buflen );
+int mbedtls_x509_csr_parse_der(mbedtls_x509_csr *csr,
+ const unsigned char *buf,
+ size_t buflen);
/**
* \brief Load a Certificate Signing Request (CSR), DER or PEM format
@@ -102,9 +112,11 @@
*
* \return 0 if successful, or a specific X509 or PEM error code
*/
-int mbedtls_x509_csr_parse( mbedtls_x509_csr *csr, const unsigned char *buf, size_t buflen );
+int mbedtls_x509_csr_parse(mbedtls_x509_csr *csr,
+ const unsigned char *buf,
+ size_t buflen);
-#if defined(MBEDTLS_FS_IO)
+# if defined(MBEDTLS_FS_IO)
/**
* \brief Load a Certificate Signing Request (CSR)
*
@@ -115,10 +127,10 @@
*
* \return 0 if successful, or a specific X509 or PEM error code
*/
-int mbedtls_x509_csr_parse_file( mbedtls_x509_csr *csr, const char *path );
-#endif /* MBEDTLS_FS_IO */
+int mbedtls_x509_csr_parse_file(mbedtls_x509_csr *csr, const char *path);
+# endif /* MBEDTLS_FS_IO */
-#if !defined(MBEDTLS_X509_REMOVE_INFO)
+# if !defined(MBEDTLS_X509_REMOVE_INFO)
/**
* \brief Returns an informational string about the
* CSR.
@@ -131,23 +143,25 @@
* \return The length of the string written (not including the
* terminated nul byte), or a negative error code.
*/
-int mbedtls_x509_csr_info( char *buf, size_t size, const char *prefix,
- const mbedtls_x509_csr *csr );
-#endif /* !MBEDTLS_X509_REMOVE_INFO */
+int mbedtls_x509_csr_info(char *buf,
+ size_t size,
+ const char *prefix,
+ const mbedtls_x509_csr *csr);
+# endif /* !MBEDTLS_X509_REMOVE_INFO */
/**
* \brief Initialize a CSR
*
* \param csr CSR to initialize
*/
-void mbedtls_x509_csr_init( mbedtls_x509_csr *csr );
+void mbedtls_x509_csr_init(mbedtls_x509_csr *csr);
/**
* \brief Unallocate all CSR data
*
* \param csr CSR to free
*/
-void mbedtls_x509_csr_free( mbedtls_x509_csr *csr );
+void mbedtls_x509_csr_free(mbedtls_x509_csr *csr);
#endif /* MBEDTLS_X509_CSR_PARSE_C */
/* \} name */
@@ -159,7 +173,7 @@
*
* \param ctx CSR context to initialize
*/
-void mbedtls_x509write_csr_init( mbedtls_x509write_csr *ctx );
+void mbedtls_x509write_csr_init(mbedtls_x509write_csr *ctx);
/**
* \brief Set the subject name for a CSR
@@ -173,8 +187,8 @@
* \return 0 if subject name was parsed successfully, or
* a specific error code
*/
-int mbedtls_x509write_csr_set_subject_name( mbedtls_x509write_csr *ctx,
- const char *subject_name );
+int mbedtls_x509write_csr_set_subject_name(mbedtls_x509write_csr *ctx,
+ const char *subject_name);
/**
* \brief Set the key for a CSR (public key will be included,
@@ -183,7 +197,8 @@
* \param ctx CSR context to use
* \param key Asymetric key to include
*/
-void mbedtls_x509write_csr_set_key( mbedtls_x509write_csr *ctx, mbedtls_pk_context *key );
+void mbedtls_x509write_csr_set_key(mbedtls_x509write_csr *ctx,
+ mbedtls_pk_context *key);
/**
* \brief Set the MD algorithm to use for the signature
@@ -192,7 +207,8 @@
* \param ctx CSR context to use
* \param md_alg MD algorithm to use
*/
-void mbedtls_x509write_csr_set_md_alg( mbedtls_x509write_csr *ctx, mbedtls_md_type_t md_alg );
+void mbedtls_x509write_csr_set_md_alg(mbedtls_x509write_csr *ctx,
+ mbedtls_md_type_t md_alg);
/**
* \brief Set the Key Usage Extension flags
@@ -211,7 +227,8 @@
* #MBEDTLS_X509_KU_DECIPHER_ONLY) cannot be set using this
* function.
*/
-int mbedtls_x509write_csr_set_key_usage( mbedtls_x509write_csr *ctx, unsigned char key_usage );
+int mbedtls_x509write_csr_set_key_usage(mbedtls_x509write_csr *ctx,
+ unsigned char key_usage);
/**
* \brief Set the Netscape Cert Type flags
@@ -222,8 +239,8 @@
*
* \return 0 if successful, or MBEDTLS_ERR_X509_ALLOC_FAILED
*/
-int mbedtls_x509write_csr_set_ns_cert_type( mbedtls_x509write_csr *ctx,
- unsigned char ns_cert_type );
+int mbedtls_x509write_csr_set_ns_cert_type(mbedtls_x509write_csr *ctx,
+ unsigned char ns_cert_type);
/**
* \brief Generic function to add to or replace an extension in the
@@ -238,17 +255,19 @@
*
* \return 0 if successful, or a MBEDTLS_ERR_X509_ALLOC_FAILED
*/
-int mbedtls_x509write_csr_set_extension( mbedtls_x509write_csr *ctx,
- const char *oid, size_t oid_len,
- int critical,
- const unsigned char *val, size_t val_len );
+int mbedtls_x509write_csr_set_extension(mbedtls_x509write_csr *ctx,
+ const char *oid,
+ size_t oid_len,
+ int critical,
+ const unsigned char *val,
+ size_t val_len);
/**
* \brief Free the contents of a CSR context
*
* \param ctx CSR context to free
*/
-void mbedtls_x509write_csr_free( mbedtls_x509write_csr *ctx );
+void mbedtls_x509write_csr_free(mbedtls_x509write_csr *ctx);
/**
* \brief Write a CSR (Certificate Signing Request) to a
@@ -268,11 +287,13 @@
*
* \note \p f_rng is used for the signature operation.
*/
-int mbedtls_x509write_csr_der( mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size,
- int (*f_rng)(void *, unsigned char *, size_t),
- void *p_rng );
+int mbedtls_x509write_csr_der(mbedtls_x509write_csr *ctx,
+ unsigned char *buf,
+ size_t size,
+ int (*f_rng)(void *, unsigned char *, size_t),
+ void *p_rng);
-#if defined(MBEDTLS_PEM_WRITE_C)
+# if defined(MBEDTLS_PEM_WRITE_C)
/**
* \brief Write a CSR (Certificate Signing Request) to a
* PEM string
@@ -287,10 +308,12 @@
*
* \note \p f_rng is used for the signature operation.
*/
-int mbedtls_x509write_csr_pem( mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size,
- int (*f_rng)(void *, unsigned char *, size_t),
- void *p_rng );
-#endif /* MBEDTLS_PEM_WRITE_C */
+int mbedtls_x509write_csr_pem(mbedtls_x509write_csr *ctx,
+ unsigned char *buf,
+ size_t size,
+ int (*f_rng)(void *, unsigned char *, size_t),
+ void *p_rng);
+# endif /* MBEDTLS_PEM_WRITE_C */
#endif /* MBEDTLS_X509_CSR_WRITE_C */
#ifdef __cplusplus