diff options
author | Christian Heimes <christian@python.org> | 2016-09-06 22:09:22 (GMT) |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2016-09-06 22:09:22 (GMT) |
commit | 9c2f3041039b21ec08ed3179333460110ff6a355 (patch) | |
tree | 556a142cba01666379179628369af59d853f0a79 /Modules/_blake2/impl | |
parent | 8482ce4868afe9d77cf312a29b6ccf0ab76dd1b8 (diff) | |
download | cpython-9c2f3041039b21ec08ed3179333460110ff6a355.zip cpython-9c2f3041039b21ec08ed3179333460110ff6a355.tar.gz cpython-9c2f3041039b21ec08ed3179333460110ff6a355.tar.bz2 |
Issue #26798: for loop initial declarations, take 2
Diffstat (limited to 'Modules/_blake2/impl')
-rw-r--r-- | Modules/_blake2/impl/blake2b-ref.c | 10 | ||||
-rw-r--r-- | Modules/_blake2/impl/blake2b.c | 7 | ||||
-rw-r--r-- | Modules/_blake2/impl/blake2s-ref.c | 16 | ||||
-rw-r--r-- | Modules/_blake2/impl/blake2s.c | 7 |
4 files changed, 23 insertions, 17 deletions
diff --git a/Modules/_blake2/impl/blake2b-ref.c b/Modules/_blake2/impl/blake2b-ref.c index 6b56fce..7c1301b 100644 --- a/Modules/_blake2/impl/blake2b-ref.c +++ b/Modules/_blake2/impl/blake2b-ref.c @@ -157,11 +157,12 @@ BLAKE2_LOCAL_INLINE(int) blake2b_init0( blake2b_state *S ) int blake2b_init_param( blake2b_state *S, const blake2b_param *P ) { const uint8_t *p = ( const uint8_t * )( P ); + size_t i; blake2b_init0( S ); /* IV XOR ParamBlock */ - for( size_t i = 0; i < 8; ++i ) + for( i = 0; i < 8; ++i ) S->h[i] ^= load64( p + sizeof( S->h[i] ) * i ); return 0; @@ -392,14 +393,15 @@ int main( int argc, char **argv ) { uint8_t key[BLAKE2B_KEYBYTES]; uint8_t buf[KAT_LENGTH]; + size_t i; - for( size_t i = 0; i < BLAKE2B_KEYBYTES; ++i ) + for( i = 0; i < BLAKE2B_KEYBYTES; ++i ) key[i] = ( uint8_t )i; - for( size_t i = 0; i < KAT_LENGTH; ++i ) + for( i = 0; i < KAT_LENGTH; ++i ) buf[i] = ( uint8_t )i; - for( size_t i = 0; i < KAT_LENGTH; ++i ) + for( i = 0; i < KAT_LENGTH; ++i ) { uint8_t hash[BLAKE2B_OUTBYTES]; blake2b( hash, buf, key, BLAKE2B_OUTBYTES, i, BLAKE2B_KEYBYTES ); diff --git a/Modules/_blake2/impl/blake2b.c b/Modules/_blake2/impl/blake2b.c index 784ec00..58c79fa 100644 --- a/Modules/_blake2/impl/blake2b.c +++ b/Modules/_blake2/impl/blake2b.c @@ -426,14 +426,15 @@ int main( int argc, char **argv ) { uint8_t key[BLAKE2B_KEYBYTES]; uint8_t buf[KAT_LENGTH]; + size_t i; - for( size_t i = 0; i < BLAKE2B_KEYBYTES; ++i ) + for( i = 0; i < BLAKE2B_KEYBYTES; ++i ) key[i] = ( uint8_t )i; - for( size_t i = 0; i < KAT_LENGTH; ++i ) + for( i = 0; i < KAT_LENGTH; ++i ) buf[i] = ( uint8_t )i; - for( size_t i = 0; i < KAT_LENGTH; ++i ) + for( i = 0; i < KAT_LENGTH; ++i ) { uint8_t hash[BLAKE2B_OUTBYTES]; blake2b( hash, buf, key, BLAKE2B_OUTBYTES, i, BLAKE2B_KEYBYTES ); diff --git a/Modules/_blake2/impl/blake2s-ref.c b/Modules/_blake2/impl/blake2s-ref.c index 0cf4707..157e9a2 100644 --- a/Modules/_blake2/impl/blake2s-ref.c +++ b/Modules/_blake2/impl/blake2s-ref.c @@ -154,7 +154,7 @@ int blake2s_init_param( blake2s_state *S, const blake2s_param *P ) blake2s_init0( S ); /* IV XOR ParamBlock */ - for( size_t i = 0; i < 8; ++i ) + for( i = 0; i < 8; ++i ) S->h[i] ^= load32( &p[i] ); return 0; @@ -219,11 +219,12 @@ static int blake2s_compress( blake2s_state *S, const uint8_t block[BLAKE2S_BLOCK { uint32_t m[16]; uint32_t v[16]; + size_t i; - for( size_t i = 0; i < 16; ++i ) + for( i = 0; i < 16; ++i ) m[i] = load32( block + i * sizeof( m[i] ) ); - for( size_t i = 0; i < 8; ++i ) + for( i = 0; i < 8; ++i ) v[i] = S->h[i]; v[ 8] = blake2s_IV[0]; @@ -267,7 +268,7 @@ static int blake2s_compress( blake2s_state *S, const uint8_t block[BLAKE2S_BLOCK ROUND( 8 ); ROUND( 9 ); - for( size_t i = 0; i < 8; ++i ) + for( i = 0; i < 8; ++i ) S->h[i] = S->h[i] ^ v[i] ^ v[i + 8]; #undef G @@ -381,14 +382,15 @@ int main( int argc, char **argv ) { uint8_t key[BLAKE2S_KEYBYTES]; uint8_t buf[KAT_LENGTH]; + size_t i; - for( size_t i = 0; i < BLAKE2S_KEYBYTES; ++i ) + for( i = 0; i < BLAKE2S_KEYBYTES; ++i ) key[i] = ( uint8_t )i; - for( size_t i = 0; i < KAT_LENGTH; ++i ) + for( i = 0; i < KAT_LENGTH; ++i ) buf[i] = ( uint8_t )i; - for( size_t i = 0; i < KAT_LENGTH; ++i ) + for( i = 0; i < KAT_LENGTH; ++i ) { uint8_t hash[BLAKE2S_OUTBYTES]; blake2s( hash, buf, key, BLAKE2S_OUTBYTES, i, BLAKE2S_KEYBYTES ); diff --git a/Modules/_blake2/impl/blake2s.c b/Modules/_blake2/impl/blake2s.c index 3aea4af..ccad662 100644 --- a/Modules/_blake2/impl/blake2s.c +++ b/Modules/_blake2/impl/blake2s.c @@ -407,14 +407,15 @@ int main( int argc, char **argv ) { uint8_t key[BLAKE2S_KEYBYTES]; uint8_t buf[KAT_LENGTH]; + size_t i; - for( size_t i = 0; i < BLAKE2S_KEYBYTES; ++i ) + for( i = 0; i < BLAKE2S_KEYBYTES; ++i ) key[i] = ( uint8_t )i; - for( size_t i = 0; i < KAT_LENGTH; ++i ) + for( i = 0; i < KAT_LENGTH; ++i ) buf[i] = ( uint8_t )i; - for( size_t i = 0; i < KAT_LENGTH; ++i ) + for( i = 0; i < KAT_LENGTH; ++i ) { uint8_t hash[BLAKE2S_OUTBYTES]; |