MD: Embed digest context structure into MD wrapper context
diff --git a/include/mbedtls/md.h b/include/mbedtls/md.h
index 2776568..942d1f5 100644
--- a/include/mbedtls/md.h
+++ b/include/mbedtls/md.h
@@ -108,6 +108,8 @@
 
 #endif /* !MBEDTLS_MD_SINGLE_HASH */
 
+#include "md_internal.h"
+
 /**
  * The generic message-digest context.
  */
@@ -118,11 +120,20 @@
     mbedtls_md_handle_t md_info;
 #endif
 
+#if !defined(MBEDTLS_MD_SINGLE_HASH)
     /** The digest-specific context. */
     void *md_ctx;
 
     /** The HMAC part of the context. */
     void *hmac_ctx;
+#else
+    unsigned char md_ctx[ sizeof( MBEDTLS_MD_INFO_CTX_TYPE(
+                                      MBEDTLS_MD_SINGLE_HASH ) ) ];
+
+    unsigned char hmac_ctx[ 2 * MBEDTLS_MD_INFO_BLOCKSIZE(
+                                      MBEDTLS_MD_SINGLE_HASH ) ];
+
+#endif /* MBEDTLS_MD_SINGLE_HASH */
 } mbedtls_md_context_t;
 
 #if !defined(MBEDTLS_MD_SINGLE_HASH)
@@ -140,8 +151,6 @@
 }
 #endif /* !MBEDTLS_MD_SINGLE_HASH */
 
-#include "md_internal.h"
-
 /**
  * \brief           This function returns the list of digests supported by the
  *                  generic digest module.