mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-11-03 22:13:11 +03:00 
			
		
		
		
	fix compiler warnings
This commit is contained in:
		@@ -474,8 +474,8 @@ int _libssh2_pem_parse (LIBSSH2_SESSION *session,
 | 
				
			|||||||
			const char *headerend,
 | 
								const char *headerend,
 | 
				
			||||||
			FILE *fp,
 | 
								FILE *fp,
 | 
				
			||||||
			char **data, unsigned int *datalen);
 | 
								char **data, unsigned int *datalen);
 | 
				
			||||||
int _libssh2_pem_decode_sequence (char **data, unsigned int *datalen);
 | 
					int _libssh2_pem_decode_sequence (unsigned char **data, unsigned int *datalen);
 | 
				
			||||||
int _libssh2_pem_decode_integer (char **data, unsigned int *datalen,
 | 
					int _libssh2_pem_decode_integer (unsigned char **data, unsigned int *datalen,
 | 
				
			||||||
				 char **i, unsigned int *ilen);
 | 
									 unsigned char **i, unsigned int *ilen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* LIBSSH2_H */
 | 
					#endif /* LIBSSH2_H */
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								src/mac.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/mac.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* Copyright (c) 2004-2006, Sara Golemon <sarag@libssh2.org>
 | 
					/* Copyright (c) 2004-2007, Sara Golemon <sarag@libssh2.org>
 | 
				
			||||||
 * All rights reserved.
 | 
					 * All rights reserved.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Redistribution and use in source and binary forms,
 | 
					 * Redistribution and use in source and binary forms,
 | 
				
			||||||
@@ -37,7 +37,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "libssh2_priv.h"
 | 
					#include "libssh2_priv.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if LIBSSH2_MAC_NONE
 | 
					#ifdef LIBSSH2_MAC_NONE
 | 
				
			||||||
/* {{{ libssh2_mac_none_MAC
 | 
					/* {{{ libssh2_mac_none_MAC
 | 
				
			||||||
 * Minimalist MAC: No 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 *packet, unsigned long packet_len, 
 | 
				
			||||||
																		  const unsigned char *addtl, unsigned long addtl_len, void **abstract)
 | 
																							  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);
 | 
						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;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -156,6 +156,7 @@ static int libssh2_mac_method_hmac_md5_hash(LIBSSH2_SESSION *session, unsigned c
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	libssh2_hmac_ctx ctx;
 | 
						libssh2_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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -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 *packet, unsigned long packet_len,
 | 
				
			||||||
																		 const unsigned char *addtl, unsigned long addtl_len, void **abstract)
 | 
																							 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);
 | 
						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;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -216,6 +217,7 @@ static int libssh2_mac_method_hmac_ripemd160_hash(LIBSSH2_SESSION *session, unsi
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	libssh2_hmac_ctx ctx;
 | 
						libssh2_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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -256,11 +258,11 @@ static LIBSSH2_MAC_METHOD *_libssh2_mac_methods[] = {
 | 
				
			|||||||
	&libssh2_mac_method_hmac_sha1_96,
 | 
						&libssh2_mac_method_hmac_sha1_96,
 | 
				
			||||||
	&libssh2_mac_method_hmac_md5,
 | 
						&libssh2_mac_method_hmac_md5,
 | 
				
			||||||
	&libssh2_mac_method_hmac_md5_96,
 | 
						&libssh2_mac_method_hmac_md5_96,
 | 
				
			||||||
#if LIBSSH2_HMAC_RIPEMD
 | 
					#ifdef LIBSSH2_HMAC_RIPEMD
 | 
				
			||||||
	&libssh2_mac_method_hmac_ripemd160,
 | 
						&libssh2_mac_method_hmac_ripemd160,
 | 
				
			||||||
	&libssh2_mac_method_hmac_ripemd160_openssh_com,
 | 
						&libssh2_mac_method_hmac_ripemd160_openssh_com,
 | 
				
			||||||
#endif /* LIBSSH2_HMAC_RIPEMD */
 | 
					#endif /* LIBSSH2_HMAC_RIPEMD */
 | 
				
			||||||
#if LIBSSH2_MAC_NONE
 | 
					#ifdef LIBSSH2_MAC_NONE
 | 
				
			||||||
	&libssh2_mac_method_none,
 | 
						&libssh2_mac_method_none,
 | 
				
			||||||
#endif /* LIBSSH2_MAC_NONE */
 | 
					#endif /* LIBSSH2_MAC_NONE */
 | 
				
			||||||
	NULL
 | 
						NULL
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -176,6 +176,8 @@ int _libssh2_cipher_crypt(_libssh2_cipher_ctx *ctx,
 | 
				
			|||||||
	int blocksize = ctx->cipher->block_size;
 | 
						int blocksize = ctx->cipher->block_size;
 | 
				
			||||||
	unsigned char buf[EVP_MAX_BLOCK_LENGTH];
 | 
						unsigned char buf[EVP_MAX_BLOCK_LENGTH];
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
						(void)algo;
 | 
				
			||||||
 | 
						(void)encrypt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (blocksize == 1) {
 | 
						if (blocksize == 1) {
 | 
				
			||||||
/* Hack for arcfour. */
 | 
					/* Hack for arcfour. */
 | 
				
			||||||
@@ -212,6 +214,7 @@ int _libssh2_rsa_new_private (libssh2_rsa_ctx **rsa,
 | 
				
			|||||||
			      FILE *fp,
 | 
								      FILE *fp,
 | 
				
			||||||
			      unsigned const char *passphrase)
 | 
								      unsigned const char *passphrase)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						(void)session;
 | 
				
			||||||
	if (!EVP_get_cipherbyname("des")) {
 | 
						if (!EVP_get_cipherbyname("des")) {
 | 
				
			||||||
/* If this cipher isn't loaded it's a pretty good indication that none are.
 | 
					/* 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 ($#&%#$(%$#(
 | 
					 * 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,
 | 
								      FILE *fp,
 | 
				
			||||||
			      unsigned const char *passphrase)
 | 
								      unsigned const char *passphrase)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						(void)session;
 | 
				
			||||||
	if (!EVP_get_cipherbyname("des")) {
 | 
						if (!EVP_get_cipherbyname("des")) {
 | 
				
			||||||
/* If this cipher isn't loaded it's a pretty good indication that none are.
 | 
					/* 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 ($#&%#$(%$#(
 | 
					 * 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;
 | 
						DSA_SIG *sig;
 | 
				
			||||||
	int r_len, s_len, rs_pad;
 | 
						int r_len, s_len, rs_pad;
 | 
				
			||||||
 | 
						(void)hash_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sig = DSA_do_sign(hash, SHA_DIGEST_LENGTH, dsactx);
 | 
						sig = DSA_do_sign(hash, SHA_DIGEST_LENGTH, dsactx);
 | 
				
			||||||
	if (!sig) {
 | 
						if (!sig) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -161,7 +161,7 @@ static int read_asn1_length (const unsigned char *data,
 | 
				
			|||||||
	return nextpos;
 | 
						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;
 | 
						unsigned int len;
 | 
				
			||||||
	int lenlen;
 | 
						int lenlen;
 | 
				
			||||||
@@ -191,8 +191,8 @@ int _libssh2_pem_decode_sequence (char **data, unsigned int *datalen)
 | 
				
			|||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int _libssh2_pem_decode_integer (char **data, unsigned int *datalen,
 | 
					int _libssh2_pem_decode_integer (unsigned char **data, unsigned int *datalen,
 | 
				
			||||||
				 char **i, unsigned int *ilen)
 | 
									 unsigned char **i, unsigned int *ilen)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned int len;
 | 
						unsigned int len;
 | 
				
			||||||
	int lenlen;
 | 
						int lenlen;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user