32#ifndef HAVE_UCBINCLUDE
36#include "/usr/ucbinclude/fcntl.h"
40#define uint32 uint32_t
43typedef unsigned int bool;
56#define ZERO_STRUCT(x) memset ((char *) &(x), 0, sizeof (x))
86 unsigned char buf[1011];
87 unsigned char tmp_md4[16];
90 fd = open (fname, O_RDONLY, 0);
94 while ((n = read (fd, (
char *) buf,
sizeof (buf))) > 0)
97 for (n = 0; n < 16; n++)
98 the_hash[n] ^= tmp_md4[n];
118 unsigned char seed_inbuf[40];
128 fd = open (
"/dev/urandom", O_RDONLY, 0);
134 memset (seed_inbuf,
'\0',
sizeof (seed_inbuf));
145 SIVAL (seed_inbuf, 32, v1 ^
IVAL (seed_inbuf, 32));
146 SIVAL (seed_inbuf, 36, v2 ^
IVAL (seed_inbuf, 36));
156 for (i = 0; i <
sizeof (seed_inbuf); i++)
157 seed_inbuf[i] ^= ((
char *) (&reseed_data))[i %
sizeof (reseed_data)];
172 static int urand_fd = -1;
173 unsigned char md4_buf[64];
174 unsigned char tmp_buf[16];
183 if (urand_fd != -1 &&
len > 0)
185 if (read (urand_fd, out,
len) ==
len)
205 int copy_len =
len > 16 ? 16 :
len;
207 bzero (md4_buf,
sizeof (md4_buf));
210 memcpy (p, tmp_buf, copy_len);
void smb_arc4_crypt_ntlmssp(unsigned char arc4_state_inout[258], unsigned char *data, size_t len)
void smb_arc4_init_ntlmssp(unsigned char arc4_state_out[258], const unsigned char *key, size_t keylen)
Unix SMB/CIFS implementation. SMB Byte handling.
#define SIVAL(buf, pos, val)
static void get_rand_reseed_data_ntlmssp(int *reseed_data)
void generate_random_buffer_ntlmssp(unsigned char *out, int len)
static int do_reseed_ntlmssp(bool use_fd, int fd)
static unsigned char smb_arc4_state[258]
static void do_filehash_ntlmssp(const char *fname, unsigned char *the_hash)
static void(* reseed_callback_ntlmssp)(int *newseed)
static bool done_reseed_ntlmssp
void mdfour_ntlmssp(unsigned char *out, const unsigned char *in, int n)
Unix SMB/CIFS implementation.
static struct timeval timeval(unsigned long val)
void GetTimeOfDay_ntlmssp(struct timeval *tval)
Unix SMB/CIFS implementation.