hello, cryptsetup 1.0.3 gives compiler warnings with gcc 4.1 on 64bit architectures. in particular, gcrypt.c gives two warnings: http://people.debian.org/~tbm/logs/pointer/short/cryptsetup_2:1.0.3-1 David Härdeman created a patch to fix this. I'dd like you to comment on that patch. If it seems ok to you, we will include it in the next debian cryptsetup upload. ... jonas ----- Forwarded message from David Härdeman <david@xxxxxxxx> ----- Date: Tue, 13 Jun 2006 00:55:55 +0200 From: David Härdeman <david@xxxxxxxx> Subject: Re: Compiler warnings in cryptsetup 1.0.3 To: Jonas Meurer <jonas@xxxxxxxxxxxxxxx> On Fri, Jun 09, 2006 at 08:45:53PM +0200, Jonas Meurer wrote: >On 09/06/2006 David Härdeman wrote: >>On Fri, June 9, 2006 1:31, Jonas Meurer said: >>>tbm posted a list with packages which give compiler warnings in >>>their build logs recently to debian-devel. cryptsetup is one of them: >>>... I've attached the patch. Haven't had the opportunity to verify that it doesn't break anything, so it would be great if you could test it. You should also run it by the cryptsetup maintainer to make sure that I didn't botch anything or ran afoul of upstreams tastes. Regards, David diff -ur cryptsetup-1.0.3-orig/lib/gcrypt.c cryptsetup-1.0.3/lib/gcrypt.c --- cryptsetup-1.0.3-orig/lib/gcrypt.c 2005-06-20 11:06:23.000000000 +0200 +++ cryptsetup-1.0.3/lib/gcrypt.c 2006-06-13 00:46:57.000000000 +0200 @@ -12,7 +12,7 @@ static int gcrypt_hash(void *data, int size, char *key, const char *passphrase) { gcry_md_hd_t md; - int algo = (int)data; + int algo = *((int *)data); int len = gcry_md_get_algo_dlen(algo); int round, i; @@ -68,12 +68,22 @@ } for(i = 0; i < size; i++) { + hashes[i].name = NULL; + hashes[i].private = NULL; + } + + for(i = 0; i < size; i++) { char *p; hashes[i].name = strdup(gcry_md_algo_name(list[i])); + if(!hashes[i].name) + goto err; for(p = (char *)hashes[i].name; *p; p++) *p = tolower(*p); - hashes[i].private = (void *)list[i]; + hashes[i].private = malloc(sizeof(int)); + if(!hashes[i].private) + goto err; + *((int *)hashes[i].private) = list[i]; hashes[i].fn = gcrypt_hash; } hashes[i].name = NULL; @@ -83,14 +93,25 @@ free(list); return hashes; + +err: + free(list); + for(i = 0; i < size; i++) { + free(hashes[i].name); + free(hashes[i].private); + } + free(hashes); + return NULL; } static void gcrypt_free_hashes(struct hash_type *hashes) { struct hash_type *hash; - for(hash = hashes; hash->name; hash++) + for(hash = hashes; hash->name; hash++) { free(hash->name); + free(hash->private); + } free(hashes); } diff -ur cryptsetup-1.0.3-orig/lib/internal.h cryptsetup-1.0.3/lib/internal.h --- cryptsetup-1.0.3-orig/lib/internal.h 2005-11-08 08:46:14.000000000 +0100 +++ cryptsetup-1.0.3/lib/internal.h 2006-06-13 00:46:57.000000000 +0200 @@ -20,7 +20,7 @@ #define CRYPT_FLAG_PRIVATE_MASK ((unsigned int)-1 << 24) struct hash_type { - const char *name; + char *name; void *private; int (*fn)(void *data, int size, char *key, const char *passphrase); ----- End forwarded message ----- --------------------------------------------------------------------- - http://www.saout.de/misc/dm-crypt/ To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx For additional commands, e-mail: dm-crypt-help@xxxxxxxx