From 2bb31556caad644db0ce6d1c7dd55fcbca174e0e Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sun, 25 May 2014 00:08:10 -0700 Subject: Fixing a few warnings and errors. --- lcrypt/lcrypt_hashes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lcrypt/lcrypt_hashes.c') diff --git a/lcrypt/lcrypt_hashes.c b/lcrypt/lcrypt_hashes.c index 4eccbfc..46edf28 100644 --- a/lcrypt/lcrypt_hashes.c +++ b/lcrypt/lcrypt_hashes.c @@ -21,7 +21,7 @@ static int lcrypt_hash_done(lua_State *L) lcrypt_hash *h = luaL_checkudata(L, 1, "LCRYPT_HASH_STATE"); if(likely(h->hash >= 0)) { - unsigned char out[hash_descriptor[h->hash].hashsize]; + unsigned char * out = (unsigned char *)alloca(hash_descriptor[h->hash].hashsize); lcrypt_error(L, hash_descriptor[h->hash].done(&h->state, out), NULL); lua_pushlstring(L, (char*)out, hash_descriptor[h->hash].hashsize); } @@ -35,7 +35,7 @@ static int lcrypt_hash_state_gc(lua_State *L) lcrypt_hash *h = luaL_checkudata(L, 1, "LCRYPT_HASH_STATE"); if(likely(h->hash >= 0)) { - unsigned char out[hash_descriptor[h->hash].hashsize]; + unsigned char * out = (unsigned char *)alloca(hash_descriptor[h->hash].hashsize); lcrypt_error(L, hash_descriptor[h->hash].done(&h->state, out), NULL); memset(h, 0, sizeof(lcrypt_hash)); h->hash = -1; @@ -96,7 +96,7 @@ static int lcrypt_hmac_done(lua_State *L) if(likely(h->hash >= 0)) { unsigned long out_length = hash_descriptor[h->hash].hashsize; - unsigned char out[out_length]; + unsigned char * out = (unsigned char *)alloca(out_length); lcrypt_error(L, hmac_done(h, out, &out_length), NULL); lua_pushlstring(L, (char*)out, out_length); memset(h, 0, sizeof(hmac_state)); @@ -112,7 +112,7 @@ static int lcrypt_hmac_state_gc(lua_State *L) if(likely(h->hash >= 0)) { unsigned long out_length = hash_descriptor[h->hash].hashsize; - unsigned char out[out_length]; + unsigned char * out = (unsigned char *)alloca(out_length); lcrypt_error(L, hmac_done(h, out, &out_length), NULL); memset(h, 0, sizeof(hmac_state)); h->hash = -1; -- cgit v1.2.3