NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions | Variables
challenge.c File Reference
#include <config.h>
#include <ctype.h>
#include <freetds/time.h>
#include <freetds/tds.h>
#include <freetds/bytes.h>
#include <freetds/utils/string.h>
#include <freetds/iconv.h>
#include <freetds/utils.h>
#include <freetds/utils/md4.h>
#include <freetds/utils/md5.h>
#include <freetds/utils/hmac_md5.h>
#include <freetds/utils/des.h>
#include <freetds/replacements.h>
+ Include dependency graph for challenge.c:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  tds_answer
 
struct  names_blob_prefix_t
 
struct  tds_ntlm_auth
 

Macros

#define MAX_PW_SZ   14
 
#define TIME_FIXUP_CONSTANT   (((uint64_t) 134774U) * 86400U)
 

Typedefs

typedef struct tds_answer TDSANSWER
 
typedef struct tds_ntlm_auth TDSNTLMAUTH
 

Functions

static TDSRET tds_answer_challenge (TDSSOCKET *tds, TDSLOGIN *login, const unsigned char *challenge, uint32_t *flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response)
 Crypt a given password using schema required for NTLMv1 or NTLM2 authentication. More...
 
static void tds_encrypt_answer (const unsigned char *hash, const unsigned char *challenge, unsigned char *answer)
 
static void tds_convert_key (const unsigned char *key_56, DES_KEY *ks)
 
static void convert_to_upper (char *buf, size_t len)
 
static size_t convert_to_usc2le_string (TDSSOCKET *tds, const char *s, size_t len, char *out)
 
static TDSRET make_ntlm_hash (TDSSOCKET *tds, const char *passwd, unsigned char ntlm_hash[16])
 
static TDSRET make_ntlm_v2_hash (TDSSOCKET *tds, const char *passwd, unsigned char ntlm_v2_hash[16])
 
static unsigned char * make_lm_v2_response (const unsigned char ntlm_v2_hash[16], const unsigned char *client_data, int client_data_len, const unsigned char challenge[8])
 
static TDSRET tds_answer_challenge_ntlmv2 (TDSSOCKET *tds, TDSLOGIN *login, const unsigned char *challenge, uint32_t *flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response)
 
static TDSRET tds7_send_auth (TDSSOCKET *tds, const unsigned char *challenge, uint32_t flags, const unsigned char *names_blob, int names_blob_len)
 
static TDSRET tds_ntlm_free (TDSCONNECTION *conn, TDSAUTHENTICATION *tds_auth)
 
static void unix_to_nt_time (uint64_t *nt, struct timeval *tv)
 put a 8 byte filetime from a time_t This takes GMT as input More...
 
static void fill_names_blob_prefix (names_blob_prefix_t *prefix)
 
static TDSRET tds_ntlm_handle_next (TDSSOCKET *tds, struct tds_authentication *auth, size_t len)
 
TDSAUTHENTICATIONtds_ntlm_get_auth (TDSSOCKET *tds)
 Build a NTLMSPP packet to send to server. More...
 

Variables

static const unsigned char ntlm_id [] = "NTLMSSP"
 

Macro Definition Documentation

◆ MAX_PW_SZ

#define MAX_PW_SZ   14

◆ TIME_FIXUP_CONSTANT

#define TIME_FIXUP_CONSTANT   (((uint64_t) 134774U) * 86400U)

Function Documentation

◆ convert_to_upper()

static void convert_to_upper ( char *  buf,
size_t  len 
)
static

Definition at line 94 of file challenge.c.

References buf, i, len, and toupper().

Referenced by make_ntlm_v2_hash().

◆ convert_to_usc2le_string()

static size_t convert_to_usc2le_string ( TDSSOCKET tds,
const char *  s,
size_t  len,
char *  out 
)
static

◆ fill_names_blob_prefix()

static void fill_names_blob_prefix ( names_blob_prefix_t prefix)
static

◆ make_ntlm_hash()

static TDSRET make_ntlm_hash ( TDSSOCKET tds,
const char *  passwd,
unsigned char  ntlm_hash[16] 
)
static

◆ make_ntlm_v2_hash()

static TDSRET make_ntlm_v2_hash ( TDSSOCKET tds,
const char *  passwd,
unsigned char  ntlm_v2_hash[16] 
)
static

◆ tds_convert_key()

static void tds_convert_key ( const unsigned char *  key_56,
DES_KEY ks 
)
static

◆ tds_encrypt_answer()

static void tds_encrypt_answer ( const unsigned char *  hash,
const unsigned char *  challenge,
unsigned char *  answer 
)
static

Definition at line 378 of file challenge.c.

References tds_convert_key(), and tds_des_ecb_encrypt.

Referenced by tds_answer_challenge().

◆ tds_ntlm_free()

static TDSRET tds_ntlm_free ( TDSCONNECTION conn,
TDSAUTHENTICATION tds_auth 
)
static

Definition at line 574 of file challenge.c.

References free(), tds_authentication::packet, tds_ntlm_auth::tds_auth, and TDS_SUCCESS.

Referenced by tds_ntlm_get_auth().

◆ tds_ntlm_handle_next()

static TDSRET tds_ntlm_handle_next ( TDSSOCKET tds,
struct tds_authentication auth,
size_t  len 
)
static
Modified on Wed Sep 04 14:58:53 2024 by modify_doxy.py rev. 669887