Move trailing macro comments to previous line.
Clang-format was severy confused with following construct:
\\#define MBEDTLS_macro_name /**< description */
Used script:
```
import re
import sys
for arg in sys.argv[1:]:
print(arg)
with open(arg, 'r') as file:
content = file.read()
content = re.sub(r"((//)?#define MBEDTLS_\w+ *(?<= )-?\w+) *(/\*\*<(.*))", r"/**\4\n\1", \
content, flags = re.M)
with open(arg, 'w') as file:
file.write(content)
```
Executed with:
`find . -regextype posix-egrep -regex ".*\.([hc]|fmt|function)" | xargs -L1 python script.py`
One comment in ctr_drbg.h had to be fixed manually, because /**< was spanning on multiple line.
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
diff --git a/include/mbedtls/x509.h b/include/mbedtls/x509.h
index 233cc85..1adbd22 100644
--- a/include/mbedtls/x509.h
+++ b/include/mbedtls/x509.h
@@ -100,26 +100,46 @@
* \{
*/
/* Reminder: update x509_crt_verify_strings[] in library/x509_crt.c */
-#define MBEDTLS_X509_BADCERT_EXPIRED 0x01 /**< The certificate validity has expired. */
-#define MBEDTLS_X509_BADCERT_REVOKED 0x02 /**< The certificate has been revoked (is on a CRL). */
-#define MBEDTLS_X509_BADCERT_CN_MISMATCH 0x04 /**< The certificate Common Name (CN) does not match with the expected CN. */
-#define MBEDTLS_X509_BADCERT_NOT_TRUSTED 0x08 /**< The certificate is not correctly signed by the trusted CA. */
-#define MBEDTLS_X509_BADCRL_NOT_TRUSTED 0x10 /**< The CRL is not correctly signed by the trusted CA. */
-#define MBEDTLS_X509_BADCRL_EXPIRED 0x20 /**< The CRL is expired. */
-#define MBEDTLS_X509_BADCERT_MISSING 0x40 /**< Certificate was missing. */
-#define MBEDTLS_X509_BADCERT_SKIP_VERIFY 0x80 /**< Certificate verification was skipped. */
-#define MBEDTLS_X509_BADCERT_OTHER 0x0100 /**< Other reason (can be used by verify callback) */
-#define MBEDTLS_X509_BADCERT_FUTURE 0x0200 /**< The certificate validity starts in the future. */
-#define MBEDTLS_X509_BADCRL_FUTURE 0x0400 /**< The CRL is from the future */
-#define MBEDTLS_X509_BADCERT_KEY_USAGE 0x0800 /**< Usage does not match the keyUsage extension. */
-#define MBEDTLS_X509_BADCERT_EXT_KEY_USAGE 0x1000 /**< Usage does not match the extendedKeyUsage extension. */
-#define MBEDTLS_X509_BADCERT_NS_CERT_TYPE 0x2000 /**< Usage does not match the nsCertType extension. */
-#define MBEDTLS_X509_BADCERT_BAD_MD 0x4000 /**< The certificate is signed with an unacceptable hash. */
-#define MBEDTLS_X509_BADCERT_BAD_PK 0x8000 /**< The certificate is signed with an unacceptable PK alg (eg RSA vs ECDSA). */
-#define MBEDTLS_X509_BADCERT_BAD_KEY 0x010000 /**< The certificate is signed with an unacceptable key (eg bad curve, RSA too short). */
-#define MBEDTLS_X509_BADCRL_BAD_MD 0x020000 /**< The CRL is signed with an unacceptable hash. */
-#define MBEDTLS_X509_BADCRL_BAD_PK 0x040000 /**< The CRL is signed with an unacceptable PK alg (eg RSA vs ECDSA). */
-#define MBEDTLS_X509_BADCRL_BAD_KEY 0x080000 /**< The CRL is signed with an unacceptable key (eg bad curve, RSA too short). */
+/** The certificate validity has expired. */
+#define MBEDTLS_X509_BADCERT_EXPIRED 0x01
+/** The certificate has been revoked (is on a CRL). */
+#define MBEDTLS_X509_BADCERT_REVOKED 0x02
+/** The certificate Common Name (CN) does not match with the expected CN. */
+#define MBEDTLS_X509_BADCERT_CN_MISMATCH 0x04
+/** The certificate is not correctly signed by the trusted CA. */
+#define MBEDTLS_X509_BADCERT_NOT_TRUSTED 0x08
+/** The CRL is not correctly signed by the trusted CA. */
+#define MBEDTLS_X509_BADCRL_NOT_TRUSTED 0x10
+/** The CRL is expired. */
+#define MBEDTLS_X509_BADCRL_EXPIRED 0x20
+/** Certificate was missing. */
+#define MBEDTLS_X509_BADCERT_MISSING 0x40
+/** Certificate verification was skipped. */
+#define MBEDTLS_X509_BADCERT_SKIP_VERIFY 0x80
+/** Other reason (can be used by verify callback) */
+#define MBEDTLS_X509_BADCERT_OTHER 0x0100
+/** The certificate validity starts in the future. */
+#define MBEDTLS_X509_BADCERT_FUTURE 0x0200
+/** The CRL is from the future */
+#define MBEDTLS_X509_BADCRL_FUTURE 0x0400
+/** Usage does not match the keyUsage extension. */
+#define MBEDTLS_X509_BADCERT_KEY_USAGE 0x0800
+/** Usage does not match the extendedKeyUsage extension. */
+#define MBEDTLS_X509_BADCERT_EXT_KEY_USAGE 0x1000
+/** Usage does not match the nsCertType extension. */
+#define MBEDTLS_X509_BADCERT_NS_CERT_TYPE 0x2000
+/** The certificate is signed with an unacceptable hash. */
+#define MBEDTLS_X509_BADCERT_BAD_MD 0x4000
+/** The certificate is signed with an unacceptable PK alg (eg RSA vs ECDSA). */
+#define MBEDTLS_X509_BADCERT_BAD_PK 0x8000
+/** The certificate is signed with an unacceptable key (eg bad curve, RSA too short). */
+#define MBEDTLS_X509_BADCERT_BAD_KEY 0x010000
+/** The CRL is signed with an unacceptable hash. */
+#define MBEDTLS_X509_BADCRL_BAD_MD 0x020000
+/** The CRL is signed with an unacceptable PK alg (eg RSA vs ECDSA). */
+#define MBEDTLS_X509_BADCRL_BAD_PK 0x040000
+/** The CRL is signed with an unacceptable key (eg bad curve, RSA too short). */
+#define MBEDTLS_X509_BADCRL_BAD_KEY 0x080000
/* \} name */
/* \} addtogroup x509_module */
@@ -207,7 +227,8 @@
#define MBEDTLS_X509_FORMAT_DER 1
#define MBEDTLS_X509_FORMAT_PEM 2
-#define MBEDTLS_X509_MAX_DN_NAME_SIZE 256 /**< Maximum value size of a DN entry */
+/** Maximum value size of a DN entry */
+#define MBEDTLS_X509_MAX_DN_NAME_SIZE 256
#ifdef __cplusplus
extern "C" {