From a139ab0b450c95dfccffcd8b0ad01cfc3720ce5c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 23 Jan 2007 21:36:40 +0000 Subject: [PATCH] fix compiler warnings --- src/libssh2_priv.h | 6 +++--- src/mac.c | 18 ++++++++++-------- src/openssl.c | 5 +++++ src/pem.c | 6 +++--- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index 8f971d6..400c88d 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -474,8 +474,8 @@ int _libssh2_pem_parse (LIBSSH2_SESSION *session, const char *headerend, FILE *fp, char **data, unsigned int *datalen); -int _libssh2_pem_decode_sequence (char **data, unsigned int *datalen); -int _libssh2_pem_decode_integer (char **data, unsigned int *datalen, - char **i, unsigned int *ilen); +int _libssh2_pem_decode_sequence (unsigned char **data, unsigned int *datalen); +int _libssh2_pem_decode_integer (unsigned char **data, unsigned int *datalen, + unsigned char **i, unsigned int *ilen); #endif /* LIBSSH2_H */ diff --git a/src/mac.c b/src/mac.c index cc03070..56bc066 100644 --- a/src/mac.c +++ b/src/mac.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2006, Sara Golemon +/* Copyright (c) 2004-2007, Sara Golemon * All rights reserved. * * Redistribution and use in source and binary forms, @@ -37,7 +37,7 @@ #include "libssh2_priv.h" -#if LIBSSH2_MAC_NONE +#ifdef LIBSSH2_MAC_NONE /* {{{ libssh2_mac_none_MAC * Minimalist MAC: No MAC */ @@ -129,10 +129,10 @@ static int libssh2_mac_method_hmac_sha1_96_hash(LIBSSH2_SESSION *session, unsign const unsigned char *packet, unsigned long packet_len, const unsigned char *addtl, unsigned long addtl_len, void **abstract) { - char temp[SHA_DIGEST_LENGTH]; + unsigned char temp[SHA_DIGEST_LENGTH]; libssh2_mac_method_hmac_sha1_hash(session, temp, seqno, packet, packet_len, addtl, addtl_len, abstract); - memcpy(buf, temp, 96 / 8); + memcpy(buf, (char *)temp, 96 / 8); return 0; } @@ -156,6 +156,7 @@ static int libssh2_mac_method_hmac_md5_hash(LIBSSH2_SESSION *session, unsigned c { libssh2_hmac_ctx ctx; unsigned char seqno_buf[4]; + (void)session; libssh2_htonu32(seqno_buf, seqno); @@ -188,10 +189,10 @@ static int libssh2_mac_method_hmac_md5_96_hash(LIBSSH2_SESSION *session, unsigne const unsigned char *packet, unsigned long packet_len, const unsigned char *addtl, unsigned long addtl_len, void **abstract) { - char temp[MD5_DIGEST_LENGTH]; + unsigned char temp[MD5_DIGEST_LENGTH]; libssh2_mac_method_hmac_md5_hash(session, temp, seqno, packet, packet_len, addtl, addtl_len, abstract); - memcpy(buf, temp, 96 / 8); + memcpy(buf, (char *)temp, 96 / 8); return 0; } @@ -216,6 +217,7 @@ static int libssh2_mac_method_hmac_ripemd160_hash(LIBSSH2_SESSION *session, unsi { libssh2_hmac_ctx ctx; unsigned char seqno_buf[4]; + (void)session; libssh2_htonu32(seqno_buf, seqno); @@ -256,11 +258,11 @@ static LIBSSH2_MAC_METHOD *_libssh2_mac_methods[] = { &libssh2_mac_method_hmac_sha1_96, &libssh2_mac_method_hmac_md5, &libssh2_mac_method_hmac_md5_96, -#if LIBSSH2_HMAC_RIPEMD +#ifdef LIBSSH2_HMAC_RIPEMD &libssh2_mac_method_hmac_ripemd160, &libssh2_mac_method_hmac_ripemd160_openssh_com, #endif /* LIBSSH2_HMAC_RIPEMD */ -#if LIBSSH2_MAC_NONE +#ifdef LIBSSH2_MAC_NONE &libssh2_mac_method_none, #endif /* LIBSSH2_MAC_NONE */ NULL diff --git a/src/openssl.c b/src/openssl.c index f53ffae..1688098 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -176,6 +176,8 @@ int _libssh2_cipher_crypt(_libssh2_cipher_ctx *ctx, int blocksize = ctx->cipher->block_size; unsigned char buf[EVP_MAX_BLOCK_LENGTH]; int ret; + (void)algo; + (void)encrypt; if (blocksize == 1) { /* Hack for arcfour. */ @@ -212,6 +214,7 @@ int _libssh2_rsa_new_private (libssh2_rsa_ctx **rsa, FILE *fp, unsigned const char *passphrase) { + (void)session; if (!EVP_get_cipherbyname("des")) { /* If this cipher isn't loaded it's a pretty good indication that none are. * I have *NO DOUBT* that there's a better way to deal with this ($#&%#$(%$#( @@ -232,6 +235,7 @@ int _libssh2_dsa_new_private (libssh2_dsa_ctx **dsa, FILE *fp, unsigned const char *passphrase) { + (void)session; if (!EVP_get_cipherbyname("des")) { /* If this cipher isn't loaded it's a pretty good indication that none are. * I have *NO DOUBT* that there's a better way to deal with this ($#&%#$(%$#( @@ -285,6 +289,7 @@ int _libssh2_dsa_sha1_sign(libssh2_dsa_ctx *dsactx, { DSA_SIG *sig; int r_len, s_len, rs_pad; + (void)hash_len; sig = DSA_do_sign(hash, SHA_DIGEST_LENGTH, dsactx); if (!sig) { diff --git a/src/pem.c b/src/pem.c index 82d7d60..03a907d 100644 --- a/src/pem.c +++ b/src/pem.c @@ -161,7 +161,7 @@ static int read_asn1_length (const unsigned char *data, return nextpos; } -int _libssh2_pem_decode_sequence (char **data, unsigned int *datalen) +int _libssh2_pem_decode_sequence (unsigned char **data, unsigned int *datalen) { unsigned int len; int lenlen; @@ -191,8 +191,8 @@ int _libssh2_pem_decode_sequence (char **data, unsigned int *datalen) return 0; } -int _libssh2_pem_decode_integer (char **data, unsigned int *datalen, - char **i, unsigned int *ilen) +int _libssh2_pem_decode_integer (unsigned char **data, unsigned int *datalen, + unsigned char **i, unsigned int *ilen) { unsigned int len; int lenlen;