1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

r961: convert 'uchar' to 'uint8_t'

metze
This commit is contained in:
Stefan Metzmacher
2004-06-01 08:30:34 +00:00
committed by Gerald (Jerry) Carter
parent 18062d2ed9
commit 9f914e4af9
24 changed files with 186 additions and 192 deletions

View File

@ -75,7 +75,7 @@ static const uint8_t *get_ntlm_challenge(struct auth_context *auth_context)
} }
if (!challenge_set_by) { if (!challenge_set_by) {
uchar chal[8]; uint8_t chal[8];
generate_random_buffer(chal, sizeof(chal), False); generate_random_buffer(chal, sizeof(chal), False);
auth_context->challenge = data_blob_talloc(auth_context->mem_ctx, auth_context->challenge = data_blob_talloc(auth_context->mem_ctx,
@ -381,7 +381,7 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context)
Make a auth_info struct with a fixed challenge Make a auth_info struct with a fixed challenge
***************************************************************************/ ***************************************************************************/
NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uchar chal[8]) NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uint8_t chal[8])
{ {
NTSTATUS nt_status; NTSTATUS nt_status;
if (!NT_STATUS_IS_OK(nt_status = make_auth_context_subsystem(auth_context))) { if (!NT_STATUS_IS_OK(nt_status = make_auth_context_subsystem(auth_context))) {

View File

@ -290,7 +290,7 @@ static NTSTATUS find_connect_dc(struct cli_state **cli,
static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx, static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
const auth_usersupplied_info *user_info, const auth_usersupplied_info *user_info,
const char *domain, const char *domain,
uchar chal[8], uint8_t chal[8],
auth_serversupplied_info **server_info, auth_serversupplied_info **server_info,
const char *server, const char *setup_creds_as, const char *server, const char *setup_creds_as,
uint16_t sec_chan, uint16_t sec_chan,
@ -447,7 +447,7 @@ static NTSTATUS check_ntdomain_security(const struct auth_context *auth_context,
password_server = lp_passwordserver(); password_server = lp_passwordserver();
nt_status = domain_client_validate(mem_ctx, user_info, domain, nt_status = domain_client_validate(mem_ctx, user_info, domain,
(uchar *)auth_context->challenge.data, (uint8_t *)auth_context->challenge.data,
server_info, server_info,
password_server, lp_netbios_name(), SEC_CHAN_WKSTA, trust_passwd, last_change_time); password_server, lp_netbios_name(), SEC_CHAN_WKSTA, trust_passwd, last_change_time);
return nt_status; return nt_status;
@ -534,7 +534,7 @@ static NTSTATUS check_trustdomain_security(const struct auth_context *auth_conte
#endif #endif
nt_status = domain_client_validate(mem_ctx, user_info, user_info->domain.str, nt_status = domain_client_validate(mem_ctx, user_info, user_info->domain.str,
(uchar *)auth_context->challenge.data, (uint8_t *)auth_context->challenge.data,
server_info, "*" /* Do a lookup */, server_info, "*" /* Do a lookup */,
lp_workgroup(), SEC_CHAN_DOMAIN, trust_md4_password, last_change_time); lp_workgroup(), SEC_CHAN_DOMAIN, trust_md4_password, last_change_time);

View File

@ -161,8 +161,8 @@ BOOL make_user_info_netlogon_network(auth_usersupplied_info **user_info,
const char *smb_name, const char *smb_name,
const char *client_domain, const char *client_domain,
const char *wksta_name, const char *wksta_name,
const uchar *lm_network_pwd, int lm_pwd_len, const uint8_t *lm_network_pwd, int lm_pwd_len,
const uchar *nt_network_pwd, int nt_pwd_len) const uint8_t *nt_network_pwd, int nt_pwd_len)
{ {
BOOL ret; BOOL ret;
NTSTATUS nt_status; NTSTATUS nt_status;
@ -193,10 +193,10 @@ BOOL make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
const char *smb_name, const char *smb_name,
const char *client_domain, const char *client_domain,
const char *wksta_name, const char *wksta_name,
const uchar chal[8], const uint8_t chal[8],
const uchar lm_interactive_pwd[16], const uint8_t lm_interactive_pwd[16],
const uchar nt_interactive_pwd[16], const uint8_t nt_interactive_pwd[16],
const uchar *dc_sess_key) const uint8_t *dc_sess_key)
{ {
char lm_pwd[16]; char lm_pwd[16];
char nt_pwd[16]; char nt_pwd[16];
@ -222,10 +222,10 @@ BOOL make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
#endif #endif
if (lm_interactive_pwd) if (lm_interactive_pwd)
SamOEMhash((uchar *)lm_pwd, key, sizeof(lm_pwd)); SamOEMhash((uint8_t *)lm_pwd, key, sizeof(lm_pwd));
if (nt_interactive_pwd) if (nt_interactive_pwd)
SamOEMhash((uchar *)nt_pwd, key, sizeof(nt_pwd)); SamOEMhash((uint8_t *)nt_pwd, key, sizeof(nt_pwd));
#ifdef DEBUG_PASSWORD #ifdef DEBUG_PASSWORD
DEBUG(100,("decrypt of lm owf password:")); DEBUG(100,("decrypt of lm owf password:"));
@ -314,7 +314,7 @@ BOOL make_user_info_for_reply(auth_usersupplied_info **user_info,
dump_data(100, plaintext_password.data, plaintext_password.length); dump_data(100, plaintext_password.data, plaintext_password.length);
#endif #endif
SMBencrypt( (const char *)plaintext_password.data, (const uchar*)chal, local_lm_response); SMBencrypt( (const char *)plaintext_password.data, (const uint8_t *)chal, local_lm_response);
local_lm_blob = data_blob(local_lm_response, 24); local_lm_blob = data_blob(local_lm_response, 24);
/* We can't do an NT hash here, as the password needs to be /* We can't do an NT hash here, as the password needs to be

View File

@ -24,8 +24,8 @@
typedef struct typedef struct
{ {
struct MD5Context ctx; struct MD5Context ctx;
uchar k_ipad[65]; uint8_t k_ipad[65];
uchar k_opad[65]; uint8_t k_opad[65];
} HMACMD5Context; } HMACMD5Context;

View File

@ -432,10 +432,6 @@ typedef int socklen_t;
#endif #endif
#ifndef uchar
#define uchar unsigned char
#endif
/* /*
Samba needs type definitions for Samba needs type definitions for
int8_t, int16_t, int32_t, int64_t int8_t, int16_t, int32_t, int64_t

View File

@ -28,14 +28,14 @@
/*********************************************************************** /***********************************************************************
the rfc 2104 version of hmac_md5 initialisation. the rfc 2104 version of hmac_md5 initialisation.
***********************************************************************/ ***********************************************************************/
void hmac_md5_init_rfc2104(uchar* key, int key_len, HMACMD5Context *ctx) void hmac_md5_init_rfc2104(uint8_t *key, int key_len, HMACMD5Context *ctx)
{ {
int i; int i;
/* if key is longer than 64 bytes reset it to key=MD5(key) */ /* if key is longer than 64 bytes reset it to key=MD5(key) */
if (key_len > 64) if (key_len > 64)
{ {
uchar tk[16]; uint8_t tk[16];
struct MD5Context tctx; struct MD5Context tctx;
MD5Init(&tctx); MD5Init(&tctx);
@ -66,7 +66,7 @@ void hmac_md5_init_rfc2104(uchar* key, int key_len, HMACMD5Context *ctx)
/*********************************************************************** /***********************************************************************
the microsoft version of hmac_md5 initialisation. the microsoft version of hmac_md5 initialisation.
***********************************************************************/ ***********************************************************************/
void hmac_md5_init_limK_to_64(const uchar* key, int key_len, void hmac_md5_init_limK_to_64(const uint8_t *key, int key_len,
HMACMD5Context *ctx) HMACMD5Context *ctx)
{ {
/* if key is longer than 64 bytes truncate it */ /* if key is longer than 64 bytes truncate it */
@ -81,7 +81,7 @@ void hmac_md5_init_limK_to_64(const uchar* key, int key_len,
/*********************************************************************** /***********************************************************************
update hmac_md5 "inner" buffer update hmac_md5 "inner" buffer
***********************************************************************/ ***********************************************************************/
void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx) void hmac_md5_update(const uint8_t *text, int text_len, HMACMD5Context *ctx)
{ {
MD5Update(&ctx->ctx, text, text_len); /* then text of datagram */ MD5Update(&ctx->ctx, text, text_len); /* then text of datagram */
} }
@ -89,8 +89,7 @@ void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx)
/*********************************************************************** /***********************************************************************
finish off hmac_md5 "inner" buffer and generate outer one. finish off hmac_md5 "inner" buffer and generate outer one.
***********************************************************************/ ***********************************************************************/
void hmac_md5_final(uchar *digest, HMACMD5Context *ctx) void hmac_md5_final(uint8_t *digest, HMACMD5Context *ctx)
{ {
struct MD5Context ctx_o; struct MD5Context ctx_o;
@ -106,7 +105,7 @@ void hmac_md5_final(uchar *digest, HMACMD5Context *ctx)
single function to calculate an HMAC MD5 digest from data. single function to calculate an HMAC MD5 digest from data.
use the microsoft hmacmd5 init method because the key is 16 bytes. use the microsoft hmacmd5 init method because the key is 16 bytes.
************************************************************/ ************************************************************/
void hmac_md5(const uchar key[16], const uchar *data, int data_len, uchar* digest) void hmac_md5(const uint8_t key[16], const uint8_t *data, int data_len, uint8_t *digest)
{ {
HMACMD5Context ctx; HMACMD5Context ctx;
hmac_md5_init_limK_to_64(key, 16, &ctx); hmac_md5_init_limK_to_64(key, 16, &ctx);
@ -116,4 +115,3 @@ void hmac_md5(const uchar key[16], const uchar *data, int data_len, uchar* diges
} }
hmac_md5_final(digest, &ctx); hmac_md5_final(digest, &ctx);
} }

View File

@ -968,7 +968,7 @@ static BOOL unix_do_match(char *regexp, char *str)
return False; return False;
} }
void dump_data_pw(const char *msg, const uchar * data, size_t len) void dump_data_pw(const char *msg, const uint8_t * data, size_t len)
{ {
#ifdef DEBUG_PASSWORD #ifdef DEBUG_PASSWORD
DEBUG(11, ("%s", msg)); DEBUG(11, ("%s", msg));

View File

@ -30,12 +30,12 @@
****************************************************************************/ ****************************************************************************/
static BOOL smb_pwd_check_ntlmv1(const DATA_BLOB *nt_response, static BOOL smb_pwd_check_ntlmv1(const DATA_BLOB *nt_response,
const uchar *part_passwd, const uint8_t *part_passwd,
const DATA_BLOB *sec_blob, const DATA_BLOB *sec_blob,
DATA_BLOB *user_sess_key) DATA_BLOB *user_sess_key)
{ {
/* Finish the encryption of part_passwd. */ /* Finish the encryption of part_passwd. */
uchar p24[24]; uint8_t p24[24];
if (part_passwd == NULL) { if (part_passwd == NULL) {
DEBUG(10,("No password set - DISALLOWING access\n")); DEBUG(10,("No password set - DISALLOWING access\n"));
@ -81,16 +81,16 @@ static BOOL smb_pwd_check_ntlmv1(const DATA_BLOB *nt_response,
****************************************************************************/ ****************************************************************************/
static BOOL smb_pwd_check_ntlmv2(const DATA_BLOB *ntv2_response, static BOOL smb_pwd_check_ntlmv2(const DATA_BLOB *ntv2_response,
const uchar *part_passwd, const uint8_t *part_passwd,
const DATA_BLOB *sec_blob, const DATA_BLOB *sec_blob,
const char *user, const char *domain, const char *user, const char *domain,
BOOL upper_case_domain, /* should the domain be transformed into upper case? */ BOOL upper_case_domain, /* should the domain be transformed into upper case? */
DATA_BLOB *user_sess_key) DATA_BLOB *user_sess_key)
{ {
/* Finish the encryption of part_passwd. */ /* Finish the encryption of part_passwd. */
uchar kr[16]; uint8_t kr[16];
uchar value_from_encryption[16]; uint8_t value_from_encryption[16];
uchar client_response[16]; uint8_t client_response[16];
DATA_BLOB client_key_data; DATA_BLOB client_key_data;
if (part_passwd == NULL) { if (part_passwd == NULL) {
@ -247,8 +247,8 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
username)); username));
} else if (lm_pw && lm_response->length) { } else if (lm_pw && lm_response->length) {
uchar dospwd[14]; uint8_t dospwd[14];
uchar p16[16]; uint8_t p16[16];
ZERO_STRUCT(dospwd); ZERO_STRUCT(dospwd);
memcpy(dospwd, lm_response->data, MIN(lm_response->length, sizeof(dospwd))); memcpy(dospwd, lm_response->data, MIN(lm_response->length, sizeof(dospwd)));

View File

@ -107,7 +107,7 @@ void debug_ntlmssp_flags(uint32_t neg_flags)
static const uint8_t *get_challenge(const struct ntlmssp_state *ntlmssp_state) static const uint8_t *get_challenge(const struct ntlmssp_state *ntlmssp_state)
{ {
static uchar chal[8]; static uint8_t chal[8];
generate_random_buffer(chal, sizeof(chal), False); generate_random_buffer(chal, sizeof(chal), False);
return chal; return chal;
@ -548,7 +548,7 @@ static NTSTATUS ntlmssp_server_preauth(struct ntlmssp_state *ntlmssp_state,
uint32_t ntlmssp_command, auth_flags; uint32_t ntlmssp_command, auth_flags;
NTSTATUS nt_status; NTSTATUS nt_status;
uchar session_nonce_hash[16]; uint8_t session_nonce_hash[16];
const char *parse_string; const char *parse_string;
char *domain = NULL; char *domain = NULL;
@ -735,7 +735,7 @@ static NTSTATUS ntlmssp_server_postauth(struct ntlmssp_state *ntlmssp_state,
} else { } else {
/* When there is no LM response, just use zeros */ /* When there is no LM response, just use zeros */
static const uchar zeros[24]; static const uint8_t zeros[24];
session_key = data_blob_talloc(ntlmssp_state->mem_ctx, NULL, 16); session_key = data_blob_talloc(ntlmssp_state->mem_ctx, NULL, 16);
SMBsesskeygen_lm_sess_key(zeros, zeros, SMBsesskeygen_lm_sess_key(zeros, zeros,
session_key.data); session_key.data);
@ -985,7 +985,7 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state,
char *server_domain; char *server_domain;
const char *chal_parse_string; const char *chal_parse_string;
const char *auth_gen_string; const char *auth_gen_string;
uchar lm_hash[16]; uint8_t lm_hash[16];
DATA_BLOB lm_response = data_blob(NULL, 0); DATA_BLOB lm_response = data_blob(NULL, 0);
DATA_BLOB nt_response = data_blob(NULL, 0); DATA_BLOB nt_response = data_blob(NULL, 0);
DATA_BLOB session_key = data_blob(NULL, 0); DATA_BLOB session_key = data_blob(NULL, 0);
@ -1053,7 +1053,7 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state,
} }
if (!ntlmssp_state->password) { if (!ntlmssp_state->password) {
static const uchar zeros[16]; static const uint8_t zeros[16];
/* do nothing - blobs are zero length */ /* do nothing - blobs are zero length */
/* session key is all zeros */ /* session key is all zeros */
@ -1088,10 +1088,10 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state,
} else if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) { } else if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
struct MD5Context md5_session_nonce_ctx; struct MD5Context md5_session_nonce_ctx;
uchar nt_hash[16]; uint8_t nt_hash[16];
uchar session_nonce[16]; uint8_t session_nonce[16];
uchar session_nonce_hash[16]; uint8_t session_nonce_hash[16];
uchar user_session_key[16]; uint8_t user_session_key[16];
E_md4hash(ntlmssp_state->password, nt_hash); E_md4hash(ntlmssp_state->password, nt_hash);
lm_response = data_blob_talloc(ntlmssp_state->mem_ctx, NULL, 24); lm_response = data_blob_talloc(ntlmssp_state->mem_ctx, NULL, 24);
@ -1124,7 +1124,7 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state,
/* LM Key is incompatible... */ /* LM Key is incompatible... */
ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_LM_KEY; ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_LM_KEY;
} else { } else {
uchar nt_hash[16]; uint8_t nt_hash[16];
if (ntlmssp_state->use_nt_response) { if (ntlmssp_state->use_nt_response) {
nt_response = data_blob_talloc(ntlmssp_state->mem_ctx, NULL, 24); nt_response = data_blob_talloc(ntlmssp_state->mem_ctx, NULL, 24);
@ -1170,7 +1170,7 @@ static NTSTATUS ntlmssp_client_challenge(struct ntlmssp_state *ntlmssp_state,
SMBsesskeygen_lm_sess_key(lm_session_key.data, lm_response.data, SMBsesskeygen_lm_sess_key(lm_session_key.data, lm_response.data,
new_session_key.data); new_session_key.data);
} else { } else {
static const uchar zeros[24]; static const uint8_t zeros[24];
SMBsesskeygen_lm_sess_key(lm_session_key.data, zeros, SMBsesskeygen_lm_sess_key(lm_session_key.data, zeros,
new_session_key.data); new_session_key.data);
} }

View File

@ -107,7 +107,7 @@ typedef struct ntlmssp_state
/* internal variables used by NTLM2 */ /* internal variables used by NTLM2 */
BOOL doing_ntlm2; BOOL doing_ntlm2;
uchar session_nonce[16]; uint8_t session_nonce[16];
/* internal variables used by KEY_EXCH (client-supplied user session key */ /* internal variables used by KEY_EXCH (client-supplied user session key */
DATA_BLOB encrypted_session_key; DATA_BLOB encrypted_session_key;

View File

@ -118,15 +118,15 @@ enum ntlmssp_direction {
static NTSTATUS ntlmssp_make_packet_signature(NTLMSSP_STATE *ntlmssp_state, static NTSTATUS ntlmssp_make_packet_signature(NTLMSSP_STATE *ntlmssp_state,
TALLOC_CTX *sig_mem_ctx, TALLOC_CTX *sig_mem_ctx,
const uchar *data, size_t length, const uint8_t *data, size_t length,
enum ntlmssp_direction direction, enum ntlmssp_direction direction,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) { if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
HMACMD5Context ctx; HMACMD5Context ctx;
uchar seq_num[4]; uint8_t seq_num[4];
uchar digest[16]; uint8_t digest[16];
SIVAL(seq_num, 0, ntlmssp_state->ntlmssp_seq_num); SIVAL(seq_num, 0, ntlmssp_state->ntlmssp_seq_num);
switch (direction) { switch (direction) {
@ -174,7 +174,7 @@ static NTSTATUS ntlmssp_make_packet_signature(NTLMSSP_STATE *ntlmssp_state,
NTSTATUS ntlmssp_sign_packet(NTLMSSP_STATE *ntlmssp_state, NTSTATUS ntlmssp_sign_packet(NTLMSSP_STATE *ntlmssp_state,
TALLOC_CTX *sig_mem_ctx, TALLOC_CTX *sig_mem_ctx,
const uchar *data, size_t length, const uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
NTSTATUS nt_status; NTSTATUS nt_status;
@ -199,7 +199,7 @@ NTSTATUS ntlmssp_sign_packet(NTLMSSP_STATE *ntlmssp_state,
NTSTATUS ntlmssp_check_packet(NTLMSSP_STATE *ntlmssp_state, NTSTATUS ntlmssp_check_packet(NTLMSSP_STATE *ntlmssp_state,
TALLOC_CTX *sig_mem_ctx, TALLOC_CTX *sig_mem_ctx,
const uchar *data, size_t length, const uint8_t *data, size_t length,
const DATA_BLOB *sig) const DATA_BLOB *sig)
{ {
DATA_BLOB local_sig; DATA_BLOB local_sig;
@ -265,7 +265,7 @@ NTSTATUS ntlmssp_check_packet(NTLMSSP_STATE *ntlmssp_state,
NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state, NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state,
TALLOC_CTX *sig_mem_ctx, TALLOC_CTX *sig_mem_ctx,
uchar *data, size_t length, uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
if (!ntlmssp_state->session_key.length) { if (!ntlmssp_state->session_key.length) {
@ -277,8 +277,8 @@ NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state,
dump_data_pw("ntlmssp clear data\n", data, length); dump_data_pw("ntlmssp clear data\n", data, length);
if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) { if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
HMACMD5Context ctx; HMACMD5Context ctx;
uchar seq_num[4]; uint8_t seq_num[4];
uchar digest[16]; uint8_t digest[16];
SIVAL(seq_num, 0, ntlmssp_state->ntlmssp_seq_num); SIVAL(seq_num, 0, ntlmssp_state->ntlmssp_seq_num);
hmac_md5_init_limK_to_64(ntlmssp_state->send_sign_key, hmac_md5_init_limK_to_64(ntlmssp_state->send_sign_key,
@ -335,7 +335,7 @@ NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state,
NTSTATUS ntlmssp_unseal_packet(NTLMSSP_STATE *ntlmssp_state, NTSTATUS ntlmssp_unseal_packet(NTLMSSP_STATE *ntlmssp_state,
TALLOC_CTX *sig_mem_ctx, TALLOC_CTX *sig_mem_ctx,
uchar *data, size_t length, uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
if (!ntlmssp_state->session_key.length) { if (!ntlmssp_state->session_key.length) {

View File

@ -26,12 +26,12 @@
Encode or Decode the sequence number (which is symmetric) Encode or Decode the sequence number (which is symmetric)
********************************************************************/ ********************************************************************/
static void netsec_deal_with_seq_num(struct schannel_state *state, static void netsec_deal_with_seq_num(struct schannel_state *state,
const uchar packet_digest[8], const uint8_t packet_digest[8],
uchar seq_num[8]) uint8_t seq_num[8])
{ {
static const uchar zeros[4]; static const uint8_t zeros[4];
uchar sequence_key[16]; uint8_t sequence_key[16];
uchar digest1[16]; uint8_t digest1[16];
hmac_md5(state->session_key, zeros, sizeof(zeros), digest1); hmac_md5(state->session_key, zeros, sizeof(zeros), digest1);
hmac_md5(digest1, packet_digest, 8, sequence_key); hmac_md5(digest1, packet_digest, 8, sequence_key);
@ -44,13 +44,13 @@ static void netsec_deal_with_seq_num(struct schannel_state *state,
/******************************************************************* /*******************************************************************
Calculate the key with which to encode the data payload Calculate the key with which to encode the data payload
********************************************************************/ ********************************************************************/
static void netsec_get_sealing_key(const uchar session_key[16], static void netsec_get_sealing_key(const uint8_t session_key[16],
const uchar seq_num[8], const uint8_t seq_num[8],
uchar sealing_key[16]) uint8_t sealing_key[16])
{ {
static const uchar zeros[4]; static const uint8_t zeros[4];
uchar digest2[16]; uint8_t digest2[16];
uchar sess_kf0[16]; uint8_t sess_kf0[16];
int i; int i;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
@ -66,14 +66,14 @@ static void netsec_get_sealing_key(const uchar session_key[16],
Create a digest over the entire packet (including the data), and Create a digest over the entire packet (including the data), and
MD5 it with the session key. MD5 it with the session key.
********************************************************************/ ********************************************************************/
static void schannel_digest(const uchar sess_key[16], static void schannel_digest(const uint8_t sess_key[16],
const uchar netsec_sig[8], const uint8_t netsec_sig[8],
const uchar *confounder, const uint8_t *confounder,
const uchar *data, size_t data_len, const uint8_t *data, size_t data_len,
uchar digest_final[16]) uint8_t digest_final[16])
{ {
uchar packet_digest[16]; uint8_t packet_digest[16];
static const uchar zeros[4]; static const uint8_t zeros[4];
struct MD5Context ctx; struct MD5Context ctx;
MD5Init(&ctx); MD5Init(&ctx);
@ -94,14 +94,14 @@ static void schannel_digest(const uchar sess_key[16],
*/ */
NTSTATUS schannel_unseal_packet(struct schannel_state *state, NTSTATUS schannel_unseal_packet(struct schannel_state *state,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
uchar *data, size_t length, uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
uchar digest_final[16]; uint8_t digest_final[16];
uchar confounder[8]; uint8_t confounder[8];
uchar seq_num[8]; uint8_t seq_num[8];
uchar sealing_key[16]; uint8_t sealing_key[16];
static const uchar netsec_sig[8] = NETSEC_SEAL_SIGNATURE; static const uint8_t netsec_sig[8] = NETSEC_SEAL_SIGNATURE;
if (sig->length != 32) { if (sig->length != 32) {
return NT_STATUS_ACCESS_DENIED; return NT_STATUS_ACCESS_DENIED;
@ -141,12 +141,12 @@ NTSTATUS schannel_unseal_packet(struct schannel_state *state,
check the signature on a packet check the signature on a packet
*/ */
NTSTATUS schannel_check_packet(struct schannel_state *state, NTSTATUS schannel_check_packet(struct schannel_state *state,
const uchar *data, size_t length, const uint8_t *data, size_t length,
const DATA_BLOB *sig) const DATA_BLOB *sig)
{ {
uchar digest_final[16]; uint8_t digest_final[16];
uchar seq_num[8]; uint8_t seq_num[8];
static const uchar netsec_sig[8] = NETSEC_SIGN_SIGNATURE; static const uint8_t netsec_sig[8] = NETSEC_SIGN_SIGNATURE;
if (sig->length != 32) { if (sig->length != 32) {
return NT_STATUS_ACCESS_DENIED; return NT_STATUS_ACCESS_DENIED;
@ -185,14 +185,14 @@ NTSTATUS schannel_check_packet(struct schannel_state *state,
*/ */
NTSTATUS schannel_seal_packet(struct schannel_state *state, NTSTATUS schannel_seal_packet(struct schannel_state *state,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
uchar *data, size_t length, uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
uchar digest_final[16]; uint8_t digest_final[16];
uchar confounder[8]; uint8_t confounder[8];
uchar seq_num[8]; uint8_t seq_num[8];
uchar sealing_key[16]; uint8_t sealing_key[16];
static const uchar netsec_sig[8] = NETSEC_SEAL_SIGNATURE; static const uint8_t netsec_sig[8] = NETSEC_SEAL_SIGNATURE;
generate_random_buffer(confounder, 8, False); generate_random_buffer(confounder, 8, False);
@ -236,12 +236,12 @@ NTSTATUS schannel_seal_packet(struct schannel_state *state,
*/ */
NTSTATUS schannel_sign_packet(struct schannel_state *state, NTSTATUS schannel_sign_packet(struct schannel_state *state,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
const uchar *data, size_t length, const uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
uchar digest_final[16]; uint8_t digest_final[16];
uchar seq_num[8]; uint8_t seq_num[8];
static const uchar netsec_sig[8] = NETSEC_SIGN_SIGNATURE; static const uint8_t netsec_sig[8] = NETSEC_SIGN_SIGNATURE;
RSIVAL(seq_num, 0, state->seq_num); RSIVAL(seq_num, 0, state->seq_num);
SIVAL(seq_num, 4, state->initiator?0x80:0); SIVAL(seq_num, 4, state->initiator?0x80:0);

View File

@ -226,8 +226,8 @@ int ip_compare(struct in_addr *ip1, struct in_addr *ip2)
struct in_addr ip; struct in_addr ip;
int bits1, bits2; int bits1, bits2;
ip = *iface_n_bcast(i); ip = *iface_n_bcast(i);
bits1 = matching_quad_bits((uchar *)&ip1->s_addr, (uchar *)&ip.s_addr); bits1 = matching_quad_bits((uint8_t *)&ip1->s_addr, (uint8_t *)&ip.s_addr);
bits2 = matching_quad_bits((uchar *)&ip2->s_addr, (uchar *)&ip.s_addr); bits2 = matching_quad_bits((uint8_t *)&ip2->s_addr, (uint8_t *)&ip.s_addr);
max_bits1 = MAX(bits1, max_bits1); max_bits1 = MAX(bits1, max_bits1);
max_bits2 = MAX(bits2, max_bits2); max_bits2 = MAX(bits2, max_bits2);
} }

View File

@ -74,7 +74,7 @@ static void debug_nmb_res_rec(struct res_rec *res, const char *hdr)
for (j = 0; j < 16; j++) for (j = 0; j < 16; j++)
{ {
uchar x = res->rdata[i+j]; uint8_t x = res->rdata[i+j];
if (x < 32 || x > 127) x = '.'; if (x < 32 || x > 127) x = '.';
if (i+j >= res->rdlength) break; if (i+j >= res->rdlength) break;
@ -86,7 +86,7 @@ static void debug_nmb_res_rec(struct res_rec *res, const char *hdr)
for (j = 0; j < 16; j++) for (j = 0; j < 16; j++)
{ {
if (i+j >= res->rdlength) break; if (i+j >= res->rdlength) break;
DEBUGADD(4, ("%02X", (uchar)res->rdata[i+j])); DEBUGADD(4, ("%02X", (uint8_t)res->rdata[i+j]));
} }
DEBUGADD(4, ("\n")); DEBUGADD(4, ("\n"));
@ -146,7 +146,7 @@ void debug_nmb_packet(struct packet_struct *p)
/******************************************************************* /*******************************************************************
handle "compressed" name pointers handle "compressed" name pointers
******************************************************************/ ******************************************************************/
static BOOL handle_name_ptrs(uchar *ubuf,int *offset,int length, static BOOL handle_name_ptrs(uint8_t *ubuf,int *offset,int length,
BOOL *got_pointer,int *ret) BOOL *got_pointer,int *ret)
{ {
int loop_count=0; int loop_count=0;
@ -169,7 +169,7 @@ static BOOL handle_name_ptrs(uchar *ubuf,int *offset,int length,
static int parse_nmb_name(char *inbuf,int ofs,int length, struct nmb_name *name) static int parse_nmb_name(char *inbuf,int ofs,int length, struct nmb_name *name)
{ {
int m,n=0; int m,n=0;
uchar *ubuf = (uchar *)inbuf; uint8_t *ubuf = (uint8_t *)inbuf;
int ret = 0; int ret = 0;
BOOL got_pointer=False; BOOL got_pointer=False;
int loop_count=0; int loop_count=0;
@ -196,7 +196,7 @@ static int parse_nmb_name(char *inbuf,int ofs,int length, struct nmb_name *name)
ret += m + 2; ret += m + 2;
offset++; offset++;
while (m > 0) { while (m > 0) {
uchar c1,c2; uint8_t c1,c2;
c1 = ubuf[offset++]-'A'; c1 = ubuf[offset++]-'A';
c2 = ubuf[offset++]-'A'; c2 = ubuf[offset++]-'A';
if ((c1 & 0xF0) || (c2 & 0xF0) || (n > sizeof(name->name)-1)) if ((c1 & 0xF0) || (c2 & 0xF0) || (n > sizeof(name->name)-1))
@ -209,7 +209,7 @@ static int parse_nmb_name(char *inbuf,int ofs,int length, struct nmb_name *name)
if (n==16) { if (n==16) {
/* parse out the name type, /* parse out the name type,
its always in the 16th byte of the name */ its always in the 16th byte of the name */
name->name_type = ((uchar)name->name[15]) & 0xff; name->name_type = ((uint8_t)name->name[15]) & 0xff;
/* remove trailing spaces */ /* remove trailing spaces */
name->name[15] = 0; name->name[15] = 0;
@ -385,7 +385,7 @@ static int put_res_rec(char *buf,int offset,struct res_rec *recs,int count)
/******************************************************************* /*******************************************************************
put a compressed name pointer record into a packet put a compressed name pointer record into a packet
******************************************************************/ ******************************************************************/
static int put_compressed_name_ptr(uchar *buf,int offset,struct res_rec *rec,int ptr_offset) static int put_compressed_name_ptr(uint8_t *buf,int offset,struct res_rec *rec,int ptr_offset)
{ {
int ret=0; int ret=0;
buf[offset] = (0xC0 | ((ptr_offset >> 8) & 0xFF)); buf[offset] = (0xC0 | ((ptr_offset >> 8) & 0xFF));
@ -769,7 +769,7 @@ static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
static int build_dgram(char *buf,struct packet_struct *p) static int build_dgram(char *buf,struct packet_struct *p)
{ {
struct dgram_packet *dgram = &p->packet.dgram; struct dgram_packet *dgram = &p->packet.dgram;
uchar *ubuf = (uchar *)buf; uint8_t *ubuf = (uint8_t *)buf;
int offset=0; int offset=0;
/* put in the header */ /* put in the header */
@ -839,7 +839,7 @@ BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2)
static int build_nmb(char *buf,struct packet_struct *p) static int build_nmb(char *buf,struct packet_struct *p)
{ {
struct nmb_packet *nmb = &p->packet.nmb; struct nmb_packet *nmb = &p->packet.nmb;
uchar *ubuf = (uchar *)buf; uint8_t *ubuf = (uint8_t *)buf;
int offset=0; int offset=0;
/* put in the header */ /* put in the header */
@ -1036,7 +1036,7 @@ BOOL match_mailslot_name(struct packet_struct *p, const char *mailslot_name)
/**************************************************************************** /****************************************************************************
return the number of bits that match between two 4 character buffers return the number of bits that match between two 4 character buffers
***************************************************************************/ ***************************************************************************/
int matching_quad_bits(uchar *p1, uchar *p2) int matching_quad_bits(uint8_t *p1, uint8_t *p2)
{ {
int i, j, ret = 0; int i, j, ret = 0;
for (i=0; i<4; i++) { for (i=0; i<4; i++) {
@ -1055,12 +1055,12 @@ int matching_quad_bits(uchar *p1, uchar *p2)
} }
static uchar sort_ip[4]; static uint8_t sort_ip[4];
/**************************************************************************** /****************************************************************************
compare two query reply records compare two query reply records
***************************************************************************/ ***************************************************************************/
static int name_query_comp(uchar *p1, uchar *p2) static int name_query_comp(uint8_t *p1, uint8_t *p2)
{ {
return matching_quad_bits(p2+2, sort_ip) - matching_quad_bits(p1+2, sort_ip); return matching_quad_bits(p2+2, sort_ip) - matching_quad_bits(p1+2, sort_ip);
} }
@ -1149,7 +1149,7 @@ static int name_interpret(char *in,char *out)
while(*in) while(*in)
{ {
*out++ = '.'; /* Scope names are separated by periods */ *out++ = '.'; /* Scope names are separated by periods */
len = *(uchar *)in++; len = *(uint8_t *)in++;
StrnCpy(out, in, len); StrnCpy(out, in, len);
out += len; out += len;
*out=0; *out=0;
@ -1240,7 +1240,7 @@ find a pointer to a netbios name
****************************************************************************/ ****************************************************************************/
static char *name_ptr(char *buf,int ofs) static char *name_ptr(char *buf,int ofs)
{ {
uchar c = *(uchar *)(buf+ofs); uint8_t c = *(uint8_t *)(buf+ofs);
if ((c & 0xC0) == 0xC0) if ((c & 0xC0) == 0xC0)
{ {
@ -1270,7 +1270,7 @@ return the total storage length of a mangled name
int name_len(char *s1) int name_len(char *s1)
{ {
/* NOTE: this argument _must_ be unsigned */ /* NOTE: this argument _must_ be unsigned */
uchar *s = (uchar *)s1; uint8_t *s = (uint8_t *)s1;
int len; int len;
/* If the two high bits of the byte are set, return 2. */ /* If the two high bits of the byte are set, return 2. */

View File

@ -252,7 +252,7 @@ static void use_nt1_session_keys(struct cli_session *session,
const char *password, const DATA_BLOB *nt_response) const char *password, const DATA_BLOB *nt_response)
{ {
struct cli_transport *transport = session->transport; struct cli_transport *transport = session->transport;
uchar nt_hash[16]; uint8_t nt_hash[16];
DATA_BLOB session_key = data_blob(NULL, 16); DATA_BLOB session_key = data_blob(NULL, 16);
E_md4hash(password, nt_hash); E_md4hash(password, nt_hash);

View File

@ -46,9 +46,9 @@
*/ */
#define uchar unsigned char #define uint8_t unsigned char
static const uchar perm1[56] = {57, 49, 41, 33, 25, 17, 9, static const uint8_t perm1[56] = {57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18, 1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27, 10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36, 19, 11, 3, 60, 52, 44, 36,
@ -57,7 +57,7 @@ static const uchar perm1[56] = {57, 49, 41, 33, 25, 17, 9,
14, 6, 61, 53, 45, 37, 29, 14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4}; 21, 13, 5, 28, 20, 12, 4};
static const uchar perm2[48] = {14, 17, 11, 24, 1, 5, static const uint8_t perm2[48] = {14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10, 3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8, 23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2, 16, 7, 27, 20, 13, 2,
@ -66,7 +66,7 @@ static const uchar perm2[48] = {14, 17, 11, 24, 1, 5,
44, 49, 39, 56, 34, 53, 44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32}; 46, 42, 50, 36, 29, 32};
static const uchar perm3[64] = {58, 50, 42, 34, 26, 18, 10, 2, static const uint8_t perm3[64] = {58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4, 60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6, 62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8, 64, 56, 48, 40, 32, 24, 16, 8,
@ -75,7 +75,7 @@ static const uchar perm3[64] = {58, 50, 42, 34, 26, 18, 10, 2,
61, 53, 45, 37, 29, 21, 13, 5, 61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7}; 63, 55, 47, 39, 31, 23, 15, 7};
static const uchar perm4[48] = { 32, 1, 2, 3, 4, 5, static const uint8_t perm4[48] = { 32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13, 8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17, 12, 13, 14, 15, 16, 17,
@ -84,7 +84,7 @@ static const uchar perm4[48] = { 32, 1, 2, 3, 4, 5,
24, 25, 26, 27, 28, 29, 24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1}; 28, 29, 30, 31, 32, 1};
static const uchar perm5[32] = { 16, 7, 20, 21, static const uint8_t perm5[32] = { 16, 7, 20, 21,
29, 12, 28, 17, 29, 12, 28, 17,
1, 15, 23, 26, 1, 15, 23, 26,
5, 18, 31, 10, 5, 18, 31, 10,
@ -94,7 +94,7 @@ static const uchar perm5[32] = { 16, 7, 20, 21,
22, 11, 4, 25}; 22, 11, 4, 25};
static const uchar perm6[64] ={ 40, 8, 48, 16, 56, 24, 64, 32, static const uint8_t perm6[64] ={ 40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31, 39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30, 38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29, 37, 5, 45, 13, 53, 21, 61, 29,
@ -104,9 +104,9 @@ static const uchar perm6[64] ={ 40, 8, 48, 16, 56, 24, 64, 32,
33, 1, 41, 9, 49, 17, 57, 25}; 33, 1, 41, 9, 49, 17, 57, 25};
static const uchar sc[16] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1}; static const uint8_t sc[16] = {1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1};
static const uchar sbox[8][4][16] = { static const uint8_t sbox[8][4][16] = {
{{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7}, {{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7},
{0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8}, {0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8},
{4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0}, {4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0},
@ -147,7 +147,7 @@ static const uchar sbox[8][4][16] = {
{7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8}, {7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8},
{2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}}}; {2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}}};
static void permute(char *out, const char *in, const uchar *p, int n) static void permute(char *out, const char *in, const uint8_t *p, int n)
{ {
int i; int i;
for (i=0;i<n;i++) for (i=0;i<n;i++)
@ -412,14 +412,14 @@ void SamOEMhash(uint8_t *data, const uint8_t keystr[16], int len)
/* Decode a sam password hash into a password. The password hash is the /* Decode a sam password hash into a password. The password hash is the
same method used to store passwords in the NT registry. The DES key same method used to store passwords in the NT registry. The DES key
used is based on the RID of the user. */ used is based on the RID of the user. */
void sam_pwd_hash(uint_t rid, const uchar *in, uchar *out, int forw) void sam_pwd_hash(uint_t rid, const uint8_t *in, uint8_t *out, int forw)
{ {
uchar s[14]; uint8_t s[14];
s[0] = s[4] = s[8] = s[12] = (uchar)(rid & 0xFF); s[0] = s[4] = s[8] = s[12] = (uint8_t)(rid & 0xFF);
s[1] = s[5] = s[9] = s[13] = (uchar)((rid >> 8) & 0xFF); s[1] = s[5] = s[9] = s[13] = (uint8_t)((rid >> 8) & 0xFF);
s[2] = s[6] = s[10] = (uchar)((rid >> 16) & 0xFF); s[2] = s[6] = s[10] = (uint8_t)((rid >> 16) & 0xFF);
s[3] = s[7] = s[11] = (uchar)((rid >> 24) & 0xFF); s[3] = s[7] = s[11] = (uint8_t)((rid >> 24) & 0xFF);
smbhash(out, in, s, forw); smbhash(out, in, s, forw);
smbhash(out+8, in+8, s+7, forw); smbhash(out+8, in+8, s+7, forw);

View File

@ -32,10 +32,10 @@
Returns False if password must have been truncated to create LM hash Returns False if password must have been truncated to create LM hash
*/ */
BOOL SMBencrypt(const char *passwd, const uchar *c8, uchar p24[24]) BOOL SMBencrypt(const char *passwd, const uint8_t *c8, uint8_t p24[24])
{ {
BOOL ret; BOOL ret;
uchar p21[21]; uint8_t p21[21];
memset(p21,'\0',21); memset(p21,'\0',21);
ret = E_deshash(passwd, p21); ret = E_deshash(passwd, p21);
@ -58,7 +58,7 @@ BOOL SMBencrypt(const char *passwd, const uchar *c8, uchar p24[24])
* @param p16 return password hashed with md4, caller allocated 16 byte buffer * @param p16 return password hashed with md4, caller allocated 16 byte buffer
*/ */
void E_md4hash(const char *passwd, uchar p16[16]) void E_md4hash(const char *passwd, uint8_t p16[16])
{ {
int len; int len;
smb_ucs2_t wpwd[129]; smb_ucs2_t wpwd[129];
@ -80,7 +80,7 @@ void E_md4hash(const char *passwd, uchar p16[16])
* @note p16 is filled in regardless * @note p16 is filled in regardless
*/ */
BOOL E_deshash(const char *passwd, uchar p16[16]) BOOL E_deshash(const char *passwd, uint8_t p16[16])
{ {
BOOL ret = True; BOOL ret = True;
fstring dospwd; fstring dospwd;
@ -110,7 +110,7 @@ BOOL E_deshash(const char *passwd, uchar p16[16])
*/ */
/* Does both the NT and LM owfs of a user's password */ /* Does both the NT and LM owfs of a user's password */
void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar p16[16]) void nt_lm_owf_gen(const char *pwd, uint8_t nt_p16[16], uint8_t p16[16])
{ {
/* Calculate the MD4 hash (NT compatible) of the password */ /* Calculate the MD4 hash (NT compatible) of the password */
memset(nt_p16, '\0', 16); memset(nt_p16, '\0', 16);
@ -122,7 +122,7 @@ void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar p16[16])
dump_data(100, (char *)nt_p16, 16); dump_data(100, (char *)nt_p16, 16);
#endif #endif
E_deshash(pwd, (uchar *)p16); E_deshash(pwd, (uint8_t *)p16);
#ifdef DEBUG_PASSWORD #ifdef DEBUG_PASSWORD
DEBUG(100,("nt_lm_owf_gen: pwd, lm#\n")); DEBUG(100,("nt_lm_owf_gen: pwd, lm#\n"));
@ -132,10 +132,10 @@ void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar p16[16])
} }
/* Does both the NTLMv2 owfs of a user's password */ /* Does both the NTLMv2 owfs of a user's password */
BOOL ntv2_owf_gen(const uchar owf[16], BOOL ntv2_owf_gen(const uint8_t owf[16],
const char *user_in, const char *domain_in, const char *user_in, const char *domain_in,
BOOL upper_case_domain, /* Transform the domain into UPPER case */ BOOL upper_case_domain, /* Transform the domain into UPPER case */
uchar kr_buf[16]) uint8_t kr_buf[16])
{ {
smb_ucs2_t *user; smb_ucs2_t *user;
smb_ucs2_t *domain; smb_ucs2_t *domain;
@ -188,9 +188,9 @@ BOOL ntv2_owf_gen(const uchar owf[16],
} }
/* Does the des encryption from the NT or LM MD4 hash. */ /* Does the des encryption from the NT or LM MD4 hash. */
void SMBOWFencrypt(const uchar passwd[16], const uchar *c8, uchar p24[24]) void SMBOWFencrypt(const uint8_t passwd[16], const uint8_t *c8, uint8_t p24[24])
{ {
uchar p21[21]; uint8_t p21[21];
ZERO_STRUCT(p21); ZERO_STRUCT(p21);
@ -200,9 +200,9 @@ void SMBOWFencrypt(const uchar passwd[16], const uchar *c8, uchar p24[24])
/* Does the NT MD4 hash then des encryption. */ /* Does the NT MD4 hash then des encryption. */
void SMBNTencrypt(const char *passwd, uchar *c8, uchar *p24) void SMBNTencrypt(const char *passwd, uint8_t *c8, uint8_t *p24)
{ {
uchar p21[21]; uint8_t p21[21];
memset(p21,'\0',21); memset(p21,'\0',21);
@ -218,10 +218,10 @@ void SMBNTencrypt(const char *passwd, uchar *c8, uchar *p24)
} }
/* Does the md5 encryption from the Key Response for NTLMv2. */ /* Does the md5 encryption from the Key Response for NTLMv2. */
void SMBOWFencrypt_ntv2(const uchar kr[16], void SMBOWFencrypt_ntv2(const uint8_t kr[16],
const DATA_BLOB *srv_chal, const DATA_BLOB *srv_chal,
const DATA_BLOB *cli_chal, const DATA_BLOB *cli_chal,
uchar resp_buf[16]) uint8_t resp_buf[16])
{ {
HMACMD5Context ctx; HMACMD5Context ctx;
@ -238,8 +238,8 @@ void SMBOWFencrypt_ntv2(const uchar kr[16],
#endif #endif
} }
void SMBsesskeygen_ntv2(const uchar kr[16], void SMBsesskeygen_ntv2(const uint8_t kr[16],
const uchar * nt_resp, uint8_t sess_key[16]) const uint8_t * nt_resp, uint8_t sess_key[16])
{ {
/* a very nice, 128 bit, variable session key */ /* a very nice, 128 bit, variable session key */
@ -255,7 +255,7 @@ void SMBsesskeygen_ntv2(const uchar kr[16],
#endif #endif
} }
void SMBsesskeygen_ntv1(const uchar kr[16], uint8_t sess_key[16]) void SMBsesskeygen_ntv1(const uint8_t kr[16], uint8_t sess_key[16])
{ {
/* yes, this session key does not change - yes, this /* yes, this session key does not change - yes, this
is a problem - but it is 128 bits */ is a problem - but it is 128 bits */
@ -268,14 +268,14 @@ void SMBsesskeygen_ntv1(const uchar kr[16], uint8_t sess_key[16])
#endif #endif
} }
void SMBsesskeygen_lm_sess_key(const uchar lm_hash[16], void SMBsesskeygen_lm_sess_key(const uint8_t lm_hash[16],
const uchar lm_resp[24], /* only uses 8 */ const uint8_t lm_resp[24], /* only uses 8 */
uint8_t sess_key[16]) uint8_t sess_key[16])
{ {
/* Calculate the LM session key (effective length 40 bits, /* Calculate the LM session key (effective length 40 bits,
but changes with each session) */ but changes with each session) */
uchar p24[24]; uint8_t p24[24];
uchar p21[21]; uint8_t p21[21];
memset(p21,'\0',21); memset(p21,'\0',21);
memcpy(p21, lm_hash, 8); memcpy(p21, lm_hash, 8);
@ -306,7 +306,7 @@ DATA_BLOB NTLMv2_generate_names_blob(TALLOC_CTX *mem_ctx,
static DATA_BLOB NTLMv2_generate_client_data(TALLOC_CTX *mem_ctx, const DATA_BLOB *names_blob) static DATA_BLOB NTLMv2_generate_client_data(TALLOC_CTX *mem_ctx, const DATA_BLOB *names_blob)
{ {
uchar client_chal[8]; uint8_t client_chal[8];
DATA_BLOB response = data_blob(NULL, 0); DATA_BLOB response = data_blob(NULL, 0);
char long_date[8]; char long_date[8];
NTTIME nttime; NTTIME nttime;
@ -330,11 +330,11 @@ static DATA_BLOB NTLMv2_generate_client_data(TALLOC_CTX *mem_ctx, const DATA_BLO
return response; return response;
} }
static DATA_BLOB NTLMv2_generate_response(const uchar ntlm_v2_hash[16], static DATA_BLOB NTLMv2_generate_response(const uint8_t ntlm_v2_hash[16],
const DATA_BLOB *server_chal, const DATA_BLOB *server_chal,
const DATA_BLOB *names_blob) const DATA_BLOB *names_blob)
{ {
uchar ntlmv2_response[16]; uint8_t ntlmv2_response[16];
DATA_BLOB ntlmv2_client_data; DATA_BLOB ntlmv2_client_data;
DATA_BLOB final_response; DATA_BLOB final_response;
@ -364,10 +364,10 @@ static DATA_BLOB NTLMv2_generate_response(const uchar ntlm_v2_hash[16],
return final_response; return final_response;
} }
static DATA_BLOB LMv2_generate_response(const uchar ntlm_v2_hash[16], static DATA_BLOB LMv2_generate_response(const uint8_t ntlm_v2_hash[16],
const DATA_BLOB *server_chal) const DATA_BLOB *server_chal)
{ {
uchar lmv2_response[16]; uint8_t lmv2_response[16];
DATA_BLOB lmv2_client_data = data_blob(NULL, 8); DATA_BLOB lmv2_client_data = data_blob(NULL, 8);
DATA_BLOB final_response = data_blob(NULL, 24); DATA_BLOB final_response = data_blob(NULL, 24);
@ -395,8 +395,8 @@ BOOL SMBNTLMv2encrypt(const char *user, const char *domain, const char *password
DATA_BLOB *lm_response, DATA_BLOB *nt_response, DATA_BLOB *lm_response, DATA_BLOB *nt_response,
DATA_BLOB *user_session_key) DATA_BLOB *user_session_key)
{ {
uchar nt_hash[16]; uint8_t nt_hash[16];
uchar ntlm_v2_hash[16]; uint8_t ntlm_v2_hash[16];
E_md4hash(password, nt_hash); E_md4hash(password, nt_hash);
/* We don't use the NT# directly. Instead we use it mashed up with /* We don't use the NT# directly. Instead we use it mashed up with
@ -434,7 +434,7 @@ BOOL SMBNTLMv2encrypt(const char *user, const char *domain, const char *password
************************************************************/ ************************************************************/
BOOL encode_pw_buffer(char buffer[516], const char *password, int string_flags) BOOL encode_pw_buffer(char buffer[516], const char *password, int string_flags)
{ {
uchar new_pw[512]; uint8_t new_pw[512];
size_t new_pw_len; size_t new_pw_len;
new_pw_len = push_string(NULL, new_pw, new_pw_len = push_string(NULL, new_pw,

View File

@ -29,16 +29,16 @@ struct dcerpc_security {
void *private; void *private;
NTSTATUS (*unseal_packet)(struct dcerpc_security *, NTSTATUS (*unseal_packet)(struct dcerpc_security *,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
uchar *data, size_t length, DATA_BLOB *sig); uint8_t *data, size_t length, DATA_BLOB *sig);
NTSTATUS (*check_packet)(struct dcerpc_security *, NTSTATUS (*check_packet)(struct dcerpc_security *,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
const uchar *data, size_t length, const DATA_BLOB *sig); const uint8_t *data, size_t length, const DATA_BLOB *sig);
NTSTATUS (*seal_packet)(struct dcerpc_security *, NTSTATUS (*seal_packet)(struct dcerpc_security *,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
uchar *data, size_t length, DATA_BLOB *sig); uint8_t *data, size_t length, DATA_BLOB *sig);
NTSTATUS (*sign_packet)(struct dcerpc_security *, NTSTATUS (*sign_packet)(struct dcerpc_security *,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
const uchar *data, size_t length, DATA_BLOB *sig); const uint8_t *data, size_t length, DATA_BLOB *sig);
NTSTATUS (*session_key)(struct dcerpc_security *, DATA_BLOB *session_key); NTSTATUS (*session_key)(struct dcerpc_security *, DATA_BLOB *session_key);
void (*security_end)(struct dcerpc_security *); void (*security_end)(struct dcerpc_security *);
}; };

View File

@ -27,7 +27,7 @@
*/ */
static NTSTATUS ntlm_unseal_packet(struct dcerpc_security *dcerpc_security, static NTSTATUS ntlm_unseal_packet(struct dcerpc_security *dcerpc_security,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
uchar *data, size_t length, DATA_BLOB *sig) uint8_t *data, size_t length, DATA_BLOB *sig)
{ {
struct ntlmssp_state *ntlmssp_state = dcerpc_security->private; struct ntlmssp_state *ntlmssp_state = dcerpc_security->private;
return ntlmssp_unseal_packet(ntlmssp_state, mem_ctx, data, length, sig); return ntlmssp_unseal_packet(ntlmssp_state, mem_ctx, data, length, sig);
@ -35,7 +35,7 @@ static NTSTATUS ntlm_unseal_packet(struct dcerpc_security *dcerpc_security,
static NTSTATUS ntlm_check_packet(struct dcerpc_security *dcerpc_security, static NTSTATUS ntlm_check_packet(struct dcerpc_security *dcerpc_security,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
const uchar *data, size_t length, const uint8_t *data, size_t length,
const DATA_BLOB *sig) const DATA_BLOB *sig)
{ {
struct ntlmssp_state *ntlmssp_state = dcerpc_security->private; struct ntlmssp_state *ntlmssp_state = dcerpc_security->private;
@ -44,7 +44,7 @@ static NTSTATUS ntlm_check_packet(struct dcerpc_security *dcerpc_security,
static NTSTATUS ntlm_seal_packet(struct dcerpc_security *dcerpc_security, static NTSTATUS ntlm_seal_packet(struct dcerpc_security *dcerpc_security,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
uchar *data, size_t length, uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
struct ntlmssp_state *ntlmssp_state = dcerpc_security->private; struct ntlmssp_state *ntlmssp_state = dcerpc_security->private;
@ -53,7 +53,7 @@ static NTSTATUS ntlm_seal_packet(struct dcerpc_security *dcerpc_security,
static NTSTATUS ntlm_sign_packet(struct dcerpc_security *dcerpc_security, static NTSTATUS ntlm_sign_packet(struct dcerpc_security *dcerpc_security,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
const uchar *data, size_t length, const uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
struct ntlmssp_state *ntlmssp_state = dcerpc_security->private; struct ntlmssp_state *ntlmssp_state = dcerpc_security->private;

View File

@ -27,7 +27,7 @@
*/ */
static NTSTATUS schan_unseal_packet(struct dcerpc_security *dcerpc_security, static NTSTATUS schan_unseal_packet(struct dcerpc_security *dcerpc_security,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
uchar *data, size_t length, DATA_BLOB *sig) uint8_t *data, size_t length, DATA_BLOB *sig)
{ {
struct schannel_state *schannel_state = dcerpc_security->private; struct schannel_state *schannel_state = dcerpc_security->private;
return schannel_unseal_packet(schannel_state, mem_ctx, data, length, sig); return schannel_unseal_packet(schannel_state, mem_ctx, data, length, sig);
@ -35,7 +35,7 @@ static NTSTATUS schan_unseal_packet(struct dcerpc_security *dcerpc_security,
static NTSTATUS schan_check_packet(struct dcerpc_security *dcerpc_security, static NTSTATUS schan_check_packet(struct dcerpc_security *dcerpc_security,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
const uchar *data, size_t length, const uint8_t *data, size_t length,
const DATA_BLOB *sig) const DATA_BLOB *sig)
{ {
struct schannel_state *schannel_state = dcerpc_security->private; struct schannel_state *schannel_state = dcerpc_security->private;
@ -44,7 +44,7 @@ static NTSTATUS schan_check_packet(struct dcerpc_security *dcerpc_security,
static NTSTATUS schan_seal_packet(struct dcerpc_security *dcerpc_security, static NTSTATUS schan_seal_packet(struct dcerpc_security *dcerpc_security,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
uchar *data, size_t length, uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
struct schannel_state *schannel_state = dcerpc_security->private; struct schannel_state *schannel_state = dcerpc_security->private;
@ -53,7 +53,7 @@ static NTSTATUS schan_seal_packet(struct dcerpc_security *dcerpc_security,
static NTSTATUS schan_sign_packet(struct dcerpc_security *dcerpc_security, static NTSTATUS schan_sign_packet(struct dcerpc_security *dcerpc_security,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
const uchar *data, size_t length, const uint8_t *data, size_t length,
DATA_BLOB *sig) DATA_BLOB *sig)
{ {
struct schannel_state *schannel_state = dcerpc_security->private; struct schannel_state *schannel_state = dcerpc_security->private;

View File

@ -596,10 +596,10 @@ static BOOL test_lm_ntlm_broken(struct samlogon_state *samlogon_state, enum ntlm
DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24);
DATA_BLOB session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16); DATA_BLOB session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16);
uchar lm_key[8]; uint8_t lm_key[8];
uchar user_session_key[16]; uint8_t user_session_key[16];
uchar lm_hash[16]; uint8_t lm_hash[16];
uchar nt_hash[16]; uint8_t nt_hash[16];
ZERO_STRUCT(lm_key); ZERO_STRUCT(lm_key);
ZERO_STRUCT(user_session_key); ZERO_STRUCT(user_session_key);
@ -693,9 +693,9 @@ static BOOL test_ntlm_in_lm(struct samlogon_state *samlogon_state, char **error_
NTSTATUS nt_status; NTSTATUS nt_status;
DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB nt_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24);
uchar lm_key[8]; uint8_t lm_key[8];
uchar lm_hash[16]; uint8_t lm_hash[16];
uchar user_session_key[16]; uint8_t user_session_key[16];
ZERO_STRUCT(user_session_key); ZERO_STRUCT(user_session_key);
@ -818,7 +818,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, enum
DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0); DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0);
DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, lp_netbios_name(), lp_workgroup()); DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, lp_netbios_name(), lp_workgroup());
uchar user_session_key[16]; uint8_t user_session_key[16];
ZERO_STRUCT(user_session_key); ZERO_STRUCT(user_session_key);
@ -922,9 +922,9 @@ static BOOL test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea
char *dospw; char *dospw;
smb_ucs2_t *unicodepw; smb_ucs2_t *unicodepw;
uchar user_session_key[16]; uint8_t user_session_key[16];
uchar lm_key[16]; uint8_t lm_key[16];
static const uchar zeros[8]; static const uint8_t zeros[8];
DATA_BLOB chall = data_blob_talloc(samlogon_state->mem_ctx, zeros, sizeof(zeros)); DATA_BLOB chall = data_blob_talloc(samlogon_state->mem_ctx, zeros, sizeof(zeros));
ZERO_STRUCT(user_session_key); ZERO_STRUCT(user_session_key);

View File

@ -424,8 +424,8 @@ static BOOL rw_torture2(struct cli_state *c1, struct cli_state *c2)
int fnum1; int fnum1;
int fnum2; int fnum2;
int i; int i;
uchar buf[131072]; uint8_t buf[131072];
uchar buf_rd[131072]; uint8_t buf_rd[131072];
BOOL correct = True; BOOL correct = True;
ssize_t bytes_read, bytes_written; ssize_t bytes_read, bytes_written;

View File

@ -45,7 +45,7 @@
int net_rpc_join_ok(const char *domain) int net_rpc_join_ok(const char *domain)
{ {
struct cli_state *cli; struct cli_state *cli;
uchar stored_md4_trust_password[16]; uint8_t stored_md4_trust_password[16];
int retval = 1; int retval = 1;
uint32_t channel; uint32_t channel;
NTSTATUS result; NTSTATUS result;
@ -121,7 +121,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
char *clear_trust_password = NULL; char *clear_trust_password = NULL;
fstring ucs2_trust_password; fstring ucs2_trust_password;
int ucs2_pw_len; int ucs2_pw_len;
uchar pwbuf[516], sess_key[16]; uint8_t pwbuf[516], sess_key[16];
SAM_USERINFO_CTR ctr; SAM_USERINFO_CTR ctr;
SAM_USER_INFO_24 p24; SAM_USER_INFO_24 p24;
SAM_USER_INFO_10 p10; SAM_USER_INFO_10 p10;

View File

@ -55,8 +55,8 @@ static void display_alias_mem(uint32_t rid, SAM_ALIAS_MEM_INFO *a)
static void display_account_info(uint32_t rid, SAM_ACCOUNT_INFO *a) static void display_account_info(uint32_t rid, SAM_ACCOUNT_INFO *a)
{ {
fstring hex_nt_passwd, hex_lm_passwd; fstring hex_nt_passwd, hex_lm_passwd;
uchar lm_passwd[16], nt_passwd[16]; uint8_t lm_passwd[16], nt_passwd[16];
static uchar zero_buf[16]; static uint8_t zero_buf[16];
/* Decode hashes from password hash (if they are not NULL) */ /* Decode hashes from password hash (if they are not NULL) */
@ -153,7 +153,7 @@ int rpc_samdump(int argc, const char **argv)
{ {
NTSTATUS result; NTSTATUS result;
struct cli_state *cli = NULL; struct cli_state *cli = NULL;
uchar trust_password[16]; uint8_t trust_password[16];
DOM_CRED ret_creds; DOM_CRED ret_creds;
uint32_t neg_flags = 0x000001ff; uint32_t neg_flags = 0x000001ff;
@ -202,8 +202,8 @@ static NTSTATUS
sam_account_from_delta(SAM_ACCOUNT *account, SAM_ACCOUNT_INFO *delta) sam_account_from_delta(SAM_ACCOUNT *account, SAM_ACCOUNT_INFO *delta)
{ {
fstring s; fstring s;
uchar lm_passwd[16], nt_passwd[16]; uint8_t lm_passwd[16], nt_passwd[16];
static uchar zero_buf[16]; static uint8_t zero_buf[16];
/* Username, fullname, home dir, dir drive, logon script, acct /* Username, fullname, home dir, dir drive, logon script, acct
desc, workstations, profile. */ desc, workstations, profile. */
@ -673,7 +673,7 @@ int rpc_vampire(int argc, const char **argv)
{ {
NTSTATUS result; NTSTATUS result;
struct cli_state *cli = NULL; struct cli_state *cli = NULL;
uchar trust_password[16]; uint8_t trust_password[16];
DOM_CRED ret_creds; DOM_CRED ret_creds;
uint32_t neg_flags = 0x000001ff; uint32_t neg_flags = 0x000001ff;
DOM_SID dom_sid; DOM_SID dom_sid;