]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/chap_ms.c
config: Include some extra files in the tarball
[ppp.git] / pppd / chap_ms.c
index c34b6aa5c7199bab245b0009e5148ea9770c8393..6c8ef9196188c025e3e59c4db8ba1dbfc6234ea7 100644 (file)
@@ -74,8 +74,6 @@
  *
  */
 
-#define RCSID  "$Id: chap_ms.c,v 1.38 2007/12/01 20:10:51 carlsonj Exp $"
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -509,7 +507,7 @@ ChallengeResponse(u_char *challenge,
                  u_char *PasswordHash,
                  u_char *response)
 {
-    u_char ZPasswordHash[21];
+    u_char ZPasswordHash[24];
     PPP_CIPHER_CTX *ctx;
 
     BZERO(ZPasswordHash, sizeof(ZPasswordHash));
@@ -654,11 +652,12 @@ ChapMS_LANMan(u_char *rchallenge, char *secret, int secret_len,
     BZERO(UcasePassword, sizeof(UcasePassword));
     for (i = 0; i < secret_len; i++)
        UcasePassword[i] = (u_char)toupper(secret[i]);
-    (void) DesSetkey(UcasePassword + 0);
-    DesEncrypt( StdText, PasswordHash + 0 );
-    (void) DesSetkey(UcasePassword + 7);
-    DesEncrypt( StdText, PasswordHash + 8 );
-    ChallengeResponse(rchallenge, PasswordHash, &response[MS_CHAP_LANMANRESP]);
+
+    if (DesEncrypt(StdText, UcasePassword + 0, PasswordHash + 0) &&
+        DesEncrypt(StdText, UcasePassword + 7, PasswordHash + 8)) {
+
+        ChallengeResponse(rchallenge, PasswordHash, &response[MS_CHAP_LANMANRESP]);
+    }
 }
 #endif
 
@@ -686,7 +685,7 @@ GenerateAuthenticatorResponse(unsigned char* PasswordHashHash,
 
     int                i;
     PPP_MD_CTX *ctx;
-    u_char     Digest[SHA_DIGEST_LENGTH];
+    u_char     Digest[SHA_DIGEST_LENGTH] = {};
     int     hash_len;
     u_char     Challenge[8];