git: fd577b59b2d7 - main - libsa: Move hash functions up a level

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 02 Feb 2024 21:04:53 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=fd577b59b2d78a32f40fdc3847666728d8a897db

commit fd577b59b2d78a32f40fdc3847666728d8a897db
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-01-31 23:54:19 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-02 21:01:03 +0000

    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