X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=hfal-basic.c;h=551a8bc18b7d0103d8ba46036e01382f047e485b;hb=3711896e923a5d819733fbfe50590e7e1e6ab51a;hp=82c040bca00425931d525583e695a20308921017;hpb=302f07c97444e2f5f5560dc2fd9af58d4b591d45;p=avr-crypto-lib.git diff --git a/hfal-basic.c b/hfal-basic.c index 82c040b..551a8bc 100644 --- a/hfal-basic.c +++ b/hfal-basic.c @@ -70,22 +70,21 @@ void hfal_hash_mem(const hfdesc_t* hash_descriptor, void* dest, const void* msg, if(f){ ((hf_mem_fpt)f)(dest, msg, length_b); }else{ - uint16_t bs,bsb; uint8_t ctx[pgm_read_word(&(hash_descriptor->ctxsize_B))]; - f=(void_fpt)pgm_read_word(&(hash_descriptor->init)); + f=(void_fpt)(pgm_read_word(&(hash_descriptor->init))); ((hf_init_fpt)f)(ctx); bs=pgm_read_word(&(hash_descriptor->blocksize_b)); bsb=bs/8; - f=(void_fpt)pgm_read_word(&(hash_descriptor->nextBlock)); - while(length_b>=bs){ + f=(void_fpt)(pgm_read_word(&(hash_descriptor->nextBlock))); + while(length_b>bs){ ((hf_nextBlock_fpt)f)(ctx, msg); length_b -= bs; msg = (uint8_t*)msg + bsb; } - f=(void_fpt)pgm_read_word(&(hash_descriptor->lastBlock)); + f=(void_fpt)(pgm_read_word(&(hash_descriptor->lastBlock))); ((hf_lastBlock_fpt)f)(ctx, msg, length_b); - f=(void_fpt)pgm_read_word(&(hash_descriptor->ctx2hash)); + f=(void_fpt)(pgm_read_word(&(hash_descriptor->ctx2hash))); ((hf_ctx2hash_fpt)f)(dest, ctx); } }