Issue #26798: for loop initial declarations are only allowed in C99 or C11 mode

This commit is contained in:
Christian Heimes 2016-09-06 23:18:03 +02:00
parent 90493ab30c
commit 87bf0febcb
4 changed files with 18 additions and 9 deletions

View file

@ -145,9 +145,10 @@ BLAKE2_LOCAL_INLINE(int) blake2b_param_set_personal( blake2b_param *P, const uin
BLAKE2_LOCAL_INLINE(int) blake2b_init0( blake2b_state *S )
{
int i;
memset( S, 0, sizeof( blake2b_state ) );
for( int i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
for( i = 0; i < 8; ++i ) S->h[i] = blake2b_IV[i];
return 0;
}
@ -319,6 +320,7 @@ int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen )
int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
{
uint8_t buffer[BLAKE2B_OUTBYTES] = {0};
int i;
if( out == NULL || outlen == 0 || outlen > BLAKE2B_OUTBYTES )
return -1;
@ -339,7 +341,7 @@ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
memset( S->buf + S->buflen, 0, 2 * BLAKE2B_BLOCKBYTES - S->buflen ); /* Padding */
blake2b_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 */
store64( buffer + sizeof( S->h[i] ) * i, S->h[i] );
memcpy( out, buffer, outlen );