From ef950ccb1d8a7dc7f29a6d7a7475ce4072da3e0a Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Mon, 26 Feb 2024 13:59:43 +0000 Subject: [PATCH] Un-unrestore mbedtls_x509_string_to_names() Re-restore mbedtls_x509_string_to_names() to public as our example programs use it, and it is the reverse of mbedtls_x509_dn_gets(). Add a docstring, so that it is a properly documented public function. Signed-off-by: David Horstmann --- include/mbedtls/x509.h | 17 +++++++++++++++++ library/x509_internal.h | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/mbedtls/x509.h b/include/mbedtls/x509.h index 715855517..453f598c7 100644 --- a/include/mbedtls/x509.h +++ b/include/mbedtls/x509.h @@ -322,6 +322,23 @@ mbedtls_x509_san_list; */ int mbedtls_x509_dn_gets(char *buf, size_t size, const mbedtls_x509_name *dn); +/** + * \brief Convert the certificate DN string \p name into + * a linked list of mbedtls_x509_name (equivalent to + * mbedtls_asn1_named_data). + * + * \note This function allocates a linked list, and places the head + * pointer in \p head. This list must later be freed by a + * call to mbedtls_asn1_free_named_data_list(). + * + * \param[out] head Address in which to store the pointer to the head of the + * allocated list of mbedtls_x509_name + * \param[in] name The string representation of a DN to convert + * + * \return 0 on success, or a negative error code. + */ +int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *name); + /** * \brief Return the next relative DN in an X509 name. * diff --git a/library/x509_internal.h b/library/x509_internal.h index 09b6fc5a1..8a2d2ed00 100644 --- a/library/x509_internal.h +++ b/library/x509_internal.h @@ -21,7 +21,6 @@ #include "mbedtls/rsa.h" #endif -int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *name); int mbedtls_x509_get_name(unsigned char **p, const unsigned char *end, mbedtls_x509_name *cur); int mbedtls_x509_get_alg_null(unsigned char **p, const unsigned char *end,