30 #define NTLMSSP_NEGOTIATE_LM_KEY 0x00000080
34 int address_list_len,
char *challenge_data,
35 uint8_t *lm_response, uint8_t *nt_response,
36 uint8_t *session_key,
unsigned char *ntlmv2_hash)
39 address_list, address_list_len, lm_response,
40 nt_response, session_key);
45 uint8_t *nt_response, uint8_t *session_key,
46 char *challenge_data,
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);
70 hmac_md5 (user_session_key, session_nonce,
sizeof (session_nonce),
76 uint8_t *nt_response, uint8_t *session_key,
77 char *challenge_data,
unsigned char *nt_hash,
80 unsigned char lm_hash[16];
100 unsigned char *nt_hash, uint8_t *new_sess_key)
103 uint8 client_session_key[16];
105 (void) challenge_data;
108 sizeof (client_session_key));
111 size_t length =
sizeof (client_session_key);
112 uint8_t *encrypted_session_key = g_malloc0 (length);
114 memcpy (encrypted_session_key, client_session_key, length);
115 SamOEMhash (encrypted_session_key, session_key, length);
116 memcpy (new_sess_key, client_session_key, 16);
117 return encrypted_session_key;