Give x509_{sequence|name}_free() external linkage
With the introduction of `mbedtls_x509_crt_get_{issuer|name}()`,
users need an easy way of freeing the dynamic name structures these
functions return.
To that end, this commit renames `x509_{sequence|name}_free()`
to `mbedtls_x509_{sequence|name}_free()` and gives them external linkage.
diff --git a/include/mbedtls/x509.h b/include/mbedtls/x509.h
index 583bc12..2a9ce99 100644
--- a/include/mbedtls/x509.h
+++ b/include/mbedtls/x509.h
@@ -278,6 +278,26 @@
*/
int mbedtls_x509_time_is_future( const mbedtls_x509_time *from );
+/**
+ * \brief Free a dynamic linked list presentation of an X.509 name
+ * as returned e.g. by mbedtls_x509_crt_get_subject().
+ *
+ * \param name The address of the first name component. This may
+ * be \c NULL, in which case this functions returns
+ * immediately.
+ */
+void mbedtls_x509_name_free( mbedtls_x509_name *name );
+
+/**
+ * \brief Free a dynamic linked list presentation of an X.509 sequence
+ * as returned e.g. by mbedtls_x509_crt_get_subject_alt_name().
+ *
+ * \param seq The address of the first sequence component. This may
+ * be \c NULL, in which case this functions returns
+ * immediately.
+ */
+void mbedtls_x509_sequence_free( mbedtls_x509_sequence *seq );
+
#if defined(MBEDTLS_SELF_TEST)
/**
diff --git a/include/mbedtls/x509_crt.h b/include/mbedtls/x509_crt.h
index ca93e1a..ad6140c 100644
--- a/include/mbedtls/x509_crt.h
+++ b/include/mbedtls/x509_crt.h
@@ -720,7 +720,8 @@
*
* \return \c 0 on success. In this case, the user takes ownership
* of the name context, and is responsible for freeing it
- * once it's no longer needed.
+ * through a call to mbedtls_x509_name_free() once it's no
+ * longer needed.
* \return A negative error code on failure.
*/
int mbedtls_x509_crt_get_subject( mbedtls_x509_crt const *crt,
@@ -744,7 +745,8 @@
*
* \return \c 0 on success. In this case, the user takes ownership
* of the name context, and is responsible for freeing it
- * once it's no longer needed.
+ * through a call to mbedtls_x509_name_free() once it's no
+ * longer needed.
* \return A negative error code on failure.
*/
int mbedtls_x509_crt_get_issuer( mbedtls_x509_crt const *crt,