Hello, there arose problems when I tried to link cryptsetup-luks 1.0.4 against dietlibc (http://www.fefe.de/dietlibc/) instead of glibc. I detected some minor compile-time problems and one run-time problem with sscanf. I wrote the following patch to fix these (without digging into autoconf/automake). I hope it proves helpful. Kind Regards, Michael diff -Nur cryptsetup-luks-1.0.4.orig/lib/Makefile.in cryptsetup-luks-1.0.4/lib/Makefile.in --- cryptsetup-luks-1.0.4.orig/lib/Makefile.in 2006-10-13 12:09:37.000000000 +0200 +++ cryptsetup-luks-1.0.4/lib/Makefile.in 2007-02-19 14:41:46.000000000 +0100 @@ -152,7 +152,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ +LIBTOOL = @LIBTOOL@ --tag=CC LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ diff -Nur cryptsetup-luks-1.0.4.orig/lib/setup.c cryptsetup-luks-1.0.4/lib/setup.c --- cryptsetup-luks-1.0.4.orig/lib/setup.c 2006-10-07 13:20:09.000000000 +0200 +++ cryptsetup-luks-1.0.4/lib/setup.c 2007-02-19 14:42:50.000000000 +0100 @@ -366,31 +366,29 @@ static int parse_into_name_and_mode(const char *nameAndMode, char *name, char *mode) { - // Token content stringification, see info cpp/stringification -#define str(s) #s -#define xstr(s) str(s) -#define scanpattern1 "%" xstr(LUKS_CIPHERNAME_L) "[^-]-%" xstr(LUKS_CIPHERMODE_L) "s" -#define scanpattern2 "%" xstr(LUKS_CIPHERNAME_L) "[^-]" +#define min(x,y) ((x) < (y) ? (x) : (y)) - int r; + char *p; + int len; - if(sscanf(nameAndMode,scanpattern1, name, mode) != 2) { - if((r = sscanf(nameAndMode,scanpattern2,name)) == 1) { - strncpy(mode,"cbc-plain",10); - } - else { - fprintf(stderr, "no known cipher-spec pattern detected\n"); - return -EINVAL; - } + if ((p = index(nameAndMode, '-')) != NULL) { + len = min(p - nameAndMode, LUKS_CIPHERNAME_L - 1); + strncpy(mode, p + 1, LUKS_CIPHERNAME_L); + mode[LUKS_CIPHERNAME_L - 1] = '\0'; + } else { + len = min(strlen(nameAndMode), LUKS_CIPHERNAME_L - 1); + strncpy(mode, "cbc-plain", 10); } + strncpy(name, nameAndMode, len); + name[len] = '\0'; + if (len == 0 || strlen(mode) == 0) { + fprintf(stderr, "no known cipher-spec pattern detected\n"); + return -EINVAL; + } return 0; - -#undef sp1 -#undef sp2 -#undef str -#undef xstr } + static int __crypt_create_device(int reload, struct setup_backend *backend, struct crypt_options *options) { diff -Nur cryptsetup-luks-1.0.4.orig/luks/Makefile.in cryptsetup-luks-1.0.4/luks/Makefile.in --- cryptsetup-luks-1.0.4.orig/luks/Makefile.in 2006-10-13 12:09:38.000000000 +0200 +++ cryptsetup-luks-1.0.4/luks/Makefile.in 2007-02-19 14:41:46.000000000 +0100 @@ -135,7 +135,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ +LIBTOOL = @LIBTOOL@ --tag=CC LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ diff -Nur cryptsetup-luks-1.0.4.orig/src/Makefile.in cryptsetup-luks-1.0.4/src/Makefile.in --- cryptsetup-luks-1.0.4.orig/src/Makefile.in 2006-10-13 12:09:38.000000000 +0200 +++ cryptsetup-luks-1.0.4/src/Makefile.in 2007-02-19 14:41:46.000000000 +0100 @@ -128,7 +128,7 @@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ +LIBTOOL = @LIBTOOL@ --tag=CC LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ @@ -290,7 +290,7 @@ done cryptsetup$(EXEEXT): $(cryptsetup_OBJECTS) $(cryptsetup_DEPENDENCIES) @rm -f cryptsetup$(EXEEXT) - $(LINK) $(cryptsetup_LDFLAGS) $(cryptsetup_OBJECTS) $(cryptsetup_LDADD) $(LIBS) + $(LINK) $(cryptsetup_LDFLAGS) $(cryptsetup_OBJECTS) $(cryptsetup_LDADD) $(LIBS) -lcompat mostlyclean-compile: -rm -f *.$(OBJEXT) --------------------------------------------------------------------- dm-crypt mailing list - http://www.saout.de/misc/dm-crypt/ To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx For additional commands, e-mail: dm-crypt-help@xxxxxxxx