X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fchap_ms.c;fp=pppd%2Fchap_ms.c;h=704052feee98989a94ade7e5fc9774fe226991a4;hp=71942fed0833d88868c157976cce4f4405ef3641;hb=a25e52a87c3f5cbe2c2264f4e7c4c02439ac6717;hpb=3b87aa186a1a60709fe3884798b291e795776135 diff --git a/pppd/chap_ms.c b/pppd/chap_ms.c index 71942fe..704052f 100644 --- a/pppd/chap_ms.c +++ b/pppd/chap_ms.c @@ -99,6 +99,7 @@ #include "magic.h" #include "mppe.h" #include "ppp-crypto.h" +#include "pppcrypt.h" #ifdef UNIT_TEST #undef PPP_WITH_MPPE @@ -509,9 +510,6 @@ ChallengeResponse(u_char *challenge, { u_char ZPasswordHash[21]; PPP_CIPHER_CTX *ctx; - int outlen = 0; - int offset = 0; - int retval = 0; BZERO(ZPasswordHash, sizeof(ZPasswordHash)); BCOPY(PasswordHash, ZPasswordHash, MD4_DIGEST_LENGTH); @@ -521,38 +519,15 @@ ChallengeResponse(u_char *challenge, sizeof(ZPasswordHash), ZPasswordHash); #endif - ctx = PPP_CIPHER_CTX_new(); - if (ctx != NULL) { - - if (PPP_CipherInit(ctx, PPP_des_ecb(), ZPasswordHash + 0, NULL, 1)) { - - if (PPP_CipherUpdate(ctx, response + offset, &outlen, challenge, 8)) { - offset += outlen; - - PPP_CIPHER_CTX_set_cipher_data(ctx, ZPasswordHash + 7); - if (PPP_CipherUpdate(ctx, response + offset, &outlen, challenge, 8)) { - offset += outlen; - - PPP_CIPHER_CTX_set_cipher_data(ctx, ZPasswordHash + 14); - if (PPP_CipherUpdate(ctx, response + offset, &outlen, challenge, 8)) { - offset += outlen; - - if (PPP_CipherFinal(ctx, response + offset, &outlen)) { - - retval = 1; - } - } - } - } - } - - PPP_CIPHER_CTX_free(ctx); - } + if (DesEncrypt(challenge, ZPasswordHash + 0, response + 0) && + DesEncrypt(challenge, ZPasswordHash + 7, response + 8) && + DesEncrypt(challenge, ZPasswordHash + 14, response + 16)) + return 1; #if 0 dbglog("ChallengeResponse - response %.24B", response); #endif - return retval; + return 0; } void