NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/59685: libcrypto should not depend on libpthread



The following reply was made to PR lib/59685; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Christos Zoulas <christos%zoulas.com@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost, joerg%NetBSD.org@localhost
Subject: Re: lib/59685: libcrypto should not depend on libpthread
Date: Sat, 4 Oct 2025 03:10:06 +0000

 This is a multi-part message in MIME format.
 --=_yZfuFEUR5sBHB86OQy7idKn1uESPEWyt
 
 > Date: Thu, 02 Oct 2025 11:39:28 -0400
 > From: Christos Zoulas <christos%zoulas.com@localhost>
 > 
 > Problem is:
 > 
 > [11:36am] 79>nm obj.amd64-x86_64/libcrypto.a | grep pthread_
 >                   U pthread_attr_destroy
 >                   U pthread_attr_init
 >                   U pthread_attr_setdetachstate
 >                   U pthread_create
 >                   U pthread_join
 > 
 > That the new libcrypto needs pthread_create and we decided
 > a long time ago not to provide a libc stub for pthread_create
 > with the presumption that someone who calls pthread_create
 > really needs threads, and can't use stubs.
 
 What decision was that?  Where was it written down?  What was the
 rationale?
 
 I can't find any record of rationale.  I can't think of a good reason
 why a library like libcrypto shouldn't be able to have a call to
 pthread_create that is dynamically gated on thread configuration, so
 that multithreaded applications linking against libpthread will work
 but single-threaded applications can still use it without linking
 against libpthread.  For libcrypto, as long as you don't call
 OSSL_set_max_threads, it won't ever try calling pthread_create or the
 others.
 
 The attached draft patch series implements that -- one patch to add
 the stubs to libc, one patch to undo all the makefile churn and stop
 linking everything and the kitchen sink against libpthread so
 single-threaded applications get their performance advantage back.
 
 We could add more stubs as needed (e.g., more pthread_attr_*
 functions) but these ones should suffice for now.
 
 --=_yZfuFEUR5sBHB86OQy7idKn1uESPEWyt
 Content-Type: text/plain; charset="ISO-8859-1"; name="pr59685-libcryptolibpthreadstubs"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="pr59685-libcryptolibpthreadstubs.patch"
 
 # HG changeset patch
 # User Taylor R Campbell <riastradh%NetBSD.org@localhost>
 # Date 1759546071 0
 #      Sat Oct 04 02:47:51 2025 +0000
 # Branch trunk
 # Node ID 66d81a37c965663ebb7a1a57b6049266768f26a4
 # Parent  a0306dcafaf26c32d79b45df1e2a5c7fbf8b84e1
 # EXP-Topic riastradh-pr59685-libcryptolibpthreadstubs
 libc: Expose some more pthread stubs.
 
 Provide macros to refer to these in pthread.h.  This allows libraries
 to use the functions without linking against libpthread for
 applications that don't need threads.  For example, with OpenSSL's
 libcrypto, as long as you don't try to raise OSSL_set_max_threads
 above 0, it won't ever try pthread_create.
 
 New pthread macros defined:
 
 pthread_attr_destroy		__libc_thr_attr_destroy
 pthread_attr_init		__libc_thr_attr_init
 pthread_attr_setdetachstate	__libc_thr_attr_setdetachstate
 pthread_create			__libc_thr_create
 pthread_detach			__libc_thr_detach
 pthread_join			__libc_thr_join
 
 New symbols defined by libc as weak aliases for stubs that always
 fail but can be overridden by libpthread:
 
 __libc_thr_attr_destroy
 __libc_thr_attr_init
 __libc_thr_attr_setdetachstate
 __libc_thr_detach
 __libc_thr_join
 
 Note that libc already defined __libc_thr_create.
 
 New internal stubs, not for overriding:
 
 __libc_thr_detach_stub
 __libc_thr_join_stub
 
 These were formerly called __libc_pthread_detach and
 __libc_pthread_join, respectively, and libc has defined weak aliases
 pthread_detach and pthread_join for them since 2013.  I retained all
 four of those symbols, but defined new ones in the __ namespace that
 match the pattern for other thread stubs to avoid raising questions
 about why the pattern seems to be broken.  I left a comment noting
 this fact too.
 
 New pthread strong aliases to override the libc symbols:
 
 __libc_thr_attr_destroy
 __libc_thr_attr_init
 __libc_thr_attr_setdetachstate
 __libc_thr_detach
 __libc_thr_join
 
 Note that pthread already defined a strong __libc_thr_create alias,
 so there is no need to add a new one.
 
 PR lib/59685: libcrypto should not depend on libpthread
 
 diff -r a0306dcafaf2 -r 66d81a37c965 lib/libc/include/reentrant.h
 --- a/lib/libc/include/reentrant.h	Sat May 17 00:34:43 2025 +0000
 +++ b/lib/libc/include/reentrant.h	Sat Oct 04 02:47:51 2025 +0000
 @@ -204,8 +204,6 @@ int	__libc_thr_once(once_t *, void (*)(v
  int	__libc_thr_sigsetmask(int, const sigset_t *, sigset_t *);
  thr_t	__libc_thr_self(void);
  int	__libc_thr_yield(void);
 -void	__libc_thr_create(thr_t *, const thrattr_t *,
 -	    void *(*)(void *), void *);
  void	__libc_thr_exit(void *) __attribute__((__noreturn__));
  int	*__libc_thr_errno(void);
  int	__libc_thr_setcancelstate(int, int *);
 @@ -267,6 +265,8 @@ thr_t	__libc_thr_self_stub(void);
  int	__libc_thr_yield_stub(void);
  int	__libc_thr_create_stub(thr_t *, const thrattr_t *,
  	    void *(*)(void *), void *);
 +int	__libc_thr_detach_stub(thr_t);
 +int	__libc_thr_join_stub(thr_t, void **);
  void	__libc_thr_exit_stub(void *) __dead;
  int	*__libc_thr_errno_stub(void);
  int	__libc_thr_setcancelstate_stub(int, int *);
 diff -r a0306dcafaf2 -r 66d81a37c965 lib/libc/thread-stub/thread-stub.c
 --- a/lib/libc/thread-stub/thread-stub.c	Sat May 17 00:34:43 2025 +0000
 +++ b/lib/libc/thread-stub/thread-stub.c	Sat Oct 04 02:47:51 2025 +0000
 @@ -43,8 +43,6 @@
 =20
  #define	__LIBC_THREAD_STUBS
 =20
 -#define pthread_join	__libc_pthread_join
 -#define pthread_detach	__libc_pthread_detach
  #include "namespace.h"
  #include "reentrant.h"
  #include "tsd.h"
 @@ -70,11 +68,33 @@ do {					\
  #define	CHECK_NOT_THREADED()	/* nothing */
  #endif
 =20
 -__weak_alias(pthread_join, __libc_pthread_join)
 -__weak_alias(pthread_detach, __libc_pthread_detach)
 +/*
 + * These aliases are probably not necessary but have been there
 + * historically, probably by mistake.
 + */
 +__weak_alias(pthread_join, __libc_thr_join)
 +__weak_alias(pthread_detach, __libc_thr_detach)
 +
 +/*
 + * These aliases appear to have been an accident -- nothing has ever
 + * exposed them in a .h file, and they have probably never been used.
 + */
 +__weak_alias(__libc_pthread_join, __libc_thr_join)
 +__weak_alias(__libc_pthread_detach, __libc_thr_detach)
 +
 +/*
 + * These aliases are exposed by pthread.h and overridden by libpthread.
 + * This way libraries can have calls to pthread_create/join/detach
 + * without linking against libpthread, but they will fail at runtime in
 + * applications not linked against libpthread.  (Libraries linked
 + * against libpthread themselves, of course, will work, and carry the
 + * dependency to the application.)
 + */
 +__weak_alias(__libc_thr_join, __libc_thr_join_stub)
 +__weak_alias(__libc_thr_detach, __libc_thr_detach_stub)
 =20
  int
 -pthread_join(pthread_t thread, void **valptr)
 +__libc_thr_join_stub(pthread_t thread, void **valptr)
  {
 =20
  	if (thread =3D=3D pthread_self())
 @@ -83,7 +103,7 @@ pthread_join(pthread_t thread, void **va
  }
 =20
  int
 -pthread_detach(pthread_t thread)
 +__libc_thr_detach_stub(pthread_t thread)
  {
 =20
  	if (thread =3D=3D pthread_self())
 @@ -94,6 +114,12 @@ pthread_detach(pthread_t thread)
  __weak_alias(pthread_setname_np, __libc_mutex_catchall_stub)
  __weak_alias(pthread_setaffinity_np, __libc_mutex_catchall_stub)
 =20
 +/* thread creation attributes */
 +
 +__weak_alias(__libc_thr_attr_init, __libc_mutex_catchall_stub)
 +__weak_alias(__libc_thr_attr_setdetachstate, __libc_mutex_catchall_stub)
 +__weak_alias(__libc_thr_attr_destroy, __libc_mutex_catchall_stub)
 +
  /* mutexes */
 =20
  int __libc_mutex_catchall_stub(mutex_t *);
 diff -r a0306dcafaf2 -r 66d81a37c965 lib/libpthread/pthread.c
 --- a/lib/libpthread/pthread.c	Sat May 17 00:34:43 2025 +0000
 +++ b/lib/libpthread/pthread.c	Sat Oct 04 02:47:51 2025 +0000
 @@ -142,6 +142,8 @@ int _sys___sigprocmask14(int, const sigs
 =20
  __strong_alias(__libc_thr_self,pthread_self)
  __strong_alias(__libc_thr_create,pthread_create)
 +__strong_alias(__libc_thr_detach,pthread_detach)
 +__strong_alias(__libc_thr_join,pthread_join)
  __strong_alias(__libc_thr_exit,pthread_exit)
  __strong_alias(__libc_thr_errno,pthread__errno)
  __strong_alias(__libc_thr_setcancelstate,pthread_setcancelstate)
 diff -r a0306dcafaf2 -r 66d81a37c965 lib/libpthread/pthread.h
 --- a/lib/libpthread/pthread.h	Sat May 17 00:34:43 2025 +0000
 +++ b/lib/libpthread/pthread.h	Sat Oct 04 02:47:51 2025 +0000
 @@ -303,17 +303,8 @@ int	pthread_cond_has_waiters_np(pthread_
   * program. This permits code, particularly libraries that do not
   * directly use threads but want to be thread-safe in the presence of
   * threaded callers, to use pthread mutexes and the like without
 - * unnecessairly including libpthread in their linkage.
 - *
 - * Left out of this list are functions that can't sensibly be trivial
 - * or no-op stubs in a single-threaded process (pthread_create,
 - * pthread_kill, pthread_detach), functions that normally block and
 - * wait for another thread to do something (pthread_join), and
 - * functions that don't make sense without the previous functions
 - * (pthread_attr_*). The pthread_cond_wait and pthread_cond_timedwait
 - * functions are useful in implementing certain protection mechanisms,
 - * though a non-buggy app shouldn't end up calling them in
 - * single-threaded mode.
 + * unnecessarily including libpthread in their linkage.  Such
 + * applications just don't get a working pthread_create.
   *
   * The rename is done as:
   * #define pthread_foo	__libc_foo
 @@ -331,6 +322,26 @@ int	pthread_cond_has_waiters_np(pthread_
 =20
  #ifndef __LIBPTHREAD_SOURCE__
  __BEGIN_DECLS
 +int	__libc_thr_create(pthread_t * __restrict,
 +	    const pthread_attr_t * __restrict, void *(*)(void *),
 +	    void * __restrict);
 +int	__libc_thr_detach(pthread_t);
 +int	__libc_thr_join(pthread_t, void **);
 +
 +int	__libc_thr_attr_init(pthread_attr_t *);
 +int	__libc_thr_attr_setdetachstate(pthread_attr_t *, int);
 +int	__libc_thr_attr_destroy(pthread_attr_t *);
 +__END_DECLS
 +
 +#define	pthread_create	__libc_thr_create
 +#define	pthread_detach	__libc_thr_detach
 +#define	pthread_join	__libc_thr_join
 +
 +#define	pthread_attr_init		__libc_thr_attr_init
 +#define	pthread_attr_setdetachstate	__libc_thr_attr_setdetachstate
 +#define	pthread_attr_destroy		__libc_thr_attr_destroy
 +
 +__BEGIN_DECLS
  int	__libc_mutex_init(pthread_mutex_t * __restrict, const pthread_mutexatt=
 r_t * __restrict);
  int	__libc_mutex_lock(pthread_mutex_t *);
  int	__libc_mutex_trylock(pthread_mutex_t *);
 diff -r a0306dcafaf2 -r 66d81a37c965 lib/libpthread/pthread_attr.c
 --- a/lib/libpthread/pthread_attr.c	Sat May 17 00:34:43 2025 +0000
 +++ b/lib/libpthread/pthread_attr.c	Sat Oct 04 02:47:51 2025 +0000
 @@ -48,6 +48,10 @@
  #include "pthread.h"
  #include "pthread_int.h"
 =20
 +__strong_alias(__libc_thr_attr_init, pthread_attr_init)
 +__strong_alias(__libc_thr_attr_setdetachstate, pthread_attr_setdetachstate)
 +__strong_alias(__libc_thr_attr_destroy, pthread_attr_destroy)
 +
  __weak_alias(pthread_attr_get_np, _pthread_attr_get_np)
 =20
  static struct pthread_attr_private *pthread__attr_init_private(
 diff -r a0306dcafaf2 -r 66d81a37c965 lib/libpthread/pthread_mi.expsym
 --- a/lib/libpthread/pthread_mi.expsym	Sat May 17 00:34:43 2025 +0000
 +++ b/lib/libpthread/pthread_mi.expsym	Sat Oct 04 02:47:51 2025 +0000
 @@ -23,13 +23,18 @@
  __libc_rwlock_trywrlock
  __libc_rwlock_unlock
  __libc_rwlock_wrlock
 +__libc_thr_attr_destroy
 +__libc_thr_attr_init
 +__libc_thr_attr_setdetachstate
  __libc_thr_create
  __libc_thr_curcpu
 +__libc_thr_detach
  __libc_thr_equal
  __libc_thr_errno
  __libc_thr_exit
  __libc_thr_getspecific
  __libc_thr_init
 +__libc_thr_join
  __libc_thr_keycreate
  __libc_thr_keydelete
  __libc_thr_once
 # HG changeset patch
 # User Taylor R Campbell <riastradh%NetBSD.org@localhost>
 # Date 1759545317 0
 #      Sat Oct 04 02:35:17 2025 +0000
 # Branch trunk
 # Node ID 9dd49a563f8e4bd990ee13de2e1780bff15d25cf
 # Parent  66d81a37c965663ebb7a1a57b6049266768f26a4
 # EXP-Topic riastradh-pr59685-libcryptolibpthreadstubs
 openssl: Stop dragging libpthread into every libcrypto user.
 
 Now that libc has the necessary stubs for libcrypto to have an
 optional call to pthread_create, it is not necessary to link all
 libcrypto users againts libpthread too.
 
 Applications that link against libcrypto but not libpthread can't use
 threaded OpenSSL functionality, of course -- OSSL_set_max_threads
 will always fail in such applications.
 
 This reverts all the makefile churn that I found for unnecessary
 libpthread linkage since the openssl 3.5 import.
 
 PR lib/59685: libcrypto should not depend on libpthread
 
 diff -r 66d81a37c965 -r 9dd49a563f8e crypto/external/apache2/openssl/bin/Ma=
 kefile
 --- a/crypto/external/apache2/openssl/bin/Makefile	Sat Oct 04 02:47:51 2025=
  +0000
 +++ b/crypto/external/apache2/openssl/bin/Makefile	Sat Oct 04 02:35:17 2025=
  +0000
 @@ -65,7 +65,6 @@ verify.c \
  version.c \
  x509.c \
 =20
 -CPPFLAGS+=3D -pthread
  CPPFLAGS+=3D -I${OPENSSLSRC} -I${.CURDIR}/../include
  CPPFLAGS+=3D -I${OPENSSLSRC}/include -I${OPENSSLSRC}/apps/include
 =20
 @@ -74,8 +73,8 @@ PROGDPLIBS+=3D    apps ${OPENSSLSRC}/../li
  PROGDPLIBS+=3D    ssl ${OPENSSLSRC}/../lib/libssl
  PROGDPLIBS+=3D    crypto ${OPENSSLSRC}/../lib/libcrypto
 =20
 -LDADD+=3D	-lcrypt -lpthread
 -DPADD+=3D	${LIBCRYPT} ${LIBPTHREAD}
 +LDADD+=3D	-lcrypt
 +DPADD+=3D	${LIBCRYPT}
 =20
  CRYPTODIST=3D	${NETBSDSRCDIR}/crypto
  .include "${NETBSDSRCDIR}/crypto/Makefile.openssl"
 diff -r 66d81a37c965 -r 9dd49a563f8e crypto/external/apache2/openssl/dist/c=
 rypto/thread/api.c
 --- a/crypto/external/apache2/openssl/dist/crypto/thread/api.c	Sat Oct 04 0=
 2:47:51 2025 +0000
 +++ b/crypto/external/apache2/openssl/dist/crypto/thread/api.c	Sat Oct 04 0=
 2:35:17 2025 +0000
 @@ -62,6 +62,15 @@ int OSSL_set_max_threads(OSSL_LIB_CTX *c
      tdata =3D OSSL_LIB_CTX_GET_THREADS(ctx);
      if (tdata =3D=3D NULL)
          return 0;
 +#ifdef __NetBSD__
 +    /*
 +     * Applications must link against libpthread in order to enable
 +     * openssl thread support.
 +     */
 +    extern int __isthreaded;	/* XXX */
 +    if (!__isthreaded)
 +        return 0;
 +#endif
 =20
      ossl_crypto_mutex_lock(tdata->lock);
      tdata->max_threads =3D max_threads;
 diff -r 66d81a37c965 -r 9dd49a563f8e crypto/external/apache2/openssl/lib/li=
 bcrypto/Makefile
 --- a/crypto/external/apache2/openssl/lib/libcrypto/Makefile	Sat Oct 04 02:=
 47:51 2025 +0000
 +++ b/crypto/external/apache2/openssl/lib/libcrypto/Makefile	Sat Oct 04 02:=
 35:17 2025 +0000
 @@ -25,7 +25,6 @@ USE_FIPS=3D	no
  .include <bsd.own.mk>
  .include <bsd.shlib.mk>
 =20
 -CPPFLAGS+=3D -pthread
  CPPFLAGS+=3D -Dlib${LIB} -I. -I${OPENSSLSRC}/crypto -I${OPENSSLSRC}
  CPPFLAGS+=3D -I${OPENSSLSRC}/include -I${OPENSSLSRC}/crypto/include
  CPPFLAGS+=3D -I${OPENSSLSRC}/crypto/asn1 -I${OPENSSLSRC}/crypto/evp
 @@ -51,7 +50,6 @@ CPPFLAGS+=3D -I${OPENSSLSRC}/providers/imp
 =20
  AFLAGS+=3D-DELF
  LIBDPLIBS+=3D crypt ${NETBSDSRCDIR}/lib/libcrypt
 -LIBDPLIBS+=3D pthread ${NETBSDSRCDIR}/lib/libpthread
 =20
  OS_VERSION!=3D ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
 =20
 diff -r 66d81a37c965 -r 9dd49a563f8e crypto/external/bsd/heimdal/Makefile.i=
 nc
 --- a/crypto/external/bsd/heimdal/Makefile.inc	Sat Oct 04 02:47:51 2025 +00=
 00
 +++ b/crypto/external/bsd/heimdal/Makefile.inc	Sat Oct 04 02:35:17 2025 +00=
 00
 @@ -22,8 +22,8 @@ DPLIBROKEN=3D	roken ${HEIMBASE}/lib/librok
  DPLIBSL=3D	sl ${HEIMBASE}/lib/libsl
  DPLIBVERS=3D	vers ${HEIMBASE}/lib/libvers
  DPLIBWIND=3D	wind ${HEIMBASE}/lib/libwind
 -KRB5LDADD=3D	-lcrypto -lcrypt -lpthread
 -KRB5DPADD=3D	${LIBCRYPTO} ${LIBCRYPT} ${LIBPTHREAD}
 +KRB5LDADD=3D	-lcrypto -lcrypt
 +KRB5DPADD=3D	${LIBCRYPTO} ${LIBCRYPT}
  HDBLDADD=3D	-lsqlite3 -lm
  HDBDPADD=3D	${LIBSQLITE3} ${LIBM}
 =20
 diff -r 66d81a37c965 -r 9dd49a563f8e crypto/external/bsd/heimdal/bin/hxtool=
 /Makefile
 --- a/crypto/external/bsd/heimdal/bin/hxtool/Makefile	Sat Oct 04 02:47:51 2=
 025 +0000
 +++ b/crypto/external/bsd/heimdal/bin/hxtool/Makefile	Sat Oct 04 02:35:17 2=
 025 +0000
 @@ -20,5 +20,5 @@ COPTS.hxtool.c+=3D -Wno-error=3Ddeprecated-d
  .include <${HEIMBASE}/Makefile.rules.inc>
  .include <bsd.prog.mk>
 =20
 -LDADD+=3D -lcrypto -ledit -lterminfo -lpthread
 -DPADD+=3D ${LIBCRYPTO} ${LIBEDIT} ${LIBTERMINFO} ${LIBPTHREAD}
 +LDADD+=3D -lcrypto -ledit -lterminfo
 +DPADD+=3D ${LIBCRYPTO} ${LIBEDIT} ${LIBTERMINFO}
 diff -r 66d81a37c965 -r 9dd49a563f8e crypto/external/bsd/netpgp/bin/Makefil=
 e.inc
 --- a/crypto/external/bsd/netpgp/bin/Makefile.inc	Sat Oct 04 02:47:51 2025 =
 +0000
 +++ b/crypto/external/bsd/netpgp/bin/Makefile.inc	Sat Oct 04 02:35:17 2025 =
 +0000
 @@ -12,5 +12,5 @@ LIBMJDIR!=3D	cd ${.PARSEDIR}/../libmj && $
  LDADD+=3D		-L${LIBMJDIR} -lmj
  DPADD+=3D		${LIBMJDIR}/libmj.a
 =20
 -LDADD+=3D		-lcrypto -lz -lbz2 -lpthread
 -DPADD+=3D		${LIBCRYPTO} ${LIBZ} ${LIBBZ2} ${LIBPTHREAD}
 +LDADD+=3D		-lcrypto -lz -lbz2
 +DPADD+=3D		${LIBCRYPTO} ${LIBZ} ${LIBBZ2}
 diff -r 66d81a37c965 -r 9dd49a563f8e crypto/external/bsd/openssh/bin/Makefi=
 le.inc
 --- a/crypto/external/bsd/openssh/bin/Makefile.inc	Sat Oct 04 02:47:51 2025=
  +0000
 +++ b/crypto/external/bsd/openssh/bin/Makefile.inc	Sat Oct 04 02:35:17 2025=
  +0000
 @@ -8,7 +8,6 @@ PROGDPLIBS+=3D \
      ssh ${CRYPTOBSD}/openssh/lib \
      crypto ${CRYPTOBSD:H}/${EXTERNAL_OPENSSL_SUBDIR}/lib/libcrypto \
      crypt ${NETBSDSRCDIR}/lib/libcrypt \
 -    z ${NETBSDSRCDIR}/lib/libz \
 -    pthread ${NETBSDSRCDIR}/lib/libpthread
 +    z ${NETBSDSRCDIR}/lib/libz
 =20
  .include "${.PARSEDIR}/../Makefile.inc"
 diff -r 66d81a37c965 -r 9dd49a563f8e external/bsd/libfido2/bin/Makefile.inc
 --- a/external/bsd/libfido2/bin/Makefile.inc	Sat Oct 04 02:47:51 2025 +0000
 +++ b/external/bsd/libfido2/bin/Makefile.inc	Sat Oct 04 02:35:17 2025 +0000
 @@ -4,6 +4,5 @@
 =20
  .PATH: ${DIST}/tools ${DIST}/man ${DIST}/openbsd-compat
 =20
 -LDADD+=3D-lfido2 -lcbor -lusbhid -lcrypto -lz -lm -lpthread
 -DPADD+=3D${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBZ} ${LIBM} \
 -    ${LIBPTHREAD}
 +LDADD+=3D-lfido2 -lcbor -lusbhid -lcrypto -lz -lm
 +DPADD+=3D${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBZ} ${LIBM}
 diff -r 66d81a37c965 -r 9dd49a563f8e external/bsd/nsd/Makefile.inc
 --- a/external/bsd/nsd/Makefile.inc	Sat Oct 04 02:47:51 2025 +0000
 +++ b/external/bsd/nsd/Makefile.inc	Sat Oct 04 02:35:17 2025 +0000
 @@ -23,7 +23,6 @@ DPLIBS+=3D ssl ${NETBSDSRCDIR}/crypto/exte
  DPLIBS+=3D crypto ${NETBSDSRCDIR}/crypto/external/${EXTERNAL_OPENSSL_SUBDI=
 R}/lib/libcrypto
  DPLIBS+=3D crypt ${NETBSDSRCDIR}/lib/libcrypt
  DPLIBS+=3D util ${NETBSDSRCDIR}/lib/libutil
 -DPLIBS+=3D pthread ${NETBSDSRCDIR}/lib/libpthread
 =20
  __subst: .USE
  	${TOOL_SED} \
 diff -r 66d81a37c965 -r 9dd49a563f8e external/bsd/ntp/Makefile.inc
 --- a/external/bsd/ntp/Makefile.inc	Sat Oct 04 02:47:51 2025 +0000
 +++ b/external/bsd/ntp/Makefile.inc	Sat Oct 04 02:35:17 2025 +0000
 @@ -35,8 +35,8 @@ LIBPARSE!=3D	cd ${.CURDIR}/../../lib/libpa
  LDADD+=3D		-L${LIBNTP} -lntp -L${LIBOPTS} -lopts
  DPADD+=3D		${LIBNTP}/libntp.a ${LIBOPTS}/libopts.a
 =20
 -LDADD+=3D		-lcrypto -lcrypt -lpthread
 -DPADD+=3D		${LIBCRYPTO} ${LIBCRYPT} ${LIBPTHREAD}
 +LDADD+=3D		-lcrypto -lcrypt
 +DPADD+=3D		${LIBCRYPTO} ${LIBCRYPT}
 =20
  .if ${MKMDNS:Uno} !=3D "no"
  CPPFLAGS+=3D-DHAVE_DNSREGISTRATION=3D1
 diff -r 66d81a37c965 -r 9dd49a563f8e external/bsd/pam-u2f/bin/pamu2fcfg/Mak=
 efile
 --- a/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile	Sat Oct 04 02:47:51 2025 =
 +0000
 +++ b/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile	Sat Oct 04 02:35:17 2025 =
 +0000
 @@ -16,9 +16,8 @@ PROG=3Dpamu2fcfg
  SRCS=3Dpamu2fcfg.c cmdline.c b64.c readpassphrase.c explicit_bzero.c util.c
  COPTS.util.c +=3D -Wno-error=3Dstack-protector
 =20
 -LDADD+=3D-lpam -lfido2 -lcbor -lusbhid -lcrypto -lm -lpthread
 -DPADD+=3D${LIBPAM} ${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBM=
 } \
 -    ${LIBPTHREAD}
 +LDADD+=3D-lpam -lfido2 -lcbor -lusbhid -lcrypto -lm
 +DPADD+=3D${LIBPAM} ${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBM}
 =20
  pamu2fcfg.1:
  	asciidoc -b docbook45 -d manpage -o pamu2fcfg.1.xml ../../dist/man/pamu2f=
 cfg.1.txt
 diff -r 66d81a37c965 -r 9dd49a563f8e external/bsd/ppp/usr.sbin/pppd/Makefile
 --- a/external/bsd/ppp/usr.sbin/pppd/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/external/bsd/ppp/usr.sbin/pppd/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -64,8 +64,6 @@ DPADD+=3D${LIBPAM} ${PAM_STATIC_DPADD}
 =20
  LDADD+=3D -lpcap -lcrypt -lssl -lcrypto -lutil -Wl,--export-dynamic
  DPADD+=3D ${LIBPCAP} ${LIBCRYPT} ${LIBSSL} ${LIBCRYPTO} ${LIBUTIL}
 -LDADD+=3D -lpthread
 -DPADD+=3D ${LIBPTHREAD}
 =20
  .for f in chap-md5 chap_ms eap
  COPTS.${f}.c+=3D	-Wno-pointer-sign
 diff -r 66d81a37c965 -r 9dd49a563f8e external/bsd/tcpdump/bin/Makefile
 --- a/external/bsd/tcpdump/bin/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/external/bsd/tcpdump/bin/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -211,8 +211,8 @@ CPPFLAGS+=3D-DHAVE_OS_IPV6_SUPPORT=3D1
  .endif
 =20
  CPPFLAGS+=3D-DHAVE_LIBCRYPTO=3D1 -DHAVE_OPENSSL_EVP_H=20
 -LDADD+=3D	-lcrypto -lcrypt -lpthread
 -DPADD+=3D	${LIBCRYPTO} ${LIBCRYPT} ${LIBPTHREAD}
 +LDADD+=3D	-lcrypto -lcrypt
 +DPADD+=3D	${LIBCRYPTO} ${LIBCRYPT}
 =20
  CLEANFILES+=3D	version.c tcpdump.8
 =20
 diff -r 66d81a37c965 -r 9dd49a563f8e external/bsd/wpa/bin/hostapd/Makefile
 --- a/external/bsd/wpa/bin/hostapd/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/external/bsd/wpa/bin/hostapd/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -251,8 +251,8 @@ ikev2.c \
  tncs.c
 =20
 =20
 -DPADD+=3D ${LIBSSL} ${LIBCRYPTO} ${LIBDES} ${LIBPTHREAD}
 -LDADD+=3D -lssl -lcrypto -ldes -lpthread
 +DPADD+=3D ${LIBSSL} ${LIBCRYPTO} ${LIBDES}
 +LDADD+=3D -lssl -lcrypto -ldes
  .else
  CPPFLAGS+=3D -DINTERNAL_AES -DINTERNAL_MD5 -DINTERNAL_SHA1 -DCONFIG_NO_PBK=
 DF2
  CPPFLAGS+=3D -DCONFIG_CRYPTO_INTERNAL
 diff -r 66d81a37c965 -r 9dd49a563f8e external/bsd/wpa/bin/wpa_passphrase/Ma=
 kefile
 --- a/external/bsd/wpa/bin/wpa_passphrase/Makefile	Sat Oct 04 02:47:51 2025=
  +0000
 +++ b/external/bsd/wpa/bin/wpa_passphrase/Makefile	Sat Oct 04 02:35:17 2025=
  +0000
 @@ -14,8 +14,8 @@ wpabuf.c
 =20
  .if !defined(NO_CRYPT) && !defined(NO_OPENSSL) && !defined(RELEASE_CRUNCH)
  SRCS+=3D crypto_openssl.c
 -DPADD+=3D ${LIBSSL} ${LIBCRYPTO} ${LIBDES} ${LIBPTHREAD}
 -LDADD+=3D -lssl -lcrypto -ldes -lpthread
 +DPADD+=3D ${LIBSSL} ${LIBCRYPTO} ${LIBDES}
 +LDADD+=3D -lssl -lcrypto -ldes
  .else
  CPPFLAGS+=3D -DINTERNAL_AES -DINTERNAL_MD5 -DINTERNAL_SHA1
  CPPFLAGS+=3D -DCONFIG_CRYPTO_INTERNAL
 diff -r 66d81a37c965 -r 9dd49a563f8e external/bsd/wpa/bin/wpa_supplicant/Ma=
 kefile
 --- a/external/bsd/wpa/bin/wpa_supplicant/Makefile	Sat Oct 04 02:47:51 2025=
  +0000
 +++ b/external/bsd/wpa/bin/wpa_supplicant/Makefile	Sat Oct 04 02:35:17 2025=
  +0000
 @@ -176,8 +176,8 @@ aes-omac1.c \
  #CPPFLAGS+=3D -DEAP_FAST
  #SRCS+=3D	eap_fast.c
 =20
 -DPADD+=3D ${LIBSSL} ${LIBCRYPTO} ${LIBDES} ${LIBPTHREAD}
 -LDADD+=3D -lssl -lcrypto -ldes -lpthread
 +DPADD+=3D ${LIBSSL} ${LIBCRYPTO} ${LIBDES}
 +LDADD+=3D -lssl -lcrypto -ldes
  .else
  CPPFLAGS+=3D -DINTERNAL_AES -DINTERNAL_MD5 -DINTERNAL_SHA1 -DCONFIG_NO_PBK=
 DF2
  SRCS+=3D tls_none.c sha1-internal.c md5-internal.c aes-xinternal.c rc4.c
 diff -r 66d81a37c965 -r 9dd49a563f8e games/factor/Makefile
 --- a/games/factor/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/games/factor/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -10,8 +10,8 @@ SRCS=3D	factor.c pr_tbl.c
  CPPFLAGS+=3D-I${PRIMES}
 =20
  CPPFLAGS+=3D-DHAVE_OPENSSL
 -LDADD+=3D	-lcrypto -lcrypt -lpthread
 -DPADD+=3D	${LIBCRYPTO} ${LIBCRYPT} ${LIBPTHREAD}
 +LDADD+=3D	-lcrypto -lcrypt
 +DPADD+=3D	${LIBCRYPTO} ${LIBCRYPT}
 =20
  COPTS.factor.c+=3D -Wno-error=3Ddeprecated-declarations
 =20
 diff -r 66d81a37c965 -r 9dd49a563f8e libexec/httpd/Makefile
 --- a/libexec/httpd/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/libexec/httpd/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -52,8 +52,8 @@ CPPFLAGS+=3D	-DHAVE_NBUTIL_H
  LDADD+=3D		-lnbutil
  .endif
 =20
 -LDADD+=3D	-lssl -lcrypto -lpthread
 -DPADD+=3D	${LIBSSL} ${LIBCRYPTO} ${LIBPTHREAD}
 +LDADD+=3D	-lssl -lcrypto
 +DPADD+=3D	${LIBSSL} ${LIBCRYPTO}
 =20
  #
  # Build release things.
 diff -r 66d81a37c965 -r 9dd49a563f8e share/mk/bsd.prog.mk
 --- a/share/mk/bsd.prog.mk	Sat Oct 04 02:47:51 2025 +0000
 +++ b/share/mk/bsd.prog.mk	Sat Oct 04 02:35:17 2025 +0000
 @@ -205,19 +205,19 @@ LIB${_lib:tu}=3D	${DESTDIR}/usr/lib/lib${_
  LIBKRB5_LDADD+=3D -lkrb5 -lcom_err \
  	-lhx509 -lcrypto -lasn1 \
  	-lwind -lheimbase -lcom_err -lroken \
 -	-lcrypt -lutil -lpthread
 +	-lcrypt -lutil
  LIBKRB5_DPADD+=3D ${LIBKRB5} ${LIBCOM_ERR} \
  	${LIBHX509} ${LIBCRYPTO} ${LIBASN1} \
  	${LIBWIND} ${LIBHEIMBASE} ${LIBCOM_ERR} ${LIBROKEN} \
 -	${LIBCRYPT} ${LIBUTIL} ${LIBPTHREAD}
 +	${LIBCRYPT} ${LIBUTIL}
  LIBGSSAPI_LDADD+=3D -lgssapi -lheimntlm ${LIBKRB5_LDADD}
  LIBGSSAPI_DPADD+=3D ${LIBGSSAPI} ${LIBHEIMNTLM} ${LIBKRB5_DPADD}
  .endif
 =20
  .if (${MKLDAP} !=3D "no")
 -LIBLDAP_LDADD+=3D -lldap -llber ${LIBGSSAPI_LDADD} -lssl -lcrypto -lpthread
 +LIBLDAP_LDADD+=3D -lldap -llber ${LIBGSSAPI_LDADD} -lssl -lcrypto
  LIBLDAP_DPADD+=3D ${LIBLDAP} ${LIBLBER} ${LIBGSSAPI_DPADD} ${LIBSSL} \
 -    ${LIBCRYPTO} ${LIBPTHREAD}
 +    ${LIBCRYPTO}
  .endif
 =20
  # PAM applications, if linked statically, need more libraries
 @@ -226,10 +226,10 @@ PAM_STATIC_LDADD+=3D -lssh
  PAM_STATIC_DPADD+=3D ${LIBSSH}
  .if (${MKKERBEROS} !=3D "no")
  PAM_STATIC_LDADD+=3D -lkafs -lkrb5 -lhx509 -lwind -lasn1 \
 -	-lroken -lcom_err -lheimbase -lcrypto -lsqlite3 -lpthread -lm
 +	-lroken -lcom_err -lheimbase -lcrypto -lsqlite3 -lm
  PAM_STATIC_DPADD+=3D ${LIBKAFS} ${LIBKRB5} ${LIBHX509} ${LIBWIND} ${LIBASN=
 1} \
  	${LIBROKEN} ${LIBCOM_ERR} ${LIBHEIMBASE} ${LIBCRYPTO} ${LIBSQLITE3} \
 -	${LIBPTHREAD} ${LIBM}
 +	${LIBM}
  .endif
  .if (${MKSKEY} !=3D "no")
  PAM_STATIC_LDADD+=3D -lskey
 diff -r 66d81a37c965 -r 9dd49a563f8e tests/crypto/libcrypto/Makefile
 --- a/tests/crypto/libcrypto/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/tests/crypto/libcrypto/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -19,8 +19,8 @@ SUBDIR +=3D lhash sha x509v3
  TESTSDIR=3D	${TESTSBASE}/crypto/libcrypto
 =20
  TESTS_C+=3D		t_sha512trunc
 -DPADD.t_sha512trunc+=3D	${LIBCRYPTO} ${LIBPTHREAD}
 -LDADD.t_sha512trunc+=3D	-lcrypto -lpthread
 +DPADD.t_sha512trunc+=3D	${LIBCRYPTO}
 +LDADD.t_sha512trunc+=3D	-lcrypto
 =20
  .if ${HAVE_OPENSSL} =3D=3D 10
  TESTS_SH=3D	t_certs
 diff -r 66d81a37c965 -r 9dd49a563f8e tests/crypto/libcrypto/Makefile.inc
 --- a/tests/crypto/libcrypto/Makefile.inc	Sat Oct 04 02:47:51 2025 +0000
 +++ b/tests/crypto/libcrypto/Makefile.inc	Sat Oct 04 02:35:17 2025 +0000
 @@ -32,8 +32,8 @@ PROGDPLIBS+=3D	cryptotest ${OPENSSLSRC}/..
  .if ${HELPER_NAME} !=3D "threadstest"
  PROGDPLIBS+=3D	crypto ${OPENSSLSRC}/../lib/libcrypto
  .endif
 -DPADD_AFTER+=3D		${LIBCRYPT} ${LIBPTHREAD}
 -LDADD_AFTER+=3D		-lcrypt -lpthread
 +DPADD+=3D		${LIBCRYPT}
 +LDADD+=3D		-lcrypt
 =20
 =20
  .include <bsd.test.mk>
 diff -r 66d81a37c965 -r 9dd49a563f8e tests/crypto/libcrypto/dh/Makefile
 --- a/tests/crypto/libcrypto/dh/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/tests/crypto/libcrypto/dh/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -3,7 +3,5 @@
  PROGDPLIBSSTATIC=3Dyes
  HELPER_NAME=3D	dhtest
  HELPER_DIR=3D	dh
 -DPADD+=3D ${LIBPTHREAD}
 -LDADD+=3D -lpthread
 =20
  .include <bsd.init.mk>
 diff -r 66d81a37c965 -r 9dd49a563f8e tests/lib/libc/hash/Makefile
 --- a/tests/lib/libc/hash/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/tests/lib/libc/hash/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -6,8 +6,8 @@ TESTSDIR=3D	${TESTSBASE}/lib/libc/hash
 =20
  TESTS_C+=3D	t_sha2
  TESTS_C+=3D	t_hmac
 -LDADD.t_hmac+=3D	-lcrypto -lpthread
 -DDADD.t_hmac+=3D	${LIBCRYPTO} ${LIBPTHREAD}
 +LDADD.t_hmac+=3D	-lcrypto
 +DDADD.t_hmac+=3D	${LIBCRYPTO}
 =20
  TESTS_SH+=3D	t_hash
 =20
 diff -r 66d81a37c965 -r 9dd49a563f8e usr.bin/dc/Makefile
 --- a/usr.bin/dc/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/usr.bin/dc/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -6,8 +6,8 @@ PROG=3D	dc
  SRCS=3D	main.c dc.c bcode.c inout.c mem.c stack.c
 =20
  WARNS=3D6
 -LDADD=3D	-lcrypto -lpthread
 -DPADD=3D	${LIBCRYPTO} ${LIBPTHREAD}
 +LDADD=3D	-lcrypto
 +DPADD=3D	${LIBCRYPTO}
 =20
  SUBDIR.roff+=3DUSD.doc
 =20
 diff -r 66d81a37c965 -r 9dd49a563f8e usr.bin/ftp/Makefile
 --- a/usr.bin/ftp/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/usr.bin/ftp/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -20,8 +20,8 @@ CPPFLAGS+=3D-DNO_EDITCOMPLETE -DNO_ABOUT -
  LDADD+=3D	-ledit -lterminfo
  DPADD+=3D	${LIBEDIT} ${LIBTERMINFO}
  CPPFLAGS+=3D -DWITH_SSL
 -LDADD+=3D -lssl -lcrypto -lpthread
 -DPADD+=3D ${LIBSSL} ${LIBCRYPTO} ${LIBPTHREAD}
 +LDADD+=3D -lssl -lcrypto
 +DPADD+=3D ${LIBSSL} ${LIBCRYPTO}
  .endif
 =20
  .if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} !=
 =3D "no")
 diff -r 66d81a37c965 -r 9dd49a563f8e usr.bin/moduli/Makefile.inc
 --- a/usr.bin/moduli/Makefile.inc	Sat Oct 04 02:47:51 2025 +0000
 +++ b/usr.bin/moduli/Makefile.inc	Sat Oct 04 02:35:17 2025 +0000
 @@ -2,8 +2,8 @@
 =20
  .include <bsd.own.mk>
 =20
 -DPADD+=3D ${LIBCRYPTO} ${LIBPTHREAD}
 -LDADD+=3D -lcrypto -lpthread
 +DPADD+=3D ${LIBCRYPTO}
 +LDADD+=3D -lcrypto
 =20
  .if exists(${.CURDIR}/../../Makefile.inc)
  .include "${.CURDIR}/../../Makefile.inc"
 diff -r 66d81a37c965 -r 9dd49a563f8e usr.bin/nbsvtool/Makefile
 --- a/usr.bin/nbsvtool/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/usr.bin/nbsvtool/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -1,8 +1,8 @@
  # $NetBSD: Makefile,v 1.4 2025/07/19 15:56:31 christos Exp $
 =20
  PROG=3D	nbsvtool
 -LDADD+=3D	-lcrypto -lpthread
 -DPADD+=3D	${LIBCRYPTO} ${LIBPTHREAD}
 +LDADD+=3D	-lcrypto
 +DPADD+=3D	${LIBCRYPTO}
  CPPFLAGS+=3D-DOPENSSL_API_COMPAT=3D0x10100000L
 =20
  .include <bsd.prog.mk>
 diff -r 66d81a37c965 -r 9dd49a563f8e usr.sbin/plainrsa-gen/Makefile
 --- a/usr.sbin/plainrsa-gen/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/usr.sbin/plainrsa-gen/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -9,8 +9,8 @@ SRCS+=3D	plainrsa-gen.c
  MAN=3D	plainrsa-gen.8
 =20
  CPPFLAGS+=3D-DNOUSE_PRIVSEP
 -LDADD+=3D -lcrypto -lipsec -lpthread
 -DPADD+=3D ${LIBCRYPTO} ${LIBIPSEC} ${LIBPTHREAD}
 +LDADD+=3D -lcrypto -lipsec
 +DPADD+=3D ${LIBCRYPTO} ${LIBIPSEC}
 =20
  .include "${.CURDIR}/../racoon/Makefile.racoon"
 =20
 diff -r 66d81a37c965 -r 9dd49a563f8e usr.sbin/syslogd/Makefile
 --- a/usr.sbin/syslogd/Makefile	Sat Oct 04 02:47:51 2025 +0000
 +++ b/usr.sbin/syslogd/Makefile	Sat Oct 04 02:35:17 2025 +0000
 @@ -28,8 +28,8 @@ CPPFLAGS+=3D-DOPENSSL_API_COMPAT=3D0x1010000
  LDADD+=3D	-lwrap -lblocklist=20
  DPADD+=3D	${LIBWRAP} ${LIBBLOCKLIST}=20
 =20
 -LDADD+=3D	-lssl -lcrypto -lpthread
 -DPADD+=3D ${LIBSSL} ${LIBCRYPTO} ${LIBPTHREAD}
 +LDADD+=3D	-lssl -lcrypto
 +DPADD+=3D ${LIBSSL} ${LIBCRYPTO}
 =20
  # Overflow that appears impossible
  COPTS.syslogd.c+=3D        ${CC_WNO_FORMAT_TRUNCATION} ${CC_WNO_STRINGOP_T=
 RUNCATION}
 
 --=_yZfuFEUR5sBHB86OQy7idKn1uESPEWyt--
 


Home | Main Index | Thread Index | Old Index