From 14809c12c4067b1c8104c2287ffc8cee74570e9f Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 24 Sep 2013 13:28:31 -0700 Subject: [PATCH] MSVC doesn't like a definition in a for() loop. --- src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c b/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c index d7f74a6d..910eb10f 100644 --- a/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c +++ b/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c @@ -132,9 +132,11 @@ static inline int blake2s_param_set_personal( blake2s_param *P, const uint8_t pe static inline int blake2s_init0( blake2s_state *S ) { + int i; + memset( S, 0, sizeof( blake2s_state ) ); - for( int i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i]; + for( i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i]; return 0; } @@ -301,6 +303,7 @@ int blake2s_update( blake2s_state *S, const uint8_t *in, uint64_t inlen ) int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen ) { uint8_t buffer[BLAKE2S_OUTBYTES]; + int i; if( S->buflen > BLAKE2S_BLOCKBYTES ) { @@ -315,7 +318,7 @@ int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen ) memset( S->buf + S->buflen, 0, 2 * BLAKE2S_BLOCKBYTES - S->buflen ); /* Padding */ blake2s_compress( S, S->buf ); - for( int i = 0; i < 8; ++i ) /* Output full hash to temp buffer */ + for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */ store32( buffer + sizeof( S->h[i] ) * i, S->h[i] ); memcpy( out, buffer, outlen );