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 <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2024-02-26 13:59:43 +00:00
parent 8ed3c60504
commit ef950ccb1d
2 changed files with 17 additions and 1 deletions

View file

@ -322,6 +322,23 @@ mbedtls_x509_san_list;
*/ */
int mbedtls_x509_dn_gets(char *buf, size_t size, const mbedtls_x509_name *dn); 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. * \brief Return the next relative DN in an X509 name.
* *

View file

@ -21,7 +21,6 @@
#include "mbedtls/rsa.h" #include "mbedtls/rsa.h"
#endif #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, int mbedtls_x509_get_name(unsigned char **p, const unsigned char *end,
mbedtls_x509_name *cur); mbedtls_x509_name *cur);
int mbedtls_x509_get_alg_null(unsigned char **p, const unsigned char *end, int mbedtls_x509_get_alg_null(unsigned char **p, const unsigned char *end,