OpenVAS Scanner  7.0.1~git
md4.h File Reference

Unix SMB/CIFS implementation. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void mdfour_ntlmssp (unsigned char *out, const unsigned char *in, int n)
 

Detailed Description

Unix SMB/CIFS implementation.

A implementation of MD4 designed for use in the SMB authentication protocol

Definition in file md4.h.

Function Documentation

◆ mdfour_ntlmssp()

void mdfour_ntlmssp ( unsigned char *  out,
const unsigned char *  in,
int  n 
)

Definition at line 174 of file md4.c.

References A, B, C, copy4_ntlmssp(), copy64_ntlmssp(), D, mdfour64_ntlmssp(), and uint32.

Referenced by do_filehash_ntlmssp(), generate_random_buffer_ntlmssp(), and SMBsesskeygen_ntv1_ntlmssp().

175 {
176  unsigned char buf[128];
177  uint32 M[16];
178  uint32 b = n * 8;
179  int i;
180 
181  A = 0x67452301;
182  B = 0xefcdab89;
183  C = 0x98badcfe;
184  D = 0x10325476;
185 
186  while (n > 64)
187  {
188  copy64_ntlmssp (M, in);
189  mdfour64_ntlmssp (M);
190  in += 64;
191  n -= 64;
192  }
193 
194  for (i = 0; i < 128; i++)
195  buf[i] = 0;
196  memcpy (buf, in, n);
197  buf[n] = 0x80;
198 
199  if (n <= 55)
200  {
201  copy4_ntlmssp (buf + 56, b);
202  copy64_ntlmssp (M, buf);
203  mdfour64_ntlmssp (M);
204  }
205  else
206  {
207  copy4_ntlmssp (buf + 120, b);
208  copy64_ntlmssp (M, buf);
209  mdfour64_ntlmssp (M);
210  copy64_ntlmssp (M, buf + 64);
211  mdfour64_ntlmssp (M);
212  }
213 
214  for (i = 0; i < 128; i++)
215  buf[i] = 0;
216  copy64_ntlmssp (M, buf);
217 
218  copy4_ntlmssp (out, A);
219  copy4_ntlmssp (out + 4, B);
220  copy4_ntlmssp (out + 8, C);
221  copy4_ntlmssp (out + 12, D);
222 
223  A = B = C = D = 0;
224 }
static void copy4_ntlmssp(unsigned char *out, uint32 x)
Definition: md4.c:164
static uint32 C
Definition: md4.c:41
#define uint32
Definition: md4.c:33
static uint32 A
Definition: md4.c:41
static void copy64_ntlmssp(uint32 *M, const unsigned char *in)
Definition: md4.c:154
static uint32 D
Definition: md4.c:41
static void mdfour64_ntlmssp(uint32 *M)
Definition: md4.c:76
static uint32 B
Definition: md4.c:41
Here is the call graph for this function:
Here is the caller graph for this function: