From 102a620c9a2f6c98f51766bfcbf62ec4e349856e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 27 Aug 2015 21:51:44 +0200 Subject: [PATCH] Fix hash buffer size in pkey programs --- programs/pkey/dh_client.c | 2 +- programs/pkey/dh_server.c | 2 +- programs/pkey/pk_sign.c | 2 +- programs/pkey/pk_verify.c | 2 +- programs/pkey/rsa_sign.c | 2 +- programs/pkey/rsa_sign_pss.c | 2 +- programs/pkey/rsa_verify.c | 2 +- programs/pkey/rsa_verify_pss.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/programs/pkey/dh_client.c b/programs/pkey/dh_client.c index 10b9b7a48..2909d1dda 100644 --- a/programs/pkey/dh_client.c +++ b/programs/pkey/dh_client.c @@ -75,7 +75,7 @@ int main( void ) unsigned char *p, *end; unsigned char buf[2048]; - unsigned char hash[20]; + unsigned char hash[32]; const char *pers = "dh_client"; mbedtls_entropy_context entropy; diff --git a/programs/pkey/dh_server.c b/programs/pkey/dh_server.c index 6ce1da23d..53a299a49 100644 --- a/programs/pkey/dh_server.c +++ b/programs/pkey/dh_server.c @@ -74,7 +74,7 @@ int main( void ) mbedtls_net_context listen_fd, client_fd; unsigned char buf[2048]; - unsigned char hash[20]; + unsigned char hash[32]; unsigned char buf2[2]; const char *pers = "dh_server"; diff --git a/programs/pkey/pk_sign.c b/programs/pkey/pk_sign.c index 43e01f898..82be0cf0c 100644 --- a/programs/pkey/pk_sign.c +++ b/programs/pkey/pk_sign.c @@ -64,7 +64,7 @@ int main( int argc, char *argv[] ) mbedtls_pk_context pk; mbedtls_entropy_context entropy; mbedtls_ctr_drbg_context ctr_drbg; - unsigned char hash[20]; + unsigned char hash[32]; unsigned char buf[MBEDTLS_MPI_MAX_SIZE]; char filename[512]; const char *pers = "mbedtls_pk_sign"; diff --git a/programs/pkey/pk_verify.c b/programs/pkey/pk_verify.c index fa3c0e09d..404139754 100644 --- a/programs/pkey/pk_verify.c +++ b/programs/pkey/pk_verify.c @@ -59,7 +59,7 @@ int main( int argc, char *argv[] ) int ret = 1; size_t i; mbedtls_pk_context pk; - unsigned char hash[20]; + unsigned char hash[32]; unsigned char buf[MBEDTLS_MPI_MAX_SIZE]; char filename[512]; diff --git a/programs/pkey/rsa_sign.c b/programs/pkey/rsa_sign.c index 3ff411abb..54f60c55e 100644 --- a/programs/pkey/rsa_sign.c +++ b/programs/pkey/rsa_sign.c @@ -59,7 +59,7 @@ int main( int argc, char *argv[] ) int ret; size_t i; mbedtls_rsa_context rsa; - unsigned char hash[20]; + unsigned char hash[32]; unsigned char buf[MBEDTLS_MPI_MAX_SIZE]; char filename[512]; diff --git a/programs/pkey/rsa_sign_pss.c b/programs/pkey/rsa_sign_pss.c index dd9386b75..2b358c16c 100644 --- a/programs/pkey/rsa_sign_pss.c +++ b/programs/pkey/rsa_sign_pss.c @@ -65,7 +65,7 @@ int main( int argc, char *argv[] ) mbedtls_pk_context pk; mbedtls_entropy_context entropy; mbedtls_ctr_drbg_context ctr_drbg; - unsigned char hash[20]; + unsigned char hash[32]; unsigned char buf[MBEDTLS_MPI_MAX_SIZE]; char filename[512]; const char *pers = "rsa_sign_pss"; diff --git a/programs/pkey/rsa_verify.c b/programs/pkey/rsa_verify.c index 63cc17c71..600474eae 100644 --- a/programs/pkey/rsa_verify.c +++ b/programs/pkey/rsa_verify.c @@ -58,7 +58,7 @@ int main( int argc, char *argv[] ) int ret, c; size_t i; mbedtls_rsa_context rsa; - unsigned char hash[20]; + unsigned char hash[32]; unsigned char buf[MBEDTLS_MPI_MAX_SIZE]; char filename[512]; diff --git a/programs/pkey/rsa_verify_pss.c b/programs/pkey/rsa_verify_pss.c index ee92c8287..bcba791c7 100644 --- a/programs/pkey/rsa_verify_pss.c +++ b/programs/pkey/rsa_verify_pss.c @@ -63,7 +63,7 @@ int main( int argc, char *argv[] ) int ret = 1; size_t i; mbedtls_pk_context pk; - unsigned char hash[20]; + unsigned char hash[32]; unsigned char buf[MBEDTLS_MPI_MAX_SIZE]; char filename[512];