35 #define NTLMSSP_NEGOTIATE_LM_KEY 0x00000080 37 void ntlmssp_genauth_ntlmv2(
char* user,
char *domain,
char* address_list,
int address_list_len,
char *challenge_data, uint8_t *lm_response,
38 uint8_t *nt_response, uint8_t* session_key,
unsigned char* ntlmv2_hash)
40 SMBNTLMv2encrypt_hash_ntlmssp(user, domain, ntlmv2_hash, challenge_data, address_list, address_list_len, lm_response, nt_response, session_key);
44 uint8_t *lm_response, uint8_t *nt_response,
45 uint8_t *session_key,
char *challenge_data,
46 unsigned char* nt_hash)
48 unsigned char lm_hash[16];
53 uchar session_nonce_hash[16];
54 uchar session_nonce[16];
55 uchar user_session_key[16];
58 memset(lm_response+8, 0, 16);
60 memcpy(session_nonce, challenge_data, 8);
61 memcpy(&session_nonce[8], lm_response, 8);
63 MD5Init(&md5_session_nonce_ctx);
64 MD5Update(&md5_session_nonce_ctx, (
unsigned char const*)challenge_data, 8);
65 MD5Update(&md5_session_nonce_ctx, (
unsigned char const*)lm_response, 8);
66 MD5Final(session_nonce_hash, &md5_session_nonce_ctx);
72 hmac_md5(user_session_key, session_nonce,
sizeof(session_nonce), session_key);
77 uint8_t *lm_response, uint8_t *nt_response,
78 uint8_t *session_key,
char *challenge_data,
79 unsigned char* nt_hash,
int neg_flags)
81 unsigned char lm_hash[16];
98 uint8 client_session_key[16];
103 size_t length =
sizeof(client_session_key);
104 uint8_t * encrypted_session_key = g_malloc0 (length);
106 memcpy(encrypted_session_key, client_session_key, length);
107 SamOEMhash(encrypted_session_key, session_key, length);
108 memcpy(new_sess_key, client_session_key, 16);
109 return encrypted_session_key;
uint8_t * ntlmssp_genauth_keyexchg(uint8_t *session_key, char *challenge_data, unsigned char *nt_hash, uint8_t *new_sess_key)
void SamOEMhash(uchar *data, const uchar *key, int val)
bool E_deshash_ntlmssp(const char *passwd, uint8_t pass_len, uchar p16[16])
void SMBNTLMv2encrypt_hash_ntlmssp(const char *user, const char *domain, uchar ntlm_v2_hash[16], const char *server_chal, const char *address_list, int address_list_len, uint8_t *lm_response, uint8_t *nt_response, uint8_t *user_session_key)
void generate_random_buffer_ntlmssp(unsigned char *out, int len)
void SMBencrypt_hash_ntlmssp(const uchar lm_hash[16], const uchar *c8, uchar p24[24])
void ntlmssp_genauth_ntlm2(char *password, uint8_t pass_len, uint8_t *lm_response, uint8_t *nt_response, uint8_t *session_key, char *challenge_data, unsigned char *nt_hash)
#define NTLMSSP_NEGOTIATE_LM_KEY
void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
void MD5Init(struct MD5Context *ctx)
void hmac_md5(uchar key[16], uchar *data, int data_len, uchar *digest)
Function to calculate an HMAC MD5 digest from data. Use the microsoft hmacmd5 init method because the...
void ntlmssp_genauth_ntlm(char *password, uint8_t pass_len, uint8_t *lm_response, uint8_t *nt_response, uint8_t *session_key, char *challenge_data, unsigned char *nt_hash, int neg_flags)
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
void ntlmssp_genauth_ntlmv2(char *user, char *domain, char *address_list, int address_list_len, char *challenge_data, uint8_t *lm_response, uint8_t *nt_response, uint8_t *session_key, unsigned char *ntlmv2_hash)
void SMBsesskeygen_ntv1_ntlmssp(const uchar kr[16], const uchar *nt_resp, uint8 sess_key[16])
void SMBsesskeygen_lm_sess_key_ntlmssp(const uchar lm_hash[16], const uchar lm_resp[24], uint8 sess_key[16])
void SMBNTencrypt_hash_ntlmssp(const uchar nt_hash[16], uchar *c8, uchar *p24)