/* Generate a challenge response, given an eight byte challenge and either the NT or the Lan Manager password hash (16 bytes). Returns output in response, which is expected to be 24 bytes.  */
static int ntlmssp_generate_challenge_response(guint8 *response, const guint8 *passhash, const guint8 *challenge)
/* Generate a challenge response, given an eight byte challenge and either the NT or the Lan Manager password hash (16 bytes). Returns output in response, which is expected to be 24 bytes.  */
static int ntlmssp_generate_challenge_response(guint8 *response, const guint8 *passhash, const guint8 *challenge)
{
  guint8 pw21[21];
  memset(pw21, 0x0, sizeof(pw21));
  memcpy(pw21, passhash, 16);
  memset(response, 0, 24);
  crypt_des_ecb(response, challenge, pw21, 1);
  crypt_des_ecb(response + 8, challenge, pw21 + 7, 1);
  crypt_des_ecb(response + 16, challenge, pw21 + 14, 1);
  return 1;
}