From 5797ebc268b4e953cedd0c729c5cdb1f8fd764e4 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Tue, 5 Nov 2013 12:30:23 +0200 Subject: Avoid burn_stack in CAST5 setkey * cipher/cast5.c (do_cast_setkey): Use wipememory instead of memset. (cast_setkey): Remove stack burning. -- Burning stack does not work properly when compiler inlines static functions, therefore use wipememory to clear stack after use instead of relying on _gcry_burn_stack. Signed-off-by: Jussi Kivilinna --- cipher/cast5.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'cipher/cast5.c') diff --git a/cipher/cast5.c b/cipher/cast5.c index 8d141831..09c96912 100644 --- a/cipher/cast5.c +++ b/cipher/cast5.c @@ -962,9 +962,9 @@ do_cast_setkey( CAST5_context *c, const byte *key, unsigned keylen ) } #endif - memset(&x,0, sizeof x); - memset(&z,0, sizeof z); - memset(&k,0, sizeof k); + wipememory(x, sizeof x); + wipememory(z, sizeof z); + wipememory(k, sizeof k); #undef xi #undef zi @@ -976,7 +976,6 @@ cast_setkey (void *context, const byte *key, unsigned keylen ) { CAST5_context *c = (CAST5_context *) context; gcry_err_code_t rc = do_cast_setkey (c, key, keylen); - _gcry_burn_stack (96+7*sizeof(void*)); return rc; } -- cgit v1.2.1