OpenVPN
Macros | Functions
ntlm.c File Reference
#include "syshead.h"
#include "common.h"
#include "buffer.h"
#include "misc.h"
#include "socket.h"
#include "fdmisc.h"
#include "proxy.h"
#include "ntlm.h"
#include "base64.h"
#include "crypto.h"
#include "memdbg.h"
Include dependency graph for ntlm.c:

Go to the source code of this file.

Macros

#define UINTEGER64   unsigned long long
 
#define UINT64(c)   c ## LL
 

Functions

static void gen_md4_hash (const uint8_t *data, int data_len, uint8_t *result)
 
static void gen_hmac_md5 (const uint8_t *data, int data_len, const uint8_t *key, uint8_t *result)
 
static void gen_timestamp (uint8_t *timestamp)
 
static void gen_nonce (unsigned char *nonce)
 
static void my_strupr (char *str)
 
static int unicodize (char *dst, const char *src)
 This function expects a null-terminated string in src and will copy it (including the terminating NUL byte), alternating it with 0 to dst. More...
 
static void add_security_buffer (int sb_offset, void *data, int length, unsigned char *msg_buf, int *msg_bufpos, size_t msg_bufsize)
 
const char * ntlm_phase_1 (const struct http_proxy_info *p, struct gc_arena *gc)
 
const char * ntlm_phase_3 (const struct http_proxy_info *p, const char *phase_2, struct gc_arena *gc)
 

Macro Definition Documentation

◆ UINT64

#define UINT64 (   c)    c ## LL

Definition at line 52 of file ntlm.c.

◆ UINTEGER64

#define UINTEGER64   unsigned long long

Definition at line 51 of file ntlm.c.

Function Documentation

◆ add_security_buffer()

static void add_security_buffer ( int  sb_offset,
void *  data,
int  length,
unsigned char *  msg_buf,
int *  msg_bufpos,
size_t  msg_bufsize 
)
static

Definition at line 156 of file ntlm.c.

References M_WARN, and msg.

Referenced by ntlm_phase_3().

◆ gen_hmac_md5()

static void gen_hmac_md5 ( const uint8_t *  data,
int  data_len,
const uint8_t *  key,
uint8_t *  result 
)
static

◆ gen_md4_hash()

static void gen_md4_hash ( const uint8_t *  data,
int  data_len,
uint8_t *  result 
)
static

Definition at line 58 of file ntlm.c.

References MD4_DIGEST_LENGTH, and md_full().

Referenced by ntlm_phase_3().

◆ gen_nonce()

static void gen_nonce ( unsigned char *  nonce)
static

Definition at line 105 of file ntlm.c.

References get_random().

Referenced by ntlm_phase_3().

◆ gen_timestamp()

static void gen_timestamp ( uint8_t *  timestamp)
static

Definition at line 81 of file ntlm.c.

References openvpn_time(), UINT64, and UINTEGER64.

Referenced by ntlm_phase_3().

◆ my_strupr()

static void my_strupr ( char *  str)
static

Definition at line 117 of file ntlm.c.

Referenced by ntlm_phase_3().

◆ ntlm_phase_1()

const char* ntlm_phase_1 ( const struct http_proxy_info p,
struct gc_arena gc 
)

Definition at line 175 of file ntlm.c.

References alloc_buf_gc(), BSTR, and buf_printf().

Referenced by establish_http_proxy_passthru().

◆ ntlm_phase_3()

const char* ntlm_phase_3 ( const struct http_proxy_info p,
const char *  phase_2,
struct gc_arena gc 
)

◆ unicodize()

static int unicodize ( char *  dst,
const char *  src 
)
static

This function expects a null-terminated string in src and will copy it (including the terminating NUL byte), alternating it with 0 to dst.

This basically will transform a ASCII string into valid UTF-16. Characters that are 8bit in src, will get the same treatment, resulting in invalid or wrong unicode code points.

Note
the function will blindly assume that dst has double the space of src.
Returns
the length of the number of bytes written to dst

Definition at line 142 of file ntlm.c.

Referenced by ntlm_phase_3().