diff options
author | Toomas Soome <tsoome@me.com> | 2021-04-29 21:57:41 +0300 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2021-05-16 21:20:17 +0300 |
commit | 411d06f4173dcc82abb7baec9fd0860cde7df236 (patch) | |
tree | 607d6a172f127de8fcfb2bd86bf9b0a7d9af25f1 /usr/src/boot | |
parent | 4b82e532e7bf2c770ccd1f39cad0c7e91fdaedce (diff) | |
download | illumos-gate-411d06f4173dcc82abb7baec9fd0860cde7df236.tar.gz |
13785 loader: move libcrypto to libstand
Reviewed by: Dan McDonald <danmcd@joyent.com>
Approved by: Robert Mustacchi <rm@fingolfin.org>
Diffstat (limited to 'usr/src/boot')
-rw-r--r-- | usr/src/boot/lib/libstand/crypto/Makefile.inc | 52 | ||||
-rw-r--r-- | usr/src/boot/lib/libstand/crypto/digest.c (renamed from usr/src/boot/sys/boot/libcrypto/digest.c) | 0 | ||||
-rw-r--r-- | usr/src/boot/lib/libstand/crypto/libcrypto.h (renamed from usr/src/boot/sys/boot/libcrypto/libcrypto.h) | 0 | ||||
-rw-r--r-- | usr/src/boot/lib/libstand/zfs/Makefile.inc | 19 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/Makefile | 4 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/Makefile.inc | 1 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/efi/loader/Makefile.com | 16 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/i386/loader/Makefile | 18 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/libcrypto/Makefile | 36 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/libcrypto/Makefile.com | 62 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/libcrypto/amd64/Makefile | 31 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/libcrypto/i386/Makefile | 26 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/libstand/Makefile.com | 1 | ||||
-rw-r--r-- | usr/src/boot/sys/boot/libstand/amd64/Makefile | 5 |
14 files changed, 80 insertions, 191 deletions
diff --git a/usr/src/boot/lib/libstand/crypto/Makefile.inc b/usr/src/boot/lib/libstand/crypto/Makefile.inc new file mode 100644 index 0000000000..6a8dadc313 --- /dev/null +++ b/usr/src/boot/lib/libstand/crypto/Makefile.inc @@ -0,0 +1,52 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2021 Toomas Soome <tsoome@me.com> +# + +COMDIR = $(SRC)/common/crypto + +SRCS += $(CRYPTOSRC)/digest.c +SRCS += $(COMDIR)/sha1/sha1.c +SRCS += $(COMDIR)/edonr/edonr.c +SRCS += $(COMDIR)/skein/skein.c +SRCS += $(COMDIR)/skein/skein_iv.c +SRCS += $(COMDIR)/skein/skein_block.c +OBJS += digest.o +OBJS += sha1.o +OBJS += edonr.o +OBJS += skein.o +OBJS += skein_iv.o +OBJS += skein_block.o + +digest.o := CPPFLAGS += -I../../common + +# Do not unroll skein loops, reduce code size +skein_block.o := CPPFLAGS += -DSKEIN_LOOP=111 + +%.o: $(COMDIR)/edonr/%.c + $(COMPILE.c) -o $@ $< + +%.o: $(COMDIR)/skein/%.c + $(COMPILE.c) -o $@ $< + +%.o: $(CRYPTOSRC)/%.c + $(COMPILE.c) -o $@ $< + +%.o: $(COMDIR)/sha1/%.c + $(COMPILE.c) $< + +sha1-x86_64.s: $(COMDIR)/sha1/amd64/sha1-x86_64.pl + $(PERL) $? $@ + +sha1-x86_64.o: sha1-x86_64.s + $(COMPILE.s) -o $@ ${@F:.o=.s} diff --git a/usr/src/boot/sys/boot/libcrypto/digest.c b/usr/src/boot/lib/libstand/crypto/digest.c index 7a1bd841b1..7a1bd841b1 100644 --- a/usr/src/boot/sys/boot/libcrypto/digest.c +++ b/usr/src/boot/lib/libstand/crypto/digest.c diff --git a/usr/src/boot/sys/boot/libcrypto/libcrypto.h b/usr/src/boot/lib/libstand/crypto/libcrypto.h index b00373f6ab..b00373f6ab 100644 --- a/usr/src/boot/sys/boot/libcrypto/libcrypto.h +++ b/usr/src/boot/lib/libstand/crypto/libcrypto.h diff --git a/usr/src/boot/lib/libstand/zfs/Makefile.inc b/usr/src/boot/lib/libstand/zfs/Makefile.inc index ef840587c9..fd054a9411 100644 --- a/usr/src/boot/lib/libstand/zfs/Makefile.inc +++ b/usr/src/boot/lib/libstand/zfs/Makefile.inc @@ -10,23 +10,15 @@ # # -# Copyright 2016 Toomas Soome <tsoome@me.com> +# Copyright 2021 Toomas Soome <tsoome@me.com> # SRCS += $(ZFSSRC)/zfs.c SRCS += $(ZFSSRC)/gzip.c -SRCS += $(SRC)/common/crypto/edonr/edonr.c -SRCS += $(SRC)/common/crypto/skein/skein.c -SRCS += $(SRC)/common/crypto/skein/skein_iv.c -SRCS += $(SRC)/common/crypto/skein/skein_block.c SRCS += $(SRC)/common/list/list.c OBJS += zfs.o OBJS += gzip.o -OBJS += edonr.o OBJS += nvlist.o -OBJS += skein.o -OBJS += skein_iv.o -OBJS += skein_block.o OBJS += list.o zfs.o := CPPFLAGS += -I../../common @@ -34,18 +26,9 @@ zfs.o := CPPFLAGS += -I../../../cddl/boot/zfs -I$(LZ4) zfs.o := CPPFLAGS += -I$(SRC)/uts/common/fs/zfs nvlist.o := CPPFLAGS += -I../../common -I../../../cddl/boot/zfs -# Do not unroll skein loops, reduce code size -skein_block.o := CPPFLAGS += -DSKEIN_LOOP=111 - %.o: $(ZFSSRC)/%.c $(COMPILE.c) -o $@ $< -%.o: $(SRC)/common/crypto/edonr/%.c - $(COMPILE.c) -o $@ $< - -%.o: $(SRC)/common/crypto/skein/%.c - $(COMPILE.c) -o $@ $< - %.o: $(SRC)/common/list/%.c $(COMPILE.c) -DNDEBUG $< diff --git a/usr/src/boot/sys/boot/Makefile b/usr/src/boot/sys/boot/Makefile index 1ffdce7185..b24280da9d 100644 --- a/usr/src/boot/sys/boot/Makefile +++ b/usr/src/boot/sys/boot/Makefile @@ -18,7 +18,7 @@ include $(SRC)/Makefile.master INSTDIRS = i386 efi -SUBDIRS = libstand libficl libcrypto $(INSTDIRS) +SUBDIRS = libstand libficl $(INSTDIRS) all := TARGET = all clean := TARGET = clean @@ -37,7 +37,7 @@ all clean clobber: $(SUBDIRS) # install: all .WAIT $(INSTDIRS) -.PARALLEL: libstand libficl libcrypto +.PARALLEL: libstand libficl $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(TARGET) diff --git a/usr/src/boot/sys/boot/Makefile.inc b/usr/src/boot/sys/boot/Makefile.inc index 86ea9ca206..83a480c156 100644 --- a/usr/src/boot/sys/boot/Makefile.inc +++ b/usr/src/boot/sys/boot/Makefile.inc @@ -39,6 +39,7 @@ PNGLITE= $(SRC)/common/pnglite BOOTSRC= $(SRC)/boot/sys/boot LIBSRC= $(SRC)/boot/lib SASRC= $(LIBSRC)/libstand +CRYPTOSRC= $(SASRC)/crypto ZFSSRC= $(SASRC)/zfs ZLIB= $(SRC)/contrib/zlib LZ4= $(SRC)/common/lz4 diff --git a/usr/src/boot/sys/boot/efi/loader/Makefile.com b/usr/src/boot/sys/boot/efi/loader/Makefile.com index 58dbcfb6f2..8d05cdfbe6 100644 --- a/usr/src/boot/sys/boot/efi/loader/Makefile.com +++ b/usr/src/boot/sys/boot/efi/loader/Makefile.com @@ -60,7 +60,7 @@ OBJS= \ tem.o \ vers.o -module.o := CPPFLAGS += -I$(BOOTSRC)/libcrypto +module.o := CPPFLAGS += -I$(CRYPTOSRC) tem.o := CPPFLAGS += $(DEFAULT_CONSOLE_COLOR) main.o := CPPFLAGS += -I$(SRC)/uts/common/fs/zfs @@ -89,13 +89,15 @@ smbios.o := CPPFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID # Use network-endian UUID format for backward compatibility. #CPPFLAGS += -DSMBIOS_NETWORK_ENDIAN_UUID -LIBSTAND= ../../../libstand/$(MACHINE)/libstand.a +DPLIBSTAND= ../../../libstand/$(MACHINE)/libstand.a +LIBSTAND= -L../../../libstand/$(MACHINE) -lstand BOOT_FORTH= yes CPPFLAGS += -DBOOT_FORTH CPPFLAGS += -I$(SRC)/common/ficl CPPFLAGS += -I../../../libficl -LIBFICL= ../../../libficl/$(MACHINE)/libficl.a +DPLIBFICL= ../../../libficl/$(MACHINE)/libficl.a +LIBFICL= -L../../../libficl/$(MACHINE) -lficl # Always add MI sources include ../Makefile.common @@ -138,11 +140,11 @@ loader.bin: loader.sym -j set_Xficl_compile_set \ --output-target=$(EFI_TARGET) --subsystem efi-app loader.sym $@ -LIBEFI= ../../libefi/$(MACHINE)/libefi.a -LIBCRYPTO= ../../../libcrypto/$(MACHINE)/libcrypto.a +DPLIBEFI= ../../libefi/$(MACHINE)/libefi.a +LIBEFI= -L../../libefi/$(MACHINE) -lefi -DPADD= $(LIBFICL) $(LIBEFI) $(LIBCRYPTO) $(LIBSTAND) $(LDSCRIPT) -LDADD= $(LIBFICL) $(LIBEFI) $(LIBCRYPTO) $(LIBSTAND) +DPADD= $(DPLIBFICL) $(DPLIBEFI) $(DPLIBSTAND) $(LDSCRIPT) +LDADD= $(LIBFICL) $(LIBEFI) $(LIBSTAND) loader.sym: $(OBJS) $(DPADD) $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDADD) diff --git a/usr/src/boot/sys/boot/i386/loader/Makefile b/usr/src/boot/sys/boot/i386/loader/Makefile index c8be1beb55..6ed85969a2 100644 --- a/usr/src/boot/sys/boot/i386/loader/Makefile +++ b/usr/src/boot/sys/boot/i386/loader/Makefile @@ -27,7 +27,8 @@ NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 # Set by loader Makefile CPPFLAGS += -I$(ZFSSRC) CPPFLAGS += -I../libi386 -LIBI386= ../libi386/libi386.a +DPLIBI386= ../libi386/libi386.a +LIBI386= -L../libi386 -li386 ROOT_BOOT= $(ROOT)/boot ROOT_BOOT_DEFAULTS= $(ROOT)/boot/defaults @@ -51,7 +52,8 @@ CPPFLAGS += -DLOADER_GZIP_SUPPORT # Enable BootForth CPPFLAGS += -DBOOT_FORTH -I$(SRC)/common/ficl -I../../libficl -LIBFICL= ../../libficl/$(MACH)/libficl.a +DPLIBFICL= ../../libficl/$(MACH)/libficl.a +LIBFICL= -L../../libficl/$(MACH) -lficl # Always add MI sources SRCS += boot.c commands.c console.c devopen.c interp.c @@ -60,7 +62,7 @@ SRCS += module.c linenoise.c multiboot2.c nvstore.c SRCS += zfs_cmd.c SRCS += font.c $(FONT).c tem.c -module.o := CPPFLAGS += -I$(BOOTSRC)/libcrypto +module.o := CPPFLAGS += -I$(CRYPTOSRC) tem.o := CPPFLAGS += $(DEFAULT_CONSOLE_COLOR) SRCS += load_elf32.c load_elf32_obj.c reloc_elf32.c @@ -92,8 +94,8 @@ LDFLAGS= -static -T $(LDSCRIPT) -N --gc-sections # i386 standalone support library CPPFLAGS += -I.. -I../../../../lib/libstand -LIBSTAND= ../../libstand/$(MACH)/libstand.a -LIBCRYPTO= ../../libcrypto/$(MACH)/libcrypto.a +DPLIBSTAND= ../../libstand/$(MACH)/libstand.a +LIBSTAND= -L../../libstand/$(MACH) -lstand # BTX components CPPFLAGS += -I../btx/lib @@ -136,8 +138,8 @@ FORTH += menu.rc # XXX crt0.o needs to be first for pxeboot(8) to work -DPADD= $(LIBFICL) $(LIBI386) $(LIBCRYPTO) $(LIBSTAND) -LDADD= $(LIBFICL) $(LIBI386) $(LIBCRYPTO) $(LIBSTAND) +DPADD= $(DPLIBFICL) $(DPLIBI386) $(DPLIBSTAND) +LDADD= $(LIBFICL) $(LIBI386) $(LIBSTAND) CLEANFILES += machine x86 @@ -153,7 +155,7 @@ OBJS= $(SRCS:%.c=%.o) $(OBJS): machine x86 -$(PROG): $(OBJS) $(LDADD) +$(PROG): $(OBJS) $(DPADD) $(LD) $(LDFLAGS) -o $@ $(BTXCRT) $(OBJS) $(LDADD) clean: clobber diff --git a/usr/src/boot/sys/boot/libcrypto/Makefile b/usr/src/boot/sys/boot/libcrypto/Makefile deleted file mode 100644 index c1b7628a34..0000000000 --- a/usr/src/boot/sys/boot/libcrypto/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright 2016 Toomas Soome <tsoome@me.com> -# - -.KEEP_STATE: - -include $(SRC)/Makefile.master - -SUBDIRS = $(MACH) $(MACH64) - -all := TARGET = all -clean := TARGET = clean -clobber := TARGET = clobber -install := TARGET = install - -all clean clobber: $(SUBDIRS) - -install: all - -.PARALLEL: - -$(SUBDIRS): FRC - @cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/boot/sys/boot/libcrypto/Makefile.com b/usr/src/boot/sys/boot/libcrypto/Makefile.com deleted file mode 100644 index ce9ed268ac..0000000000 --- a/usr/src/boot/sys/boot/libcrypto/Makefile.com +++ /dev/null @@ -1,62 +0,0 @@ -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright 2016 Toomas Soome <tsoome@me.com> -# - -include $(SRC)/Makefile.master -include $(SRC)/boot/sys/boot/Makefile.inc - -COMDIR = ../../../../../common/crypto - -install: - -SRCS += sha1.c digest.c -OBJS += sha1.o digest.o - -CPPFLAGS += -I. -I../../../../include -I../../.. -CPPFLAGS += -I../../../../lib/libstand - -# Pick up the bootstrap header for some interface items -CPPFLAGS += -I../../common - -# For multiboot2.h, must be last, to avoid conflicts -CPPFLAGS += -I$(SRC)/uts/common - -.PARALLEL: - -libcrypto.a: $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) - -clean: clobber -clobber: - $(RM) $(CLEANFILES) $(OBJS) libcrypto.a - -machine: - $(RM) machine - $(SYMLINK) ../../../${MACHINE}/include machine - -x86: - $(RM) x86 - $(SYMLINK) ../../../x86/include x86 - -%.o: ../%.c - $(COMPILE.c) $< - -%.o: ../../../../../common/crypto/sha1/%.c - $(COMPILE.c) $< - -sha1-x86_64.s: $(COMDIR)/sha1/amd64/sha1-x86_64.pl - $(PERL) $? $@ - -sha1-x86_64.o: sha1-x86_64.s - $(COMPILE.s) -o $@ ${@F:.o=.s} diff --git a/usr/src/boot/sys/boot/libcrypto/amd64/Makefile b/usr/src/boot/sys/boot/libcrypto/amd64/Makefile deleted file mode 100644 index 847636d130..0000000000 --- a/usr/src/boot/sys/boot/libcrypto/amd64/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright 2016 Toomas Soome <tsoome@me.com> -# - -COMDIR= $(SRC)/common/crypto -MACHINE= $(MACH64) -AS= $(AS_amd64_64) - -all: libcrypto.a - -SRCS = sha1-x86_64.s -OBJS = sha1-x86_64.o - -include ../Makefile.com -ASFLAGS = $(amd64_AS_XARCH) -I$(SRC)/uts/common -D_ASM - -CFLAGS += -m64 $(CFLAGS64) -CLEANFILES += machine x86 sha1-x86_64.s - -$(OBJS): machine x86 diff --git a/usr/src/boot/sys/boot/libcrypto/i386/Makefile b/usr/src/boot/sys/boot/libcrypto/i386/Makefile deleted file mode 100644 index 999d173b6d..0000000000 --- a/usr/src/boot/sys/boot/libcrypto/i386/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright 2016 Toomas Soome <tsoome@me.com> -# - -MACHINE= $(MACH) - -all: libcrypto.a - -include ../Makefile.com - -CFLAGS += -m32 - -CLEANFILES += machine x86 - -$(OBJS): machine x86 diff --git a/usr/src/boot/sys/boot/libstand/Makefile.com b/usr/src/boot/sys/boot/libstand/Makefile.com index f796b31626..9294460253 100644 --- a/usr/src/boot/sys/boot/libstand/Makefile.com +++ b/usr/src/boot/sys/boot/libstand/Makefile.com @@ -24,6 +24,7 @@ $(LIBRARY): $(SRCS) $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) include $(SASRC)/Makefile.inc +include $(CRYPTOSRC)/Makefile.inc include $(ZFSSRC)/Makefile.inc LIBCSRC= $(SRC)/lib/libc diff --git a/usr/src/boot/sys/boot/libstand/amd64/Makefile b/usr/src/boot/sys/boot/libstand/amd64/Makefile index 2171bc866b..8c28ac3dda 100644 --- a/usr/src/boot/sys/boot/libstand/amd64/Makefile +++ b/usr/src/boot/sys/boot/libstand/amd64/Makefile @@ -21,14 +21,17 @@ all install: $(LIBRARY) include ../Makefile.com +ASFLAGS = $(amd64_AS_XARCH) -I$(SRC)/uts/common -D_ASM CFLAGS += -m64 $(CFLAGS64) CCASFLAGS += -m64 -CLEANFILES += x86 +CLEANFILES += x86 sha1-x86_64.s # _setjmp/_longjmp SRCS += $(SASRC)/amd64/_setjmp.S OBJS += _setjmp.o +SRCS += sha1-x86_64.s +OBJS += sha1-x86_64.o $(LIBRARY): $(SRCS) $(OBJS) |