hondza wrote: > I managed to find out what causes the whole loop file to be read for gpg > keys (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=450784). [snip] > So anyone with deeper util-linux knowledge please fix it :). I uploaded new fixed versions here: http://loop-aes.sourceforge.net/updates/util-linux-2.12r-20080303.diff.bz2 http://loop-aes.sourceforge.net/updates/util-linux-2.12r-20080303.diff.bz2.sign http://loop-aes.sourceforge.net/updates/util-linux-ng-2.13.1-20080303.diff.bz2 http://loop-aes.sourceforge.net/updates/util-linux-ng-2.13.1-20080303.diff.bz2.sign Below is patch of what was changed. -- Jari Ruusu 1024R/3A220F51 5B 4B F9 BB D3 3F 52 E9 DB 1D EB E3 24 0E A9 DD --- ./mount/lomount.c.old 2007-10-16 18:51:47.000000000 +0300 +++ ./mount/lomount.c 2008-03-03 16:28:30.000000000 +0200 @@ -312,6 +312,19 @@ } } +static int are_these_files_same(const char *name1, const char *name2) +{ + struct stat statbuf1; + struct stat statbuf2; + + if(!name1 || !*name1 || !name2 || !*name2) return 0; + if(stat(name1, &statbuf1)) return 0; + if(stat(name2, &statbuf2)) return 0; + if(statbuf1.st_dev != statbuf2.st_dev) return 0; + if(statbuf1.st_ino != statbuf2.st_ino) return 0; + return 1; /* are same */ +} + static char *do_GPG_pipe(char *pass) { int x, pfdi[2], pfdo[2]; @@ -382,7 +395,7 @@ * mount -t iso9660 /dev/cdrom /cdrom -o loop=/dev/loop0,encryption=AES128,gpgkey=/dev/cdrom,offset=8192 * ^^^^^^^^^^ ^^^^^^^^^^ ^^^^ */ - if(loopOffsetBytes && !strcmp(loopFileName, gpgKeyFile)) { + if(loopOffsetBytes && are_these_files_same(loopFileName, gpgKeyFile)) { FILE *f; char b[1024]; long long cnt; - Linux-crypto: cryptography in and on the Linux system Archive: http://mail.nl.linux.org/linux-crypto/