@@ -, +, @@ -- --- cipher/random.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) --- a/cipher/random.c +++ a/cipher/random.c @@ -360,23 +360,21 @@ mix_pool(byte *pool) #if DIGESTLEN != 20 #error must have a digest length of 20 for ripe-md-160 #endif - /* loop over the pool */ + /* pool -> pool' */ pend = pool + POOLSIZE; memcpy(hashbuf, pend - DIGESTLEN, DIGESTLEN ); memcpy(hashbuf+DIGESTLEN, pool, BLOCKLEN-DIGESTLEN); rmd160_mixblock( &md, hashbuf); memcpy(pool, hashbuf, 20 ); + /* Loop for the remaining iterations. */ p = pool; for( n=1; n < POOLBLOCKS; n++ ) { - memcpy(hashbuf, p, DIGESTLEN ); - - p += DIGESTLEN; - if( p+DIGESTLEN+BLOCKLEN < pend ) - memcpy(hashbuf+DIGESTLEN, p+DIGESTLEN, BLOCKLEN-DIGESTLEN); + if( p + BLOCKLEN < pend ) + memcpy(hashbuf, p, BLOCKLEN); else { - char *pp = p+DIGESTLEN; - for(i=DIGESTLEN; i < BLOCKLEN; i++ ) { + char *pp = p; + for(i=0; i < BLOCKLEN; i++ ) { if( pp >= pend ) pp = pool; hashbuf[i] = *pp++; @@ -384,6 +382,7 @@ mix_pool(byte *pool) } rmd160_mixblock( &md, hashbuf); + p += DIGESTLEN; memcpy(p, hashbuf, 20 ); } burn_stack (384); /* for the rmd160_mixblock() */ --