Avoid a dependency on MD in test_suite_pk

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard 2022-07-05 12:09:04 +02:00
parent a370e06e30
commit 6a0a160f99

View file

@ -7,6 +7,8 @@
#include "mbedtls/ecp.h"
#include "mbedtls/rsa.h"
#include "md_internal.h"
#include <limits.h>
#include <stdint.h>
@ -1316,8 +1318,7 @@ void pk_psa_sign_ext( int pk_type, int parameter, int key_pk_type, int md_alg )
size_t sig_len;
unsigned char sig[MBEDTLS_PK_SIGNATURE_MAX_SIZE];
unsigned char hash[MBEDTLS_MD_MAX_SIZE];
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( md_alg );
size_t hash_len = mbedtls_md_get_size( md_info );
size_t hash_len = mbedtls_md_internal_get_size( md_alg );
void const *options = NULL;
mbedtls_pk_rsassa_pss_options rsassa_pss_options;
memset( hash, 0x2a, sizeof( hash ) );
@ -1338,8 +1339,8 @@ void pk_psa_sign_ext( int pk_type, int parameter, int key_pk_type, int md_alg )
if( key_pk_type == MBEDTLS_PK_RSASSA_PSS )
{
rsassa_pss_options.mgf1_hash_id = md_alg;
TEST_ASSERT( md_info != NULL );
rsassa_pss_options.expected_salt_len = mbedtls_md_get_size( md_info );
TEST_ASSERT( hash_len != 0 );
rsassa_pss_options.expected_salt_len = hash_len;
options = (const void*) &rsassa_pss_options;
}
TEST_ASSERT( mbedtls_pk_verify_ext( key_pk_type, options, &pk, md_alg,