Remove handle from MD context in single hash config
diff --git a/include/mbedtls/md.h b/include/mbedtls/md.h
index 97d3b06..2810a91 100644
--- a/include/mbedtls/md.h
+++ b/include/mbedtls/md.h
@@ -104,8 +104,10 @@
*/
typedef struct mbedtls_md_context_t
{
+#if !defined(MBEDTLS_MD_SINGLE_HASH)
/** Information about the associated message digest. */
mbedtls_md_handle_t md_info;
+#endif
/** The digest-specific context. */
void *md_ctx;
@@ -114,11 +116,20 @@
void *hmac_ctx;
} mbedtls_md_context_t;
+#if !defined(MBEDTLS_MD_SINGLE_HASH)
static inline mbedtls_md_handle_t mbedtls_md_get_handle(
struct mbedtls_md_context_t const *ctx )
{
return( ctx->md_info );
}
+#else /* !MBEDTLS_MD_SINGLE_HASH */
+static inline mbedtls_md_handle_t mbedtls_md_get_handle(
+ struct mbedtls_md_context_t const *ctx )
+{
+ ((void) ctx);
+ return( MBEDTLS_MD_UNIQUE_VALID_HANDLE );
+}
+#endif /* !MBEDTLS_MD_SINGLE_HASH */
/**
* \brief This function returns the list of digests supported by the
diff --git a/library/md.c b/library/md.c
index abc2ad3..cbe92dd 100644
--- a/library/md.c
+++ b/library/md.c
@@ -1167,7 +1167,9 @@
}
}
+#if !defined(MBEDTLS_MD_SINGLE_HASH)
ctx->md_info = md_info;
+#endif
return( 0 );
}