Make it clearer what's part of MD-light or not

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/include/mbedtls/md.h b/include/mbedtls/md.h
index f9349e1..013cb65 100644
--- a/include/mbedtls/md.h
+++ b/include/mbedtls/md.h
@@ -4,12 +4,15 @@
  * \brief   This file contains the generic functions for message-digest
  *          (hashing) and HMAC.
  *
- *          Availability of function in this modules is controled by two
+ *          Availability of functions in this modules is controled by two
  *          feature macros:
  *          - MBEDTLS_MD_C enables the whole module;
- *          - MBEDTLS_MD_LIGHT enables only functions for hashing an accessing
- *          some hash metadata; is it automatically set whenever MBEDTLS_MD_C
- *          is set.
+ *          - MBEDTLS_MD_LIGHT enables only functions for hashing and accessing
+ *          most hash metadata (everything except string names); is it
+ *          automatically set whenever MBEDTLS_MD_C is defined.
+ *
+ *          The functions that are only available when MBEDTLS_MD_C is defined
+ *          are grouped at the end of the file and guarded by this macro.
  *
  * \author Adriaan de Jong <dejong@fox-it.com>
  */
@@ -115,32 +118,6 @@
     void *MBEDTLS_PRIVATE(hmac_ctx);
 } mbedtls_md_context_t;
 
-#if defined(MBEDTLS_MD_C)
-/**
- * \brief           This function returns the list of digests supported by the
- *                  generic digest module.
- *
- * \note            The list starts with the strongest available hashes.
- *
- * \return          A statically allocated array of digests. Each element
- *                  in the returned list is an integer belonging to the
- *                  message-digest enumeration #mbedtls_md_type_t.
- *                  The last entry is 0.
- */
-const int *mbedtls_md_list(void);
-
-/**
- * \brief           This function returns the message-digest information
- *                  associated with the given digest name.
- *
- * \param md_name   The name of the digest to search for.
- *
- * \return          The message-digest information associated with \p md_name.
- * \return          NULL if the associated message-digest information is not found.
- */
-const mbedtls_md_info_t *mbedtls_md_info_from_string(const char *md_name);
-#endif /* MBEDTLS_MD_C */
-
 /**
  * \brief           This function returns the message-digest information
  *                  associated with the given digest type.
@@ -152,21 +129,6 @@
  */
 const mbedtls_md_info_t *mbedtls_md_info_from_type(mbedtls_md_type_t md_type);
 
-#if defined(MBEDTLS_MD_C)
-/**
- * \brief           This function returns the message-digest information
- *                  from the given context.
- *
- * \param ctx       The context from which to extract the information.
- *                  This must be initialized (or \c NULL).
- *
- * \return          The message-digest information associated with \p ctx.
- * \return          \c NULL if \p ctx is \c NULL.
- */
-const mbedtls_md_info_t *mbedtls_md_info_from_ctx(
-    const mbedtls_md_context_t *ctx);
-#endif /* MBEDTLS_MD_C */
-
 /**
  * \brief           This function initializes a message-digest context without
  *                  binding it to a particular message-digest algorithm.
@@ -260,19 +222,6 @@
  */
 mbedtls_md_type_t mbedtls_md_get_type(const mbedtls_md_info_t *md_info);
 
-#if defined(MBEDTLS_MD_C)
-/**
- * \brief           This function extracts the message-digest name from the
- *                  message-digest information structure.
- *
- * \param md_info   The information structure of the message-digest algorithm
- *                  to use.
- *
- * \return          The name of the message digest.
- */
-const char *mbedtls_md_get_name(const mbedtls_md_info_t *md_info);
-#endif /* MBEDTLS_MD_C */
-
 /**
  * \brief           This function starts a message-digest computation.
  *
@@ -351,7 +300,61 @@
 int mbedtls_md(const mbedtls_md_info_t *md_info, const unsigned char *input, size_t ilen,
                unsigned char *output);
 
-#if defined(MBEDTLS_FS_IO) && defined(MBEDTLS_MD_C)
+/************************************************************************
+ * Functions below this separator are not part of MBEDTLS_MD_LIGHT      *
+ * and require MBEDTLS_MD_C                                             *
+ ************************************************************************/
+
+#if defined(MBEDTLS_MD_C)
+/**
+ * \brief           This function returns the list of digests supported by the
+ *                  generic digest module.
+ *
+ * \note            The list starts with the strongest available hashes.
+ *
+ * \return          A statically allocated array of digests. Each element
+ *                  in the returned list is an integer belonging to the
+ *                  message-digest enumeration #mbedtls_md_type_t.
+ *                  The last entry is 0.
+ */
+const int *mbedtls_md_list(void);
+
+/**
+ * \brief           This function returns the message-digest information
+ *                  associated with the given digest name.
+ *
+ * \param md_name   The name of the digest to search for.
+ *
+ * \return          The message-digest information associated with \p md_name.
+ * \return          NULL if the associated message-digest information is not found.
+ */
+const mbedtls_md_info_t *mbedtls_md_info_from_string(const char *md_name);
+
+/**
+ * \brief           This function extracts the message-digest name from the
+ *                  message-digest information structure.
+ *
+ * \param md_info   The information structure of the message-digest algorithm
+ *                  to use.
+ *
+ * \return          The name of the message digest.
+ */
+const char *mbedtls_md_get_name(const mbedtls_md_info_t *md_info);
+
+/**
+ * \brief           This function returns the message-digest information
+ *                  from the given context.
+ *
+ * \param ctx       The context from which to extract the information.
+ *                  This must be initialized (or \c NULL).
+ *
+ * \return          The message-digest information associated with \p ctx.
+ * \return          \c NULL if \p ctx is \c NULL.
+ */
+const mbedtls_md_info_t *mbedtls_md_info_from_ctx(
+    const mbedtls_md_context_t *ctx);
+
+#if defined(MBEDTLS_FS_IO)
 /**
  * \brief          This function calculates the message-digest checksum
  *                 result of the contents of the provided file.
@@ -372,9 +375,8 @@
 MBEDTLS_CHECK_RETURN_TYPICAL
 int mbedtls_md_file(const mbedtls_md_info_t *md_info, const char *path,
                     unsigned char *output);
-#endif /* MBEDTLS_FS_IO && MBEDTLS_MD_C */
+#endif /* MBEDTLS_FS_IO */
 
-#if defined(MBEDTLS_MD_C)
 /**
  * \brief           This function sets the HMAC key and prepares to
  *                  authenticate a new message.