From 45e93c19ef95978f908f5b14962770510634cd3b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 29 May 2004 08:11:46 +0000 Subject: r943: change samba4 to use 'uint8_t' instead of 'unsigned char' metze (This used to be commit b5378803fdcb3b3afe7c2932a38828e83470f61a) --- source4/libcli/auth/ntlm_check.c | 6 ++--- source4/libcli/auth/ntlmssp.h | 10 ++++---- source4/libcli/auth/ntlmssp_sign.c | 22 ++++++++--------- source4/libcli/clifile.c | 2 +- source4/libcli/raw/smb_signing.c | 8 +++---- source4/libcli/util/smbdes.c | 48 +++++++++++++++++++------------------- source4/libcli/util/smbencrypt.c | 14 +++++------ 7 files changed, 55 insertions(+), 55 deletions(-) (limited to 'source4/libcli') diff --git a/source4/libcli/auth/ntlm_check.c b/source4/libcli/auth/ntlm_check.c index a3b92752aa..cdb092d1b5 100644 --- a/source4/libcli/auth/ntlm_check.c +++ b/source4/libcli/auth/ntlm_check.c @@ -178,7 +178,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, DATA_BLOB *user_sess_key, DATA_BLOB *lm_sess_key) { - static const unsigned char zeros[8]; + static const uint8_t zeros[8]; if (nt_pw == NULL) { DEBUG(3,("ntlm_password_check: NO NT password stored for user %s.\n", username)); @@ -232,7 +232,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, DEBUG(4,("ntlm_password_check: checking plaintext passwords for user %s\n", username)); if (nt_pw && nt_response->length) { - unsigned char pwhash[16]; + uint8_t pwhash[16]; mdfour(pwhash, nt_response->data, nt_response->length); if (memcmp(pwhash, nt_pw, sizeof(pwhash)) == 0) { return NT_STATUS_OK; @@ -255,7 +255,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, /* Only the fisrt 14 chars are considered, password need not be null terminated. */ /* we *might* need to upper-case the string here */ - E_P16((const unsigned char *)dospwd, p16); + E_P16((const uint8_t *)dospwd, p16); if (memcmp(p16, lm_pw, sizeof(p16)) == 0) { return NT_STATUS_OK; diff --git a/source4/libcli/auth/ntlmssp.h b/source4/libcli/auth/ntlmssp.h index a5565888f1..968911fef5 100644 --- a/source4/libcli/auth/ntlmssp.h +++ b/source4/libcli/auth/ntlmssp.h @@ -171,13 +171,13 @@ typedef struct ntlmssp_state char recv_sign_key[16]; char recv_seal_key[16]; - unsigned char send_sign_hash[258]; - unsigned char send_seal_hash[258]; - unsigned char recv_sign_hash[258]; - unsigned char recv_seal_hash[258]; + uint8_t send_sign_hash[258]; + uint8_t send_seal_hash[258]; + uint8_t recv_sign_hash[258]; + uint8_t recv_seal_hash[258]; /* ntlmv1 */ - unsigned char ntlmssp_hash[258]; + uint8_t ntlmssp_hash[258]; /* it turns out that we don't always get the response in at the time we want to process it. diff --git a/source4/libcli/auth/ntlmssp_sign.c b/source4/libcli/auth/ntlmssp_sign.c index df7bddcd38..22aa877b63 100644 --- a/source4/libcli/auth/ntlmssp_sign.c +++ b/source4/libcli/auth/ntlmssp_sign.c @@ -27,16 +27,16 @@ #define SRV_SIGN "session key to server-to-client signing key magic constant" #define SRV_SEAL "session key to server-to-client sealing key magic constant" -static void NTLMSSPcalc_ap( unsigned char *hash, unsigned char *data, int len) +static void NTLMSSPcalc_ap( uint8_t *hash, uint8_t *data, int len) { - unsigned char index_i = hash[256]; - unsigned char index_j = hash[257]; + uint8_t index_i = hash[256]; + uint8_t index_j = hash[257]; int ind; for (ind = 0; ind < len; ind++) { - unsigned char tc; - unsigned char t; + uint8_t tc; + uint8_t t; index_i++; index_j += hash[index_i]; @@ -53,19 +53,19 @@ static void NTLMSSPcalc_ap( unsigned char *hash, unsigned char *data, int len) hash[257] = index_j; } -static void calc_hash(unsigned char hash[258], const char *key, size_t key_len) +static void calc_hash(uint8_t hash[258], const char *key, size_t key_len) { - unsigned char j = 0; + uint8_t j = 0; int ind; for (ind = 0; ind < 256; ind++) { - hash[ind] = (unsigned char)ind; + hash[ind] = (uint8_t)ind; } for (ind = 0; ind < 256; ind++) { - unsigned char tc; + uint8_t tc; j += (hash[ind] + key[ind%key_len]); @@ -97,7 +97,7 @@ static void calc_hash(unsigned char hash[258], const char *key, size_t key_len) -static void calc_ntlmv2_hash(unsigned char hash[258], unsigned char subkey[16], +static void calc_ntlmv2_hash(uint8_t hash[258], uint8_t subkey[16], DATA_BLOB session_key, const char *constant) { @@ -365,7 +365,7 @@ NTSTATUS ntlmssp_unseal_packet(NTLMSSP_STATE *ntlmssp_state, */ NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state) { - unsigned char p24[24]; + uint8_t p24[24]; ZERO_STRUCT(p24); DEBUG(3, ("NTLMSSP Sign/Seal - Initialising with flags:\n")); diff --git a/source4/libcli/clifile.c b/source4/libcli/clifile.c index d1f9145e44..23f3cdc4a4 100644 --- a/source4/libcli/clifile.c +++ b/source4/libcli/clifile.c @@ -348,7 +348,7 @@ NTSTATUS cli_close(struct cli_tree *tree, int fnum) ****************************************************************************/ NTSTATUS cli_locktype(struct cli_tree *tree, int fnum, uint32_t offset, uint32_t len, int timeout, - unsigned char locktype) + uint8_t locktype) { union smb_lock parms; struct smb_lock_entry lock[1]; diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c index 989b5527aa..c82946ac53 100644 --- a/source4/libcli/raw/smb_signing.c +++ b/source4/libcli/raw/smb_signing.c @@ -98,7 +98,7 @@ static BOOL signing_good(struct cli_request *req, BOOL good) ************************************************************/ static void cli_request_simple_sign_outgoing_message(struct cli_request *req) { - unsigned char calc_md5_mac[16]; + uint8_t calc_md5_mac[16]; struct MD5Context md5_ctx; struct smb_basic_signing_context *data = req->transport->negotiate.sign_info.signing_context; @@ -150,9 +150,9 @@ static void cli_request_simple_sign_outgoing_message(struct cli_request *req) static BOOL cli_request_simple_check_incoming_message(struct cli_request *req) { BOOL good; - unsigned char calc_md5_mac[16]; - unsigned char server_sent_mac[8]; - unsigned char sequence_buf[8]; + uint8_t calc_md5_mac[16]; + uint8_t server_sent_mac[8]; + uint8_t sequence_buf[8]; struct MD5Context md5_ctx; struct smb_basic_signing_context *data = req->transport->negotiate.sign_info.signing_context; const size_t offset_end_of_sig = (HDR_SS_FIELD + 8); diff --git a/source4/libcli/util/smbdes.c b/source4/libcli/util/smbdes.c index 22bafcb449..b0efdec157 100644 --- a/source4/libcli/util/smbdes.c +++ b/source4/libcli/util/smbdes.c @@ -258,7 +258,7 @@ static void dohash(char *out, char *in, char *key, int forw) permute(out, rl, perm6, 64); } -static void str_to_key(const unsigned char *str,unsigned char *key) +static void str_to_key(const uint8_t *str,uint8_t *key) { int i; @@ -276,13 +276,13 @@ static void str_to_key(const unsigned char *str,unsigned char *key) } -void smbhash(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw) +void smbhash(uint8_t *out, const uint8_t *in, const uint8_t *key, int forw) { int i; char outb[64]; char inb[64]; char keyb[64]; - unsigned char key2[8]; + uint8_t key2[8]; str_to_key(key, key2); @@ -304,53 +304,53 @@ void smbhash(unsigned char *out, const unsigned char *in, const unsigned char *k } } -void E_P16(const unsigned char *p14,unsigned char *p16) +void E_P16(const uint8_t *p14,uint8_t *p16) { unsigned const char sp8[8] = {0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25}; smbhash(p16, sp8, p14, 1); smbhash(p16+8, sp8, p14+7, 1); } -void E_P24(const unsigned char *p21, const unsigned char *c8, unsigned char *p24) +void E_P24(const uint8_t *p21, const uint8_t *c8, uint8_t *p24) { smbhash(p24, c8, p21, 1); smbhash(p24+8, c8, p21+7, 1); smbhash(p24+16, c8, p21+14, 1); } -void D_P16(const unsigned char *p14, const unsigned char *in, unsigned char *out) +void D_P16(const uint8_t *p14, const uint8_t *in, uint8_t *out) { smbhash(out, in, p14, 0); smbhash(out+8, in+8, p14+7, 0); } -void E_old_pw_hash( unsigned char *p14, const unsigned char *in, unsigned char *out) +void E_old_pw_hash( uint8_t *p14, const uint8_t *in, uint8_t *out) { smbhash(out, in, p14, 1); smbhash(out+8, in+8, p14+7, 1); } -void cred_hash1(unsigned char *out, const unsigned char *in, const unsigned char *key) +void cred_hash1(uint8_t *out, const uint8_t *in, const uint8_t *key) { - unsigned char buf[8]; + uint8_t buf[8]; smbhash(buf, in, key, 1); smbhash(out, buf, key+9, 1); } -void cred_hash2(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw) +void cred_hash2(uint8_t *out, const uint8_t *in, const uint8_t *key, int forw) { - unsigned char buf[8]; - unsigned char key2[8]; + uint8_t buf[8]; + uint8_t key2[8]; ZERO_STRUCT(key2); smbhash(buf, in, key, forw); key2[0] = key[7]; smbhash(out, buf, key2, forw); } -void cred_hash3(unsigned char *out, unsigned char *in, const unsigned char *key, int forw) +void cred_hash3(uint8_t *out, uint8_t *in, const uint8_t *key, int forw) { - unsigned char key2[8]; + uint8_t key2[8]; ZERO_STRUCT(key2); smbhash(out, in, key, forw); key2[0] = key[7]; @@ -358,20 +358,20 @@ void cred_hash3(unsigned char *out, unsigned char *in, const unsigned char *key, } -void SamOEMhashBlob(unsigned char *data, int len, const DATA_BLOB *key) +void SamOEMhashBlob(uint8_t *data, int len, const DATA_BLOB *key) { - unsigned char s_box[256]; - unsigned char index_i = 0; - unsigned char index_j = 0; - unsigned char j = 0; + uint8_t s_box[256]; + uint8_t index_i = 0; + uint8_t index_j = 0; + uint8_t j = 0; int ind; for (ind = 0; ind < 256; ind++) { - s_box[ind] = (unsigned char)ind; + s_box[ind] = (uint8_t)ind; } for (ind = 0; ind < 256; ind++) { - unsigned char tc; + uint8_t tc; j += (s_box[ind] + key->data[ind%key->length]); @@ -380,8 +380,8 @@ void SamOEMhashBlob(unsigned char *data, int len, const DATA_BLOB *key) s_box[j] = tc; } for (ind = 0; ind < len; ind++) { - unsigned char tc; - unsigned char t; + uint8_t tc; + uint8_t t; index_i++; index_j += s_box[index_i]; @@ -399,7 +399,7 @@ void SamOEMhashBlob(unsigned char *data, int len, const DATA_BLOB *key) a varient that assumes a 16 byte key. This should be removed when the last user is gone */ -void SamOEMhash(unsigned char *data, const unsigned char keystr[16], int len) +void SamOEMhash(uint8_t *data, const uint8_t keystr[16], int len) { DATA_BLOB key = data_blob(keystr, 16); diff --git a/source4/libcli/util/smbencrypt.c b/source4/libcli/util/smbencrypt.c index 5b210394c1..d52d24e1e1 100644 --- a/source4/libcli/util/smbencrypt.c +++ b/source4/libcli/util/smbencrypt.c @@ -68,7 +68,7 @@ void E_md4hash(const char *passwd, uchar p16[16]) /* Calculate length in bytes */ len = strlen_w(wpwd) * sizeof(int16_t); - mdfour(p16, (unsigned char *)wpwd, len); + mdfour(p16, (uint8_t *)wpwd, len); ZERO_STRUCT(wpwd); } @@ -90,7 +90,7 @@ BOOL E_deshash(const char *passwd, uchar p16[16]) push_ascii(dospwd, passwd, sizeof(dospwd), STR_UPPER|STR_TERMINATE); /* Only the fisrt 14 chars are considered, password need not be null terminated. */ - E_P16((const unsigned char *)dospwd, p16); + E_P16((const uint8_t *)dospwd, p16); if (strlen(dospwd) > 14) { ret = False; @@ -170,8 +170,8 @@ BOOL ntv2_owf_gen(const uchar owf[16], domain_byte_len = domain_byte_len - 2; hmac_md5_init_limK_to_64(owf, 16, &ctx); - hmac_md5_update((const unsigned char *)user, user_byte_len, &ctx); - hmac_md5_update((const unsigned char *)domain, domain_byte_len, &ctx); + hmac_md5_update((const uint8_t *)user, user_byte_len, &ctx); + hmac_md5_update((const uint8_t *)domain, domain_byte_len, &ctx); hmac_md5_final(kr_buf, &ctx); #ifdef DEBUG_PASSWORD @@ -247,7 +247,7 @@ void SMBsesskeygen_ntv2(const uchar kr[16], hmac_md5_init_limK_to_64(kr, 16, &ctx); hmac_md5_update(nt_resp, 16, &ctx); - hmac_md5_final((unsigned char *)sess_key, &ctx); + hmac_md5_final((uint8_t *)sess_key, &ctx); #ifdef DEBUG_PASSWORD DEBUG(100, ("SMBsesskeygen_ntv2:\n")); @@ -260,7 +260,7 @@ void SMBsesskeygen_ntv1(const uchar kr[16], uint8_t sess_key[16]) /* yes, this session key does not change - yes, this is a problem - but it is 128 bits */ - mdfour((unsigned char *)sess_key, kr, 16); + mdfour((uint8_t *)sess_key, kr, 16); #ifdef DEBUG_PASSWORD DEBUG(100, ("SMBsesskeygen_ntv1:\n")); @@ -443,7 +443,7 @@ BOOL encode_pw_buffer(char buffer[516], const char *password, int string_flags) memcpy(&buffer[512 - new_pw_len], new_pw, new_pw_len); - generate_random_buffer((unsigned char *)buffer, 512 - new_pw_len, False); + generate_random_buffer((uint8_t *)buffer, 512 - new_pw_len, False); /* * The length of the new password is in the last 4 bytes of -- cgit