X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fhmac-md5.c;h=816762b7982c229b2a39d73e728e14d62415159b;hb=718b0598a7e9f5e9bdf3efc7e91e69a78e465327;hp=ecd071496049b0e23d75b83712aa80cf00ac92c9;hpb=11ad180881e62f7d8758936af419c2cc88e9cf79;p=gnulib.git diff --git a/lib/hmac-md5.c b/lib/hmac-md5.c index ecd071496..816762b79 100644 --- a/lib/hmac-md5.c +++ b/lib/hmac-md5.c @@ -41,6 +41,8 @@ hmac_md5 (const void *key, size_t keylen, char block[64]; char innerhash[16]; + /* Reduce the key's size, so that it becomes <= 64 bytes large. */ + if (keylen > 64) { struct md5_ctx keyhash; @@ -53,6 +55,8 @@ hmac_md5 (const void *key, size_t keylen, keylen = 16; } + /* Compute INNERHASH from KEY and IN. */ + md5_init_ctx (&inner); memset (block, IPAD, sizeof (block)); @@ -63,6 +67,8 @@ hmac_md5 (const void *key, size_t keylen, md5_finish_ctx (&inner, innerhash); + /* Compute result from KEY and INNERHASH. */ + md5_init_ctx (&outer); memset (block, OPAD, sizeof (block));