-/* $OpenBSD: chap.c,v 1.4 1996/12/23 13:22:39 mickey Exp $ */
+/* $OpenBSD: chap.c,v 1.5 1997/01/03 20:32:11 millert Exp $ */
/*
* chap.c - Challenge Handshake Authentication Protocol.
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: chap.c,v 1.4 1996/12/23 13:22:39 mickey Exp $";
+static char rcsid[] = "$OpenBSD: chap.c,v 1.5 1997/01/03 20:32:11 millert Exp $";
#endif
/*
#include <sys/types.h>
#include <sys/time.h>
#include <syslog.h>
+#include <md5.h>
#include "pppd.h"
#include "chap.h"
-#include "md5.h"
#ifdef CHAPMS
#include "chap_ms.h"
MD5Update(&mdContext, &cstate->resp_id, 1);
MD5Update(&mdContext, secret, secret_len);
MD5Update(&mdContext, rchallenge, rchallenge_len);
- MD5Final(&mdContext);
- BCOPY(mdContext.digest, cstate->response, MD5_SIGNATURE_SIZE);
+ MD5Final(cstate->response, &mdContext);
cstate->resp_length = MD5_SIGNATURE_SIZE;
break;
char rhostname[256];
MD5_CTX mdContext;
char secret[MAXSECRETLEN];
+ unsigned char digest[MD5_SIGNATURE_SIZE];
CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: Rcvd id %d.", id));
MD5Update(&mdContext, &cstate->chal_id, 1);
MD5Update(&mdContext, secret, secret_len);
MD5Update(&mdContext, cstate->challenge, cstate->chal_len);
- MD5Final(&mdContext);
+ MD5Final(digest, &mdContext);
/* compare local and remote MDs and send the appropriate status */
- if (memcmp (mdContext.digest, remmd, MD5_SIGNATURE_SIZE) == 0)
+ if (memcmp (digest, remmd, MD5_SIGNATURE_SIZE) == 0)
code = CHAP_SUCCESS; /* they are the same! */
break;