From 62bd02cee5752592d6f284a61759fb398a3ea8ff Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 18 Jun 2018 16:24:42 +0000 Subject: [PATCH] stand: move libgeliboot into libsa. Reduce by 1 the number of crazy libraries we need in stand by moving geli into libsa (where architecturally it belonged all along). This just moves things around without any code changes. --- stand/Makefile | 2 -- stand/defs.mk | 3 +-- stand/geli/Makefile.depend | 15 --------------- stand/i386/gptboot/Makefile | 2 +- stand/i386/gptzfsboot/Makefile | 2 +- stand/i386/isoboot/Makefile | 2 +- stand/i386/loader/Makefile | 4 ++-- stand/i386/zfsboot/Makefile | 2 +- stand/libsa/Makefile | 5 +++++ .../Makefile => libsa/geli/Makefile.inc} | 19 ++++++++----------- stand/{ => libsa}/geli/geliboot.c | 0 stand/{ => libsa}/geli/geliboot.h | 0 stand/{ => libsa}/geli/geliboot_crypto.c | 2 +- stand/{ => libsa}/geli/geliboot_internal.h | 0 stand/{ => libsa}/geli/pwgets.c | 0 15 files changed, 21 insertions(+), 37 deletions(-) delete mode 100644 stand/geli/Makefile.depend rename stand/{geli/Makefile => libsa/geli/Makefile.inc} (74%) rename stand/{ => libsa}/geli/geliboot.c (100%) rename stand/{ => libsa}/geli/geliboot.h (100%) rename stand/{ => libsa}/geli/geliboot_crypto.c (99%) rename stand/{ => libsa}/geli/geliboot_internal.h (100%) rename stand/{ => libsa}/geli/pwgets.c (100%) diff --git a/stand/Makefile b/stand/Makefile index 59eb324a825..c676ded44ce 100644 --- a/stand/Makefile +++ b/stand/Makefile @@ -21,8 +21,6 @@ S.${MK_ZFS}+= zfs S.yes+= defaults S.yes+= man -S.${MK_LOADER_GELI}+= geli - .include S.${MK_EFI}+= efi diff --git a/stand/defs.mk b/stand/defs.mk index d62957629f6..e3c143952ce 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -67,8 +67,7 @@ MK_LOADER_GELI=yes .endif .if ${MK_LOADER_GELI} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${BOOTSRC}/geli -LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a +CFLAGS+= -I${SASRC}/geli .endif # MK_LOADER_GELI .endif # HAVE_GELI diff --git a/stand/geli/Makefile.depend b/stand/geli/Makefile.depend deleted file mode 100644 index 106f2f62b86..00000000000 --- a/stand/geli/Makefile.depend +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - lib/libmd \ - secure/lib/libcrypto \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/stand/i386/gptboot/Makefile b/stand/i386/gptboot/Makefile index fb9bc499743..fde938f8740 100644 --- a/stand/i386/gptboot/Makefile +++ b/stand/i386/gptboot/Makefile @@ -64,7 +64,7 @@ gptboot.bin: gptboot.out ${OBJCOPY} -S -O binary gptboot.out ${.TARGET} gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} .include diff --git a/stand/i386/gptzfsboot/Makefile b/stand/i386/gptzfsboot/Makefile index 3d8bf1bc138..928ecf5ba84 100644 --- a/stand/i386/gptzfsboot/Makefile +++ b/stand/i386/gptzfsboot/Makefile @@ -75,7 +75,7 @@ gptzfsboot.bin: gptzfsboot.out gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o \ ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBZFSBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} zfsboot.o: ${ZFSSRC}/zfsimpl.c diff --git a/stand/i386/isoboot/Makefile b/stand/i386/isoboot/Makefile index a2cb1447860..cc7e34fc6de 100644 --- a/stand/i386/isoboot/Makefile +++ b/stand/i386/isoboot/Makefile @@ -66,6 +66,6 @@ isoboot.bin: isoboot.out ${OBJCOPY} -S -O binary isoboot.out ${.TARGET} isoboot.out: ${BTXCRT} isoboot.o sio.o crc32.o drv.o cons.o ${OPENCRYPTO_XTS} - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBGELIBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSA32} .include diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index ac30415dfd7..f3483146672 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -71,8 +71,8 @@ FILESMODE_${LOADER}= ${BINMODE} -b # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} -LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} +DPADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} +LDADD= ${LDR_INTERP32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBSA32} .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -DLOADER_PREFER_AMD64 diff --git a/stand/i386/zfsboot/Makefile b/stand/i386/zfsboot/Makefile index 1d2f6d69503..cb10d96a33d 100644 --- a/stand/i386/zfsboot/Makefile +++ b/stand/i386/zfsboot/Makefile @@ -82,7 +82,7 @@ zfsboot.bin: zfsboot.out ${OBJCOPY} -S -O binary zfsboot.out ${.TARGET} zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBGELIBOOT} ${LIBSA32} + ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBZFSBOOT} ${LIBSA32} SRCS= zfsboot.c diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index c34bf697cf9..8d01d9b7f6e 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -151,4 +151,9 @@ CFLAGS.bzipfs.c+= -I${SRCTOP}/contrib/bzip2 .PATH: ${SYSDIR}/libkern SRCS+= explicit_bzero.c +# Maybe GELI +.if ${MK_LOADER_GELI} == "yes" +.include "${SASRC}/geli/Makefile.inc" +.endif + .include diff --git a/stand/geli/Makefile b/stand/libsa/geli/Makefile.inc similarity index 74% rename from stand/geli/Makefile rename to stand/libsa/geli/Makefile.inc index fa77b19d8a7..610590a0031 100644 --- a/stand/geli/Makefile +++ b/stand/libsa/geli/Makefile.inc @@ -1,11 +1,9 @@ # $FreeBSD$ -# libgeliboot +# Extra stuff for GELI -DO32=1 +.PATH: ${SASRC}/geli -.include - -LIB= geliboot +CFLAGS+= -I${LDRSRC} # Our password input method SRCS+= pwgets.c @@ -21,10 +19,11 @@ SRCS+= md5c.c # AES implementation from sys/crypto .PATH: ${SYSDIR}/crypto/rijndael -CFLAGS+= -I${LDRSRC} -# Remove asserts -CFLAGS+= -DNDEBUG -SRCS+= rijndael-alg-fst.c rijndael-api-fst.c rijndael-api.c +.for i in rijndael-alg-fst.c rijndael-api-fst.c rijndael-api.c +# Remove asserts XXX BAD +CFLAGS.${i}+= -DNDEBUG +SRCS+= ${i} +.endfor # local GELI Implementation .PATH: ${SYSDIR}/geom/eli @@ -33,5 +32,3 @@ SRCS+= geliboot_crypto.c g_eli_hmac.c g_eli_key.c g_eli_key_cache.c pkcs5v2.c # aes .PATH: ${SYSDIR}/opencrypto SRCS+= xform_aes_xts.c - -.include diff --git a/stand/geli/geliboot.c b/stand/libsa/geli/geliboot.c similarity index 100% rename from stand/geli/geliboot.c rename to stand/libsa/geli/geliboot.c diff --git a/stand/geli/geliboot.h b/stand/libsa/geli/geliboot.h similarity index 100% rename from stand/geli/geliboot.h rename to stand/libsa/geli/geliboot.h diff --git a/stand/geli/geliboot_crypto.c b/stand/libsa/geli/geliboot_crypto.c similarity index 99% rename from stand/geli/geliboot_crypto.c rename to stand/libsa/geli/geliboot_crypto.c index 4187e97390b..2c7270b846e 100644 --- a/stand/geli/geliboot_crypto.c +++ b/stand/libsa/geli/geliboot_crypto.c @@ -71,7 +71,7 @@ geliboot_crypt(u_int algo, int enc, u_char *data, size_t datasize, } if (datasize != (blks / 8)) { printf("Failed to decrypt the entire input: " - "%u != %u\n", blks, datasize); + "%u != %zu\n", blks, datasize); return (1); } break; diff --git a/stand/geli/geliboot_internal.h b/stand/libsa/geli/geliboot_internal.h similarity index 100% rename from stand/geli/geliboot_internal.h rename to stand/libsa/geli/geliboot_internal.h diff --git a/stand/geli/pwgets.c b/stand/libsa/geli/pwgets.c similarity index 100% rename from stand/geli/pwgets.c rename to stand/libsa/geli/pwgets.c