diff options
Diffstat (limited to 'cipher/tiger.c')
-rw-r--r-- | cipher/tiger.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cipher/tiger.c b/cipher/tiger.c index adc23c85c..76fcbbdac 100644 --- a/cipher/tiger.c +++ b/cipher/tiger.c @@ -631,6 +631,19 @@ print_data( const char *text, u64 a, u64 b, u64 c, static void +burn_stack (int bytes) +{ + char buf[256]; + + memset (buf, 0, sizeof buf); + bytes -= sizeof buf; + if (bytes > 0) + burn_stack (bytes); +} + + + +static void tiger_init( TIGER_CONTEXT *hd ) { hd->a = 0x0123456789abcdefLL; @@ -768,6 +781,7 @@ tiger_write( TIGER_CONTEXT *hd, byte *inbuf, size_t inlen) { if( hd->count == 64 ) { /* flush the buffer */ transform( hd, hd->buf ); + burn_stack (21*8+11*sizeof(void*)); hd->count = 0; hd->nblocks++; } @@ -788,6 +802,7 @@ tiger_write( TIGER_CONTEXT *hd, byte *inbuf, size_t inlen) inlen -= 64; inbuf += 64; } + burn_stack (21*8+11*sizeof(void*)); for( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; } @@ -841,6 +856,7 @@ tiger_final( TIGER_CONTEXT *hd ) hd->buf[62] = msb >> 16; hd->buf[63] = msb >> 24; transform( hd, hd->buf ); + burn_stack (21*8+11*sizeof(void*)); p = hd->buf; #ifdef BIG_ENDIAN_HOST |