mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-30 04:22:44 +00:00
lib/libcrypt: unbundle hash functions
libcrypt bundles the various hash functions it needs, duplicating code that is also found in libmd. Unbundle the hash functions and apply the same hack used for libncursesw so static consumers link -lmd in addition to -lcrypt. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D47062
This commit is contained in:
parent
a2c0d2026f
commit
cb5e41b160
@ -3223,6 +3223,7 @@ lib/libc__L: lib/libsys__L
|
||||
lib/libgcc_s__L: lib/libc__L
|
||||
lib/libgcc_s__L: lib/libc_nonshared__L
|
||||
lib/libcxxrt__L: lib/libgcc_s__L
|
||||
lib/libcrypt__L: lib/libmd__L
|
||||
|
||||
_prebuild_libs= ${_kerberos5_lib_libasn1} \
|
||||
${_kerberos5_lib_libhdb} \
|
||||
|
@ -128,6 +128,7 @@ SUBDIR_DEPEND_libc++:= libcxxrt
|
||||
SUBDIR_DEPEND_libc= libsys libcompiler_rt libssp_nonshared
|
||||
SUBDIR_DEPEND_libcam= libsbuf
|
||||
SUBDIR_DEPEND_libcasper= libnv
|
||||
SUBDIR_DEPEND_libcrypt= libmd
|
||||
SUBDIR_DEPEND_libdevstat= libkvm
|
||||
SUBDIR_DEPEND_libdpv= libfigpar ncurses libutil
|
||||
SUBDIR_DEPEND_libedit= ncurses
|
||||
|
@ -10,17 +10,15 @@ PACKAGE= runtime
|
||||
SHLIB_MAJOR= 5
|
||||
LIB= crypt
|
||||
|
||||
.PATH: ${SRCTOP}/sys/kern ${SRCTOP}/sys/crypto/sha2
|
||||
SRCS= crypt.c misc.c \
|
||||
crypt-md5.c md5c.c \
|
||||
crypt-nthash.c md4c.c \
|
||||
crypt-sha256.c sha256c.c \
|
||||
crypt-sha512.c sha512c.c
|
||||
crypt-md5.c \
|
||||
crypt-nthash.c \
|
||||
crypt-sha256.c \
|
||||
crypt-sha512.c
|
||||
MAN= crypt.3
|
||||
MLINKS= crypt.3 crypt_get_format.3 crypt.3 crypt_r.3 \
|
||||
crypt.3 crypt_set_format.3
|
||||
CFLAGS+= -I${SRCTOP}/lib/libmd \
|
||||
-I${SRCTOP}/sys/crypto/sha2
|
||||
CFLAGS+= -I${SRCTOP}/lib/libmd
|
||||
|
||||
# Pull in the strong crypto, if it is present.
|
||||
.if exists(${SRCTOP}/secure/lib/libcrypt) && ${MK_CRYPT} != "no"
|
||||
@ -29,17 +27,6 @@ SRCS+= crypt-des.c crypt-blowfish.c blowfish.c
|
||||
CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH
|
||||
.endif
|
||||
|
||||
.for sym in MD4Init MD4Final MD4Update MD4Pad \
|
||||
MD5Init MD5Final MD5Update MD5Pad \
|
||||
SHA224_Init SHA224_Final SHA224_Update \
|
||||
SHA256_Init SHA256_Final SHA256_Update \
|
||||
SHA512_224_Init SHA512_224_Final SHA512_224_Update \
|
||||
SHA512_256_Init SHA512_256_Final SHA512_256_Update \
|
||||
SHA384_Init SHA384_Final SHA384_Update \
|
||||
SHA512_Init SHA512_Final SHA512_Update
|
||||
CFLAGS+= -D${sym}=__${sym}
|
||||
.endfor
|
||||
|
||||
WARNS?= 2
|
||||
|
||||
PRECIOUSLIB=
|
||||
@ -47,4 +34,22 @@ PRECIOUSLIB=
|
||||
HAS_TESTS=
|
||||
SUBDIR.${MK_TESTS}+= tests
|
||||
|
||||
LIBADD+= md
|
||||
SHLIB_LDSCRIPT= libcrypt.ldscript
|
||||
STATIC_LDSCRIPT= libcrypt.aldscript
|
||||
CLEANFILES+= libcrypt.ald
|
||||
|
||||
libcrypt.ald: ${.CURDIR}/${STATIC_LDSCRIPT}
|
||||
sed -e 's,@@LIB@@,${LIB},g' \
|
||||
-e 's,@@STATICLIB_SUFFIX@@,${_STATICLIB_SUFFIX},g' \
|
||||
${.ALLSRC} > ${.TARGET}
|
||||
|
||||
all: ${STATIC_LDSCRIPT} libcrypt.ald
|
||||
|
||||
install-libcrypt.a: libcrypt.ald
|
||||
${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
||||
${_INSTALLFLAGS} libcrypt.ald ${DESTDIR}${_LIBDIR}/lib${LIB}.a
|
||||
|
||||
realinstall: install-libcrypt.a
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
1
lib/libcrypt/libcrypt.aldscript
Normal file
1
lib/libcrypt/libcrypt.aldscript
Normal file
@ -0,0 +1 @@
|
||||
INPUT(-l@@LIB@@@@STATICLIB_SUFFIX@@ -lmd)
|
1
lib/libcrypt/libcrypt.ldscript
Normal file
1
lib/libcrypt/libcrypt.ldscript
Normal file
@ -0,0 +1 @@
|
||||
INPUT(@@SHLIB@@ AS_NEEDED(-lmd))
|
@ -322,6 +322,7 @@ _DP_cap_grp= nv
|
||||
_DP_cap_pwd= nv
|
||||
_DP_cap_sysctl= nv
|
||||
_DP_cap_syslog= nv
|
||||
_DP_crypt= md
|
||||
.if ${MK_OFED} != "no"
|
||||
_DP_pcap= ibverbs mlx5
|
||||
.endif
|
||||
|
Loading…
Reference in New Issue
Block a user