summaryrefslogtreecommitdiff
path: root/source4/libcli/util
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-05-29 08:11:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:21 -0500
commit45e93c19ef95978f908f5b14962770510634cd3b (patch)
tree79e3dd4cb4154b6a90ceaa5fe8d56413a02ebf0e /source4/libcli/util
parentd9538e7412c593a9dc10a600676939d2cf0205ea (diff)
downloadsamba-45e93c19ef95978f908f5b14962770510634cd3b.tar.gz
samba-45e93c19ef95978f908f5b14962770510634cd3b.tar.bz2
samba-45e93c19ef95978f908f5b14962770510634cd3b.zip
r943: change samba4 to use 'uint8_t' instead of 'unsigned char'
metze (This used to be commit b5378803fdcb3b3afe7c2932a38828e83470f61a)
Diffstat (limited to 'source4/libcli/util')
-rw-r--r--source4/libcli/util/smbdes.c48
-rw-r--r--source4/libcli/util/smbencrypt.c14
2 files changed, 31 insertions, 31 deletions
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