From 2fd71f07579daa862d498e85b9cd6ebb95dbd7df Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Sat, 11 Jul 2009 20:40:58 +0000 Subject: [PATCH] - Fixed HMAC-MD2 by modifying md2_starts(), so that the required HMAC ipad and opad variables are not cleared! --- ChangeLog | 2 ++ library/md2.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 936860a36..ba5ad1374 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ Features and X509parse. Bug fixes + * Fixed HMAC-MD2 by modifying md2_starts(), so that the + required HMAC ipad and opad variables are not cleared! * Prevented use of long long in bignum if POLARSSL_HAVE_LONGLONG not defined (found by Giles Bathgate). diff --git a/library/md2.c b/library/md2.c index 7bd5769cb..f6dd3496a 100644 --- a/library/md2.c +++ b/library/md2.c @@ -70,7 +70,10 @@ static const unsigned char PI_SUBST[256] = */ void md2_starts( md2_context *ctx ) { - memset( ctx, 0, sizeof( md2_context ) ); + memset( ctx->cksum, 0, 16 ); + memset( ctx->state, 0, 46 ); + memset( ctx->buffer, 0, 16 ); + ctx->left = 0; } static void md2_process( md2_context *ctx )