fix compiler warnings

This commit is contained in:
Daniel Stenberg
2006-12-21 14:20:20 +00:00
parent c92d1a5a23
commit 036bb51421
3 changed files with 23 additions and 12 deletions

View File

@@ -235,18 +235,22 @@ static int libssh2_kex_method_diffie_hellman_groupGP_sha1_key_exchange(LIBSSH2_S
SHA1_Init(&exchange_hash);
if (session->local.banner) {
libssh2_htonu32(h_sig_comp, strlen(session->local.banner) - 2);
SHA1_Update(&exchange_hash, h_sig_comp, 4);
SHA1_Update(&exchange_hash, session->local.banner, strlen(session->local.banner) - 2);
libssh2_htonu32(h_sig_comp,
strlen((char *)session->local.banner) - 2);
SHA1_Update(&exchange_hash, h_sig_comp, 4);
SHA1_Update(&exchange_hash, (char *)session->local.banner,
strlen((char *)session->local.banner) - 2);
} else {
libssh2_htonu32(h_sig_comp, sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1);
SHA1_Update(&exchange_hash, h_sig_comp, 4);
SHA1_Update(&exchange_hash, LIBSSH2_SSH_DEFAULT_BANNER, sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1);
SHA1_Update(&exchange_hash, h_sig_comp, 4);
SHA1_Update(&exchange_hash, LIBSSH2_SSH_DEFAULT_BANNER,
sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1);
}
libssh2_htonu32(h_sig_comp, strlen(session->remote.banner));
SHA1_Update(&exchange_hash, h_sig_comp, 4);
SHA1_Update(&exchange_hash, session->remote.banner, strlen(session->remote.banner));
libssh2_htonu32(h_sig_comp, strlen((char *)session->remote.banner));
SHA1_Update(&exchange_hash, h_sig_comp, 4);
SHA1_Update(&exchange_hash, session->remote.banner,
strlen((char *)session->remote.banner));
libssh2_htonu32(h_sig_comp, session->local.kexinit_len);
SHA1_Update(&exchange_hash, h_sig_comp, 4);
@@ -998,7 +1002,10 @@ static int libssh2_kex_agree_kex_hostkey(LIBSSH2_SESSION *session, unsigned char
/* {{{ libssh2_kex_agree_crypt
* Agree on a cipher algo
*/
static int libssh2_kex_agree_crypt(LIBSSH2_SESSION *session, libssh2_endpoint_data *endpoint, unsigned char *crypt, unsigned long crypt_len)
static int libssh2_kex_agree_crypt(LIBSSH2_SESSION *session,
libssh2_endpoint_data *endpoint,
unsigned char *crypt,
unsigned long crypt_len)
{
LIBSSH2_CRYPT_METHOD **cryptp = libssh2_crypt_methods();
unsigned char *s;
@@ -1011,7 +1018,8 @@ static int libssh2_kex_agree_crypt(LIBSSH2_SESSION *session, libssh2_endpoint_da
int method_len = (p ? (p - s) : strlen(s));
if (libssh2_kex_agree_instr(crypt, crypt_len, s, method_len)) {
LIBSSH2_CRYPT_METHOD *method = (LIBSSH2_CRYPT_METHOD*)libssh2_get_method_by_name(s, method_len, (LIBSSH2_COMMON_METHOD**)cryptp);
LIBSSH2_CRYPT_METHOD *method =
(LIBSSH2_CRYPT_METHOD*)libssh2_get_method_by_name(s, method_len, (LIBSSH2_COMMON_METHOD**)cryptp);
if (!method) {
/* Invalid method -- Should never be reached */

View File

@@ -68,6 +68,7 @@ static int libssh2_mac_method_common_init(LIBSSH2_SESSION *session, unsigned cha
{
*abstract = key;
*free_key = 0;
(void)session;
return 0;
}
@@ -96,6 +97,7 @@ static int libssh2_mac_method_hmac_sha1_hash(LIBSSH2_SESSION *session, unsigned
{
HMAC_CTX ctx;
unsigned char seqno_buf[4];
(void)session;
libssh2_htonu32(seqno_buf, seqno);

View File

@@ -133,12 +133,13 @@ LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **data, uns
short v;
int i = 0, len = 0;
*data = d = LIBSSH2_ALLOC(session, (3 * src_len / 4) + 1);
*data = LIBSSH2_ALLOC(session, (3 * src_len / 4) + 1);
d = (unsigned char *)*data;
if (!d) {
return -1;
}
for(s = src; ((char*)s) < (src + src_len); s++) {
for(s = (unsigned char *)src; ((char*)s) < (src + src_len); s++) {
if ((v = libssh2_base64_reverse_table[*s]) < 0) continue;
switch (i % 4) {
case 0: