1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-02 01:17:52 +03:00

Fix build warnings in the crypto wrapper functions.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@221 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-02-02 17:00:04 +00:00
parent 1fd6a2e9e0
commit 69a1fac7a1
2 changed files with 14 additions and 9 deletions

View File

@@ -620,7 +620,7 @@ int decompress_buffer(SSH_SESSION *session,BUFFER *buf);
/* wrapper.c */ /* wrapper.c */
int crypt_set_algorithms(SSH_SESSION *); int crypt_set_algorithms(SSH_SESSION *);
int crypt_set_algorithms_server(SSH_SESSION *session); int crypt_set_algorithms_server(SSH_SESSION *session);
CRYPTO *crypto_new(); CRYPTO *crypto_new(void);
void crypto_free(CRYPTO *crypto); void crypto_free(CRYPTO *crypto);
/* crc32.c */ /* crc32.c */

View File

@@ -404,14 +404,14 @@ static struct crypto_struct ssh_ciphertab[]={
#endif /* OPENSSL_CRYPTO */ #endif /* OPENSSL_CRYPTO */
/* it allocates a new cipher structure based on its offset into the global table */ /* it allocates a new cipher structure based on its offset into the global table */
struct crypto_struct *cipher_new(int offset){ static struct crypto_struct *cipher_new(int offset){
struct crypto_struct *cipher=malloc(sizeof(struct crypto_struct)); struct crypto_struct *cipher=malloc(sizeof(struct crypto_struct));
/* note the memcpy will copy the pointers : so, you shouldn't free them */ /* note the memcpy will copy the pointers : so, you shouldn't free them */
memcpy(cipher,&ssh_ciphertab[offset],sizeof(*cipher)); memcpy(cipher,&ssh_ciphertab[offset],sizeof(*cipher));
return cipher; return cipher;
} }
void cipher_free(struct crypto_struct *cipher){ static void cipher_free(struct crypto_struct *cipher){
#ifdef HAVE_LIBGCRYPT #ifdef HAVE_LIBGCRYPT
int i; int i;
#endif #endif
@@ -428,7 +428,7 @@ void cipher_free(struct crypto_struct *cipher){
free(cipher); free(cipher);
} }
CRYPTO *crypto_new(){ CRYPTO *crypto_new(void){
CRYPTO *crypto=malloc(sizeof (CRYPTO)); CRYPTO *crypto=malloc(sizeof (CRYPTO));
memset(crypto,0,sizeof(*crypto)); memset(crypto,0,sizeof(*crypto));
return crypto; return crypto;
@@ -510,13 +510,18 @@ int crypt_set_algorithms(SSH_SESSION *session){
// TODO Obviously too much cut and paste here // TODO Obviously too much cut and paste here
int crypt_set_algorithms_server(SSH_SESSION *session){ int crypt_set_algorithms_server(SSH_SESSION *session){
char *server = NULL;
char *client = NULL;
char *match = NULL;
int i = 0;
/* we must scan the kex entries to find crypto algorithms and set their appropriate structure */ /* we must scan the kex entries to find crypto algorithms and set their appropriate structure */
enter_function(); enter_function();
int i=0;
/* out */ /* out */
char *server=session->server_kex.methods[SSH_CRYPT_S_C]; server = session->server_kex.methods[SSH_CRYPT_S_C];
char *client=session->client_kex.methods[SSH_CRYPT_S_C]; client = session->client_kex.methods[SSH_CRYPT_S_C];
char *match=ssh_find_matching(client,server); match = ssh_find_matching(client,server);
if(!match){ if(!match){
ssh_set_error(session,SSH_FATAL,"Crypt_set_algorithms_server : no matching algorithm function found for %s",server); ssh_set_error(session,SSH_FATAL,"Crypt_set_algorithms_server : no matching algorithm function found for %s",server);
free(match); free(match);