MSVC doesn't like a definition in a for() loop.

This commit is contained in:
Frank Denis 2013-09-24 13:28:31 -07:00
parent 30026fbbfe
commit 14809c12c4

View File

@ -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 ) static inline int blake2s_init0( blake2s_state *S )
{ {
int i;
memset( S, 0, sizeof( blake2s_state ) ); 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; 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 ) int blake2s_final( blake2s_state *S, uint8_t *out, uint8_t outlen )
{ {
uint8_t buffer[BLAKE2S_OUTBYTES]; uint8_t buffer[BLAKE2S_OUTBYTES];
int i;
if( S->buflen > BLAKE2S_BLOCKBYTES ) 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 */ memset( S->buf + S->buflen, 0, 2 * BLAKE2S_BLOCKBYTES - S->buflen ); /* Padding */
blake2s_compress( S, S->buf ); 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] ); store32( buffer + sizeof( S->h[i] ) * i, S->h[i] );
memcpy( out, buffer, outlen ); memcpy( out, buffer, outlen );