New internal module for managing hash information
Using static inline functions is bad for code size; the function from
md_internal.h was already used from 3 different C files, so already was
copied at least 3 times in the library, and this would only get worse
over time.
Use actual functions, and also share the actual data between them.
Provide a consistent set of operations. Conversion to/from
human-readable string was omitted for now but could be added later if
needed.
In the future, this can be used to replace other similar (inline)
functions that are currently scattered, including (but perhaps not
limited to):
- mbedtls_psa_translate_md() from psa_util.h
- mbedtls_md_info_from_psa() (indirectly) from psa_crypto_hash.h
- get_md_alg_from_psa() from psa_crypto_rsa.c
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function
index 1899b26..ca471f1 100644
--- a/tests/suites/test_suite_pk.function
+++ b/tests/suites/test_suite_pk.function
@@ -7,7 +7,7 @@
#include "mbedtls/ecp.h"
#include "mbedtls/rsa.h"
-#include "md_internal.h"
+#include "hash_info.h"
#include "use_psa_helpers.h"
#include <limits.h>
@@ -1277,7 +1277,7 @@
size_t sig_len;
unsigned char sig[MBEDTLS_PK_SIGNATURE_MAX_SIZE];
unsigned char hash[PSA_HASH_MAX_SIZE];
- size_t hash_len = mbedtls_md_internal_get_size( md_alg );
+ size_t hash_len = mbedtls_hash_info_get_size( md_alg );
void const *options = NULL;
mbedtls_pk_rsassa_pss_options rsassa_pss_options;
memset( hash, 0x2a, sizeof( hash ) );