Update for the newer version of the md5 interface.

This commit is contained in:
christos 1997-04-18 13:53:26 +00:00
parent 19c64a2a37
commit 756fea70b3
3 changed files with 9 additions and 6 deletions

View File

@ -74,6 +74,7 @@ MD5auth2crypt(keyno, pkt, length)
u_int32 *pkt;
int length; /* total length of encrypted area */
{
u_char hash[16];
/*
* Don't bother checking the keys. The first stage would have
* handled that. Finish up the generation by also including the
@ -81,10 +82,10 @@ MD5auth2crypt(keyno, pkt, length)
*/
MD5Update(&ctx, (unsigned const char *)(pkt) + length - 8, 8);
MD5Final(&ctx);
MD5Final(hash, &ctx);
memmove((char *) &pkt[NOCRYPT_int32S + length/sizeof(u_int32)],
(char *) ctx.digest,
(char *) hash,
BLOCK_OCTETS);
return (4 + BLOCK_OCTETS);
}

View File

@ -39,6 +39,7 @@ MD5authdecrypt(keyno, pkt, length)
int length; /* length of variable data in octets */
{
MD5_CTX ctx;
char hash[16];
authdecryptions++;
@ -51,9 +52,9 @@ MD5authdecrypt(keyno, pkt, length)
MD5Init(&ctx);
MD5Update(&ctx, (unsigned const char *)cache_key, cache_keylen);
MD5Update(&ctx, (unsigned const char *)pkt, length);
MD5Final(&ctx);
MD5Final(hash, &ctx);
return (!memcmp((char *)ctx.digest,
return (!memcmp((char *) hash,
(char *)pkt + length + 4,
BLOCK_OCTETS));
}

View File

@ -44,6 +44,7 @@ MD5authencrypt(keyno, pkt, length)
int length; /* length of encrypted portion of packet */
{
MD5_CTX ctx;
u_char hash[16];
int len; /* in 4 byte quantities */
authencryptions++;
@ -64,10 +65,10 @@ MD5authencrypt(keyno, pkt, length)
MD5Init(&ctx);
MD5Update(&ctx, (unsigned const char *)cache_key, cache_keylen);
MD5Update(&ctx, (unsigned const char *)pkt, length);
MD5Final(&ctx);
MD5Final(hash, &ctx);
memmove((char *)&pkt[NOCRYPT_int32S + len],
(char *)ctx.digest,
(char *) hash,
BLOCK_OCTETS);
return (4 + BLOCK_OCTETS); /* return size of key and MAC */
}