Commit fb698a60 authored by Pekka Pessi's avatar Pekka Pessi

Removed warnings on 64bit platforms.

darcs-hash:20060313195238-65a35-458275dcc4e0781902437c82c474d5d9180ea0d2.gz
parent 75166320
......@@ -717,7 +717,7 @@ int soa_set_capability_sdp(soa_session_t *ss,
{
SU_DEBUG_9(("soa_set_capability_sdp(%s::%p, %p, %p, %d) called\n",
ss ? ss->ss_actions->soa_name : "", ss, sdp, str,
str && len == -1 ? strlen(str) : len));
str && len == -1 ? (int)strlen(str) : len));
return soa_set_sdp(ss, soa_capability_sdp_kind, sdp, str, len);
}
......@@ -818,7 +818,7 @@ int soa_set_user_sdp(soa_session_t *ss,
{
SU_DEBUG_9(("soa_set_user_sdp(%s::%p, %p, %p, %d) called\n",
ss ? ss->ss_actions->soa_name : "", ss, sdp, str,
str && len == -1 ? strlen(str) : len));
str && len == -1 ? (int)strlen(str) : len));
return soa_set_sdp(ss, soa_user_sdp_kind, sdp, str, len);
}
......@@ -884,7 +884,7 @@ int soa_set_remote_sdp(soa_session_t *ss,
{
SU_DEBUG_9(("soa_set_remote_sdp(%s::%p, %p, %p, %d) called\n",
ss ? ss->ss_actions->soa_name : "", ss, sdp, str,
str && len == -1 ? strlen(str) : len));
str && len == -1 ? (int)strlen(str) : len));
return soa_set_sdp(ss, soa_remote_sdp_kind, sdp, str, len);
}
......
......@@ -410,21 +410,32 @@ int stun_encode_message_integrity(stun_attr_t *attr,
int len,
stun_buffer_t *pwd) {
int padded_len;
size_t dig_len;
unsigned char *padded_text;
unsigned int dig_len;
unsigned char *padded_text = NULL;
void *sha1_hmac;
if (stun_encode_type_len(attr, 20) < 0) {
return -1;
}
/* zero padding */
padded_len = len + (len % 64 == 0 ? 0 : 64 - (len % 64));
padded_text = (unsigned char *) malloc(padded_len);
memset(padded_text, 0, padded_len);
memcpy(padded_text, buf, len);
if (len % 64 == 0) {
void *sha_hmac;
padded_len = len + (64 - (len % 64));
padded_text = (unsigned char *) malloc(padded_len);
memcpy(padded_text, buf, len);
memset(padded_text + len, 0, padded_len - len);
sha1_hmac = HMAC(EVP_sha1(), pwd->data, pwd->size, padded_text, padded_len, NULL, &dig_len);
}
else {
sha1_hmac = HMAC(EVP_sha1(), pwd->data, pwd->size, buf, len, NULL, &dig_len);
}
memcpy(attr->enc_buf.data+4, HMAC(EVP_sha1(), pwd->data, pwd->size, padded_text, padded_len, NULL, &dig_len), 20);
assert(dig_len == 20);
memcpy(attr->enc_buf.data + 4, sha1_hmac, 20);
free(padded_text);
return attr->enc_buf.size;
}
......@@ -459,7 +470,7 @@ int stun_validate_message_integrity(stun_msg_t *msg, stun_buffer_t *pwd)
{
int padded_len, len;
size_t dig_len;
unsigned int dig_len;
unsigned char dig[20]; /* received sha1 digest */
unsigned char *padded_text;
......
......@@ -143,7 +143,7 @@ int main(int argc, char *argv[])
char *s;
int use_t1 = 0;
su_time_t now, started;
int i, N;
intptr_t i, N;
struct timing timing[1] = {{ 0 }};
struct tester tester[1] = {{ 0 }};
......@@ -220,7 +220,6 @@ int main(int argc, char *argv[])
return 1;
}
/* Insert 500 timers in order */
timers = calloc(N = 500, sizeof *timers);
if (!timers) { perror("calloc"); exit(1); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment