Add output size parameter to signature functions
The functions mbedtls_pk_sign(), mbedtls_pk_sign_restartable(),
mbedtls_ecdsa_write_signature() and mbedtls_ecdsa_write_signature_restartable()
now take an extra parameter indicating the size of the output buffer for the
signature.
No change to RSA because for RSA, the output size is trivial to calculate.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c
index 6a53647..6f730bc 100644
--- a/programs/test/benchmark.c
+++ b/programs/test/benchmark.c
@@ -1088,7 +1088,7 @@
curve_info->name );
TIME_PUBLIC( title, "sign",
ret = mbedtls_ecdsa_write_signature( &ecdsa, MBEDTLS_MD_SHA256, buf, curve_info->bit_size,
- tmp, &sig_len, myrand, NULL ) );
+ tmp, sizeof( tmp ), &sig_len, myrand, NULL ) );
mbedtls_ecdsa_free( &ecdsa );
}
@@ -1104,7 +1104,7 @@
if( mbedtls_ecdsa_genkey( &ecdsa, curve_info->grp_id, myrand, NULL ) != 0 ||
mbedtls_ecdsa_write_signature( &ecdsa, MBEDTLS_MD_SHA256, buf, curve_info->bit_size,
- tmp, &sig_len, myrand, NULL ) != 0 )
+ tmp, sizeof( tmp ), &sig_len, myrand, NULL ) != 0 )
{
mbedtls_exit( 1 );
}