From 14d6356457a12066f4ed91517bd3882cfdea358c Mon Sep 17 00:00:00 2001 From: Jon Spock Date: Sun, 23 Apr 2017 16:40:05 -0700 Subject: [PATCH 1/2] Squash valgrind warnings for groestl by initing array --- src/crypto/groestl.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/crypto/groestl.c b/src/crypto/groestl.c index 928bc41efab9b..e3c106daa4514 100644 --- a/src/crypto/groestl.c +++ b/src/crypto/groestl.c @@ -2738,7 +2738,7 @@ static void groestl_small_init(sph_groestl_small_context *sc, unsigned out_size) { size_t u; - + for (u = 0; u < 64; u ++) sc->buf[u] = 0; sc->ptr = 0; #if SPH_GROESTL_64 for (u = 0; u < 7; u ++) @@ -2815,13 +2815,13 @@ groestl_small_close(sph_groestl_small_context *sc, { unsigned char *buf; unsigned char pad[72]; - size_t u, ptr, pad_len; + size_t u=0, ptr=0, pad_len=0; #if SPH_64 - sph_u64 count; + sph_u64 count=0; #else - sph_u32 count_high, count_low; + sph_u32 count_high=0, count_low=0; #endif - unsigned z; + unsigned z=0; DECL_STATE_SMALL buf = sc->buf; @@ -2875,6 +2875,7 @@ groestl_big_init(sph_groestl_big_context *sc, unsigned out_size) { size_t u; + for (u = 0; u < 128; u ++) sc->buf[u] = 0; sc->ptr = 0; #if SPH_GROESTL_64 for (u = 0; u < 15; u ++) From 2f68a8dede18953b9a2304330a905e03f6da2934 Mon Sep 17 00:00:00 2001 From: Jon Spock Date: Sun, 23 Apr 2017 18:45:07 -0700 Subject: [PATCH 2/2] More initialization --- src/crypto/groestl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto/groestl.c b/src/crypto/groestl.c index e3c106daa4514..72290f2d65368 100644 --- a/src/crypto/groestl.c +++ b/src/crypto/groestl.c @@ -2952,13 +2952,13 @@ groestl_big_close(sph_groestl_big_context *sc, { unsigned char *buf; unsigned char pad[136]; - size_t ptr, pad_len, u; + size_t ptr=0, pad_len=0, u=0; #if SPH_64 - sph_u64 count; + sph_u64 count=0; #else - sph_u32 count_high, count_low; + sph_u32 count_high=0, count_low=0; #endif - unsigned z; + unsigned z=0; DECL_STATE_BIG buf = sc->buf;