fixed some (warning) issues

This commit is contained in:
bg 2007-06-26 06:03:40 +00:00
parent acf2f69a21
commit 9f11048760
3 changed files with 4 additions and 5 deletions

View File

@ -95,7 +95,7 @@ void hmac_sha256(void* dest, void* key, uint16_t kl, void* msg, uint64_t ml){ /*
sha256_nextBlock(&s, buffer); sha256_nextBlock(&s, buffer);
while (ml >= SHA256_BLOCK_BITS){ while (ml >= SHA256_BLOCK_BITS){
sha256_nextBlock(&s, msg); sha256_nextBlock(&s, msg);
msg += SHA256_BLOCK_BITS/8; msg = (uint8_t*)msg + SHA256_BLOCK_BITS/8;
ml -= SHA256_BLOCK_BITS; ml -= SHA256_BLOCK_BITS;
} }
sha256_lastBlock(&s, msg, ml); sha256_lastBlock(&s, msg, ml);

4
prng.c
View File

@ -140,12 +140,12 @@ uint8_t getRandomByte(void){
void fillBlockRandom(void* block, unsigned length){ void fillBlockRandom(void* block, unsigned length){
while(length>RANDOMBLOCK_SIZE){ while(length>RANDOMBLOCK_SIZE){
getRandomBlock(block); getRandomBlock(block);
block += RANDOMBLOCK_SIZE; block = (uint8_t*)block + RANDOMBLOCK_SIZE;
length -= RANDOMBLOCK_SIZE; length -= RANDOMBLOCK_SIZE;
} }
while(length){ while(length){
*((uint8_t*)block) = getRandomByte(); *((uint8_t*)block) = getRandomByte();
++block; --length; block= (uint8_t*)block +1; --length;
} }
} }

View File

@ -20,7 +20,6 @@
/* /*
* *
*/ */
static
void memxor(uint8_t * dest, uint8_t * src, uint8_t length){ void memxor(uint8_t * dest, uint8_t * src, uint8_t length){
while(length--){ while(length--){
*dest++ ^= *src++; *dest++ ^= *src++;
@ -47,7 +46,7 @@ void shabea128(void * block, void * key, uint16_t keysize, uint8_t enc, uint8_t
for(;r!=(enc?(rounds):-1);enc?r++:r--){ /* enc: 0..(rounds-1) ; !enc: (rounds-1)..0 */ for(;r!=(enc?(rounds):-1);enc?r++:r--){ /* enc: 0..(rounds-1) ; !enc: (rounds-1)..0 */
memcpy(tb, R, 8); /* copy right half into tb */ memcpy(tb, R, 8); /* copy right half into tb */
tb[8+1] = r; tb[8+1] = r;
sha256(hash, tb, 64+16+keysize); sha256(&hash, tb, 64+16+keysize);
if(!(r==(enc?(rounds-1):0))){ if(!(r==(enc?(rounds-1):0))){
/* swap */ /* swap */
memxor(hash, L, 8); memxor(hash, L, 8);