fix compiler warnings
This commit is contained in:
28
src/kex.c
28
src/kex.c
@@ -235,18 +235,22 @@ static int libssh2_kex_method_diffie_hellman_groupGP_sha1_key_exchange(LIBSSH2_S
|
|||||||
|
|
||||||
SHA1_Init(&exchange_hash);
|
SHA1_Init(&exchange_hash);
|
||||||
if (session->local.banner) {
|
if (session->local.banner) {
|
||||||
libssh2_htonu32(h_sig_comp, strlen(session->local.banner) - 2);
|
libssh2_htonu32(h_sig_comp,
|
||||||
SHA1_Update(&exchange_hash, h_sig_comp, 4);
|
strlen((char *)session->local.banner) - 2);
|
||||||
SHA1_Update(&exchange_hash, session->local.banner, strlen(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 {
|
} else {
|
||||||
libssh2_htonu32(h_sig_comp, sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1);
|
libssh2_htonu32(h_sig_comp, sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1);
|
||||||
SHA1_Update(&exchange_hash, h_sig_comp, 4);
|
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, LIBSSH2_SSH_DEFAULT_BANNER,
|
||||||
|
sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
libssh2_htonu32(h_sig_comp, 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, h_sig_comp, 4);
|
||||||
SHA1_Update(&exchange_hash, session->remote.banner, strlen(session->remote.banner));
|
SHA1_Update(&exchange_hash, session->remote.banner,
|
||||||
|
strlen((char *)session->remote.banner));
|
||||||
|
|
||||||
libssh2_htonu32(h_sig_comp, session->local.kexinit_len);
|
libssh2_htonu32(h_sig_comp, session->local.kexinit_len);
|
||||||
SHA1_Update(&exchange_hash, h_sig_comp, 4);
|
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
|
/* {{{ libssh2_kex_agree_crypt
|
||||||
* Agree on a cipher algo
|
* 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();
|
LIBSSH2_CRYPT_METHOD **cryptp = libssh2_crypt_methods();
|
||||||
unsigned char *s;
|
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));
|
int method_len = (p ? (p - s) : strlen(s));
|
||||||
|
|
||||||
if (libssh2_kex_agree_instr(crypt, crypt_len, s, method_len)) {
|
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) {
|
if (!method) {
|
||||||
/* Invalid method -- Should never be reached */
|
/* Invalid method -- Should never be reached */
|
||||||
|
@@ -68,6 +68,7 @@ static int libssh2_mac_method_common_init(LIBSSH2_SESSION *session, unsigned cha
|
|||||||
{
|
{
|
||||||
*abstract = key;
|
*abstract = key;
|
||||||
*free_key = 0;
|
*free_key = 0;
|
||||||
|
(void)session;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -96,6 +97,7 @@ static int libssh2_mac_method_hmac_sha1_hash(LIBSSH2_SESSION *session, unsigned
|
|||||||
{
|
{
|
||||||
HMAC_CTX ctx;
|
HMAC_CTX ctx;
|
||||||
unsigned char seqno_buf[4];
|
unsigned char seqno_buf[4];
|
||||||
|
(void)session;
|
||||||
|
|
||||||
libssh2_htonu32(seqno_buf, seqno);
|
libssh2_htonu32(seqno_buf, seqno);
|
||||||
|
|
||||||
|
@@ -133,12 +133,13 @@ LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **data, uns
|
|||||||
short v;
|
short v;
|
||||||
int i = 0, len = 0;
|
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) {
|
if (!d) {
|
||||||
return -1;
|
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;
|
if ((v = libssh2_base64_reverse_table[*s]) < 0) continue;
|
||||||
switch (i % 4) {
|
switch (i % 4) {
|
||||||
case 0:
|
case 0:
|
||||||
|
Reference in New Issue
Block a user