Re: Merging ciphers into loop-AES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jari,

On Mon, Feb 26, 2007 at 08:52:01PM +0200, Jari Ruusu wrote:
> There are cases where people are using kernel patch version of
> loop-AES, and build and install those extra cipher modules without
> building loop-AES module. So there is some need of ciphers package
> staying as separate package.

I've been thinking about this a bit. Do you think this could - in
principle - be solved by changes to the build system?

 a) Adding a "ciphers" build target for building (and installing)
    just the cipher modules, skipping loop.$(VM1)o, be a workable
    approach? I've hacked together a proof-of-concept patch to that
    effect; Note that it is quite surely not working as-is, it is
    merely an illustration and meant as basis for discussion. 

 b) Alternatively, although not clean, maybe the extra unneeded
    loop.$(VM1)o could still be built and installed; If I see it
    correctly, it should do no harm then. I admit that this is not
    a nice solution, but it might(?) be reasonable if patch+ciphers
    is only seldom used. Just thinking aloud..

If the basic idea is reasonable to you, I would like to try and 
work on a solution. If not, no problem, either :-)

> Would it help if loop-AES Makefile detects presence of additional
> loop_xxxx.c source files is its base directory, and compiles and
> installs them all together? Your maintenance "work" would involve
> making sure that all source files are in same directory.

Yes, I think that would already help a bit.

The main point remains though: It is a bit awkward to combine into 
one package what is intended and managed as two separate packages
upstream.  This is no big problem in practice, and the current Debian
packaging can work with it. It's just that having the two combined
would make things a fair bit cleaner and simpler for our distribution
purpose, so I'd be happy to help make it happen :-)

cheers,
Max
=== loop-AES-v3.1f/Makefile
==================================================================
--- Makefile	(revision 1413)
+++ Makefile	(local)
@@ -186,12 +186,15 @@
 endif
 endif
 
+MLIST:=loop.$(VM1)o loop_twofish.$(VM1)o loop_serpent.$(VM1)o loop_blowfish.$(VM1)o
+
 all:
 ifeq ($(LS),unable-to-guess-source-dir)
 	@echo "Unable to guess linux kernel source directory. Please specify"
 	@echo "directory like this:  make LINUX_SOURCE=/usr/src/linux-2.2.20aa1"
 	@exit 1
 endif
+ifneq ($(CIPHERS_ONLY),y)
 ifeq ($(USE_KBUILD),y)
 	rm -r -f tmp-d-kbuild
 	mkdir tmp-d-kbuild
@@ -209,20 +212,28 @@
 	echo 'CFLAGS_aes.o := -DDATA_ALWAYS_ALIGNED=1' >>tmp-d-kbuild/Makefile
 endif
 endif
+	echo 'obj-m:=loop.o' >>tmp-d-kbuild/Makefile
+endif
+	cd tmp-d-kbuild && ln -s ../loop_twofish.c loop_twofish.c && ln -s ../loop_serpent.c loop_serpent.c && ln -s ../loop_blowfish.c loop_blowfish.c
+	echo 'obj-m:=loop_twofish.o loop_serpent.o loop_blowfish.o' >>tmp-d-kbuild/Makefile
 	echo 'EXTRA_CFLAGS:= $(EF)' >>tmp-d-kbuild/Makefile
-	echo 'obj-m:=loop.o' >>tmp-d-kbuild/Makefile
-	cd $(LS) && make M=$(TD)/tmp-d-kbuild modules $(OD2)
+	cd $(LS) && make M=$(TD)/tmp-d-kbuild modules $(OD2) MLIST=$(MLIST)
 ifeq ($(MODINST),y)
-	cd $(LS) && make M=$(TD)/tmp-d-kbuild modules_install $(OD2)
+	cd $(LS) && make M=$(TD)/tmp-d-kbuild modules_install $(OD2) MLIST=$(MLIST)
 endif
 else
-	cd $(LS) && make SUBDIRS=$(TD) modules Q='@cd $(TD) && if [ "$$@" = "modules" ]; then make modules; fi; exit; # ' $(OD2)
+	cd $(LS) && make SUBDIRS=$(TD) modules Q='@cd $(TD) && if [ "$$@" = "modules" ]; then make modules; fi; exit; # ' $(OD2) MLIST=$(MLIST)
 endif
 
-modules: clean loop.$(VM1)o
+CIPHERS_ONLY:=n
+ciphers: MLIST:=$(filter-out loop.$(VM1)o,$(MLIST))
+ciphers: CIPHERS_ONLY:=y
+ciphers: all
+
+modules: clean $(MLIST)
 ifeq ($(MODINST),y)
 	mkdir -p $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE_clean)/block
-	cp -p loop.$(VM1)o $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE_clean)/block
+	cp -p $(MLIST) $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE_clean)/block
 ifeq ($(shell if [ "$(VERSION)$(PATCHLEVEL)0" -ge 240 ]; then echo y; fi),y)
 	rm -f $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE_clean)/kernel/drivers/block/loop.{,k}o
 endif
@@ -271,6 +282,33 @@
 md5-amd64.o: md5-amd64.S
 	$(CP1) $(CC) $(AFLAGS) -c $(PP1)md5-amd64.S -o $(PP1)md5-amd64.o
 
+loop_twofish.$(VM1)o: loop_twofish.c
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(loop_twofish)" -D"KBUILD_MODNAME=KBUILD_STR(loop_twofish)" -c $(PP1)loop_twofish.c -o $(PP1)loop_twofish.o
+ifneq "$(VM1)" ""
+	$(CP1) $(MP1) vmlinux $(PP1)loop_twofish.o loop.$(VM1)o >/dev/null 2>&1
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(loop_twofish_mod)" -D"KBUILD_MODNAME=KBUILD_STR(loop_twofish)" -c $(PP1)loop_twofish.mod.c -o $(PP1)loop_twofish.mod.o
+	$(LD) $(LF) loop_twofish.o loop_twofish.mod.o -o loop_twofish.$(VM1)o
+	rm -f loop_twofish.o loop_twofish.mod.[co] loop.$(VM1)o.mod.[co]
+endif
+
+loop_serpent.$(VM1)o: loop_serpent.c
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(loop_serpent)" -D"KBUILD_MODNAME=KBUILD_STR(loop_serpent)" -c $(PP1)loop_serpent.c -o $(PP1)loop_serpent.o
+ifneq "$(VM1)" ""
+	$(CP1) $(MP1) vmlinux $(PP1)loop_serpent.o loop.$(VM1)o >/dev/null 2>&1
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(loop_serpent_mod)" -D"KBUILD_MODNAME=KBUILD_STR(loop_serpent)" -c $(PP1)loop_serpent.mod.c -o $(PP1)loop_serpent.mod.o
+	$(LD) $(LF) loop_serpent.o loop_serpent.mod.o -o loop_serpent.$(VM1)o
+	rm -f loop_serpent.o loop_serpent.mod.[co] loop.$(VM1)o.mod.[co]
+endif
+
+loop_blowfish.$(VM1)o: loop_blowfish.c
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(loop_blowfish)" -D"KBUILD_MODNAME=KBUILD_STR(loop_blowfish)" -c $(PP1)loop_blowfish.c -o $(PP1)loop_blowfish.o
+ifneq "$(VM1)" ""
+	$(CP1) $(MP1) vmlinux $(PP1)loop_blowfish.o loop.$(VM1)o >/dev/null 2>&1
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(loop_blowfish_mod)" -D"KBUILD_MODNAME=KBUILD_STR(loop_blowfish)" -c $(PP1)loop_blowfish.mod.c -o $(PP1)loop_blowfish.mod.o
+	$(LD) $(LF) loop_blowfish.o loop_blowfish.mod.o -o loop_blowfish.$(VM1)o
+	rm -f loop_blowfish.o loop_blowfish.mod.[co] loop.$(VM1)o.mod.[co]
+endif
+
 clean:
 	rm -f *.o *.ko *.orig *.rej *.mod.c patched-loop.[ch] test-file[1234]
 	rm -f -r test-dir1 tmp-d-kbuild

[Index of Archives]     [Kernel]     [Linux Crypto]     [Gnu Crypto]     [Gnu Classpath]     [Netfilter]     [Bugtraq]
  Powered by Linux