Skip to content

Commit 1af61cb

Browse files
author
Andrzej Kurek
committed
Introduce a new macro for hash size in ecdsa tests
Previously these tests depended on the definition from inside the MD module, which in turn could be 32 or 64 bytes depending on whether MBEDTLS_SHA512_C was defined. This is unnecessary, so a constant is itnroduced instead. Signed-off-by: Andrzej Kurek <[email protected]>
1 parent 9f42c06 commit 1af61cb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/suites/test_suite_ecdsa.function

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
( !defined(MBEDTLS_ECDSA_DETERMINISTIC) && defined(MBEDTLS_HAS_ALG_SHA_256_VIA_LOWLEVEL_OR_PSA) )
66
#define MBEDTLS_HAS_ALG_SHA_256_VIA_MD_IF_DETERMINISTIC
77
#endif
8+
#define MBEDTLS_TEST_HASH_MAX_SIZE 64
89
/* END_HEADER */
910

1011
/* BEGIN_DEPENDENCIES
@@ -19,7 +20,7 @@ void ecdsa_prim_zero( int id )
1920
mbedtls_ecp_point Q;
2021
mbedtls_mpi d, r, s;
2122
mbedtls_test_rnd_pseudo_info rnd_info;
22-
unsigned char buf[MBEDTLS_MD_MAX_SIZE];
23+
unsigned char buf[MBEDTLS_TEST_HASH_MAX_SIZE];
2324

2425
mbedtls_ecp_group_init( &grp );
2526
mbedtls_ecp_point_init( &Q );
@@ -51,7 +52,7 @@ void ecdsa_prim_random( int id )
5152
mbedtls_ecp_point Q;
5253
mbedtls_mpi d, r, s;
5354
mbedtls_test_rnd_pseudo_info rnd_info;
54-
unsigned char buf[MBEDTLS_MD_MAX_SIZE];
55+
unsigned char buf[MBEDTLS_TEST_HASH_MAX_SIZE];
5556

5657
mbedtls_ecp_group_init( &grp );
5758
mbedtls_ecp_point_init( &Q );

0 commit comments

Comments
 (0)