diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-11-05 12:30:23 +0200 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-11-06 19:23:02 +0200 |
commit | 5797ebc268b4e953cedd0c729c5cdb1f8fd764e4 (patch) | |
tree | 4ee1c020b639d4f7a3a6577e0ec4866e34e9c830 /cipher/cast5.c | |
parent | 9897ccb381503455edc490679b2e9251a09ac5cb (diff) | |
download | libgcrypt-5797ebc268b4e953cedd0c729c5cdb1f8fd764e4.tar.gz |
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 <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/cast5.c')
-rw-r--r-- | cipher/cast5.c | 7 |
1 files changed, 3 insertions, 4 deletions
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; } |