On Sunday 06 of December 2009 18:28:51 Kamil Dudka wrote:
> On Sunday 06 of December 2009 17:54:22 Peter Stuge wrote:
> > All the other changes, for missing initializations and such, are
> > great! Could you make them into a separate patch?
>
> And maybe yet another one to consider...

This version looks saner, however it breaks compatibility with OpenSSL<0.9.4.

> Kamil
From 68ef8807a5dc871b7da955516c902316d71ece9a Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdu...@redhat.com>
Date: Sun, 6 Dec 2009 18:51:20 +0100
Subject: [PATCH] fix some less common gcc warnings

Note this breaks support for OpenSSL<0.9.4.
---
 src/openssl.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/openssl.c b/src/openssl.c
index 000c9ec..d63a77f 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -215,6 +215,8 @@ aes_ctr_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
     if (c == NULL)
 	return 0;
 
+    (void) enc;
+
     AES_set_encrypt_key(key, 8 * ctx->key_len, &c->key);
     memcpy(c->ctr, iv, AES_BLOCK_SIZE);
 
@@ -303,8 +305,9 @@ _libssh2_EVP_aes_256_ctr(void)
  * calling program
  */
 static int
-passphrase_cb(char *buf, int size, int rwflag, char *passphrase)
+passphrase_cb(char *buf, int size, int rwflag, void *userdata)
 {
+    char *passphrase = (char *) userdata;
     int passphrase_len = strlen(passphrase);
     (void) rwflag;
 
@@ -327,6 +330,7 @@ read_private_key_from_file(void ** key_ctx, LIBSSH2_SESSION * session,
                            unsigned const char *passphrase)
 {
     BIO * bp;
+    (void) session;
 
     *key_ctx = NULL;
 
@@ -335,8 +339,7 @@ read_private_key_from_file(void ** key_ctx, LIBSSH2_SESSION * session,
         return -1;
     }
 
-    *key_ctx = read_private_key(bp, NULL, (void *) passphrase_cb,
-                                (void *) passphrase);
+    *key_ctx = read_private_key(bp, NULL, passphrase_cb, (void *) passphrase);
 
     BIO_free(bp);
     return (*key_ctx) ? 0 : -1;
-- 
1.6.2.5

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to