Reverted changes to ntlm.c

This commit is contained in:
zsuper 2025-05-14 14:41:01 -07:00
parent 9db6e3b3d3
commit 882a22d80d

16
ntlm.c
View file

@ -28,7 +28,6 @@
#include "proxytunnel.h"
#include <ctype.h>
#include <sys/time.h>
#ifdef USE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#ifdef CYGWIN
#include <unistd.h>
@ -39,20 +38,17 @@
#include <openssl/md4.h>
#include <openssl/md5.h>
#endif
#endif /* USE_SSL */
#define TYPE1_DATA_SEG 8
#define TYPE2_BUF_SIZE 2048
#define DOMAIN_BUFLEN 256
#define LM2_DIGEST_LEN 24
#ifdef USE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
const EVP_MD *md4alg;
const EVP_MD *md5alg;
EVP_MD_CTX *mdctx;
#endif
#endif /* ifdef USE_SSL */
int ntlm_challenge = 0;
void message( char *s, ... );
@ -77,7 +73,6 @@ uint32_t flags;
unsigned char lm2digest[LM2_DIGEST_LEN];
void init_ntlm() {
#ifdef USE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
OSSL_PROVIDER *provider;
provider = OSSL_PROVIDER_load(NULL, "default");
@ -132,7 +127,6 @@ void init_ntlm() {
md5alg = EVP_md5();
mdctx = EVP_MD_CTX_new();
#endif
#endif /* ifdef USE_SSL */
}
void build_type1() {
@ -314,12 +308,10 @@ unsigned char* key; /* pointer to authentication key */
int key_len; /* length of authentication key */
unsigned char digest[16]; /* caller digest to be filled in */
{
#ifdef USE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#else
MD5_CTX context;
#endif
#endif /* ifdef USE_SSL */
unsigned char k_ipad[65]; /* inner padding - key XORd with ipad */
unsigned char k_opad[65]; /* outer padding - key XORd with opad */
unsigned char tk[16];
@ -327,7 +319,6 @@ unsigned char digest[16]; /* caller digest to be filled in */
/* if key is longer than 64 bytes reset it to key=MD5(key) */
if (key_len > 64) {
#ifdef USE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_DigestInit_ex(mdctx, md5alg, NULL);
EVP_DigestUpdate(mdctx, key, key_len);
@ -337,7 +328,6 @@ unsigned char digest[16]; /* caller digest to be filled in */
MD5_Update(&context, key, key_len);
MD5_Final(tk, &context);
#endif
#endif /* ifdef USE_SSL */
key = tk;
key_len = 16;
}
@ -366,7 +356,6 @@ unsigned char digest[16]; /* caller digest to be filled in */
}
/* perform inner MD5 */
#ifdef USE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_DigestInit_ex(mdctx, md5alg, NULL); /* init context for 1st pass */
EVP_DigestUpdate(mdctx, k_ipad, 64); /* start with inner pad */
@ -391,18 +380,15 @@ unsigned char digest[16]; /* caller digest to be filled in */
MD5_Update(&context, digest, 16); /* then results of 1st hash */
MD5_Final(digest, &context); /* finish up 2nd pass */
#endif
#endif /* ifdef USE_SSL */
}
void build_ntlm2_response() {
int i, j;
int passlen = 0;
#ifdef USE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#else
MD4_CTX passcontext;
#endif
#endif /* ifdef USE_SSL */
unsigned char passdigest[16];
unsigned char *userdom;
int userdomlen;
@ -427,7 +413,6 @@ void build_ntlm2_response() {
}
}
#ifdef USE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_DigestInit_ex(mdctx, md4alg, NULL);
EVP_DigestUpdate(mdctx, unipasswd, passlen);
@ -437,7 +422,6 @@ void build_ntlm2_response() {
MD4_Update (&passcontext, unipasswd, passlen);
MD4_Final (passdigest, &passcontext);
#endif
#endif /* ifdef USE_SSL */
if( args_info.verbose_flag ) {
message("NTLM: MD4 of password is: ");