X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=shabea.c;h=e786139ce75692ad56e98a2cf84ba375d48fcfaf;hb=bfac0f0eef1c956bf6fbc023708f17ecfda9b39d;hp=844788a00defbe64c5a08ae6fb1d5c624e83e9f2;hpb=639b9bea16571c3f3a901cefc4bca48f84b09705;p=avr-crypto-lib.git diff --git a/shabea.c b/shabea.c index 844788a..e786139 100644 --- a/shabea.c +++ b/shabea.c @@ -39,13 +39,12 @@ void memxor(uint8_t * dest, uint8_t * src, uint8_t length){ #define R ((uint8_t*)block+16) void shabea256(void * block, void * key, uint16_t keysize, uint8_t enc, uint8_t rounds){ int8_t r; /**/ - uint8_t *tb; /**/ + uint8_t tb[HALFSIZEB+2+(keysize+7)/8]; /**/ uint16_t kbs; /* bytes used for the key / temporary block */ sha256_hash_t hash; r = (enc?0:(rounds-1)); kbs = (keysize+7)/8; - tb = malloc(HALFSIZEB+2+kbs); memcpy(tb+HALFSIZEB+2, key, kbs); /* copy key to temporary block */ tb[HALFSIZEB+0] = 0; /* set round counter high value to zero */ @@ -63,7 +62,6 @@ void shabea256(void * block, void * key, uint16_t keysize, uint8_t enc, uint8_t memxor(L, hash, HALFSIZE); } } - free(tb); }