summaryrefslogtreecommitdiff
path: root/cipher/md5.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2001-08-03 10:57:34 +0000
committerWerner Koch <wk@gnupg.org>2001-08-03 10:57:34 +0000
commit0c667cbdebcd34dfa556b6b8d786b0677f09f5a5 (patch)
treed31d08dfe51104bc4e26c6c69b87c8dd4b545047 /cipher/md5.c
parent442e7215fb0b7455d31587bd6ad9ccb5d5a64dd7 (diff)
downloadlibgcrypt-0c667cbdebcd34dfa556b6b8d786b0677f09f5a5.tar.gz
Applied changes from GnuPG stable.
Add a first tes program
Diffstat (limited to 'cipher/md5.c')
-rw-r--r--cipher/md5.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cipher/md5.c b/cipher/md5.c
index 60b12270..62584305 100644
--- a/cipher/md5.c
+++ b/cipher/md5.c
@@ -60,6 +60,16 @@ md5_init( MD5_CONTEXT *ctx )
ctx->count = 0;
}
+static void
+burn_stack (int bytes)
+{
+ char buf[128];
+
+ memset (buf, 0, sizeof buf);
+ bytes -= sizeof buf;
+ if (bytes > 0)
+ burn_stack (bytes);
+}
@@ -217,6 +227,7 @@ md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen)
{
if( hd->count == 64 ) { /* flush the buffer */
transform( hd, hd->buf );
+ burn_stack (80+6*sizeof(void*));
hd->count = 0;
hd->nblocks++;
}
@@ -229,6 +240,7 @@ md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen)
if( !inlen )
return;
}
+ burn_stack (80+6*sizeof(void*));
while( inlen >= 64 ) {
transform( hd, inbuf );
@@ -294,6 +306,7 @@ md5_final( MD5_CONTEXT *hd )
hd->buf[62] = msb >> 16;
hd->buf[63] = msb >> 24;
transform( hd, hd->buf );
+ burn_stack (80+6*sizeof(void*));
p = hd->buf;
#ifdef BIG_ENDIAN_HOST