From fd577b59b2d78a32f40fdc3847666728d8a897db Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 31 Jan 2024 16:54:19 -0700 Subject: [PATCH] libsa: Move hash functions up a level This should have no functional change. Move compiling the sha256, sha512 and md5 hash functions up into libsa to allow them to be used elsewhere in the boot loader when geli isn't configured. Since libsa is a .a, these won't wind up in any boot loader that doesn't reference them, so should be a nop. Sponsored by: Netflix --- stand/libsa/Makefile | 9 +++++++++ stand/libsa/geli/Makefile.inc | 11 ----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index f7d7778d5653..bc85a3dcb0de 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -180,6 +180,15 @@ SRCS+= explicit_bzero.c crc32_libkern.c .include "${SASRC}/zfs/Makefile.inc" .endif +# Crypto hashing functions +# sha256 and sha512 from sys/crypto +.PATH: ${SYSDIR}/crypto/sha2 +SRCS+= sha256c.c sha512c.c + +# md5 from libmd +.PATH: ${SRCTOP}/lib/libmd +SRCS+= md5c.c + .if ${DO32:U0} == 0 MAN=libsa.3 .endif diff --git a/stand/libsa/geli/Makefile.inc b/stand/libsa/geli/Makefile.inc index 0d9fcb90bbd8..07600d5287bd 100644 --- a/stand/libsa/geli/Makefile.inc +++ b/stand/libsa/geli/Makefile.inc @@ -5,16 +5,6 @@ # Our password input method SRCS+= pwgets.c -# sha256 and sha512 from sys/crypto -.PATH: ${SYSDIR}/crypto/sha2 -CFLAGS.sha256.c+= -DWEAK_REFS -CFLAGS.sha512.c+= -DWEAK_REFS -SRCS+= sha256c.c sha512c.c - -# md5 from libmd -.PATH: ${SRCTOP}/lib/libmd -SRCS+= md5c.c - # AES implementation from sys/crypto .PATH: ${SYSDIR}/crypto/rijndael .for i in rijndael-alg-fst.c rijndael-api-fst.c rijndael-api.c @@ -23,7 +13,6 @@ CFLAGS.${i}+= -DNDEBUG SRCS+= ${i} .endfor - # local GELI Implementation .PATH: ${SYSDIR}/geom/eli .for i in gelidev.c geli_metadata.c