X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=shabea.c;h=7acb4d3f9b9be78a2b2d80a5657e3208a2cba3e2;hb=f58eb2f22289048ea43fd8124b912d653d3c646e;hp=844788a00defbe64c5a08ae6fb1d5c624e83e9f2;hpb=639b9bea16571c3f3a901cefc4bca48f84b09705;p=avr-crypto-lib.git diff --git a/shabea.c b/shabea.c index 844788a..7acb4d3 100644 --- a/shabea.c +++ b/shabea.c @@ -2,7 +2,7 @@ * \file shabea.c * \author Daniel Otte * \date 2007-06-07 - * \brief SHABEA - a SHA Based Encrytion Algorithm implementation + * \brief SHABEA - a SHA Based Encryption Algorithm implementation * \par License * GPL * @@ -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); }