head	1.7;
access;
symbols
	netbsd-11-0-RC4:1.5.2.1
	netbsd-11-0-RC3:1.5.2.1
	netbsd-11-0-RC2:1.5.2.1
	netbsd-11-0-RC1:1.5.2.1
	perseant-exfatfs-base-20250801:1.5
	netbsd-11:1.5.0.2
	netbsd-11-base:1.5
	netbsd-10-1-RELEASE:1.4
	perseant-exfatfs-base-20240630:1.4
	perseant-exfatfs:1.4.0.14
	perseant-exfatfs-base:1.4
	netbsd-8-3-RELEASE:1.3
	netbsd-9-4-RELEASE:1.4
	netbsd-10-0-RELEASE:1.4
	netbsd-10-0-RC6:1.4
	netbsd-10-0-RC5:1.4
	netbsd-10-0-RC4:1.4
	netbsd-10-0-RC3:1.4
	netbsd-10-0-RC2:1.4
	netbsd-10-0-RC1:1.4
	netbsd-10:1.4.0.12
	netbsd-10-base:1.4
	netbsd-9-3-RELEASE:1.4
	cjep_sun2x-base1:1.4
	cjep_sun2x:1.4.0.10
	cjep_sun2x-base:1.4
	cjep_staticlib_x-base1:1.4
	netbsd-9-2-RELEASE:1.4
	cjep_staticlib_x:1.4.0.8
	cjep_staticlib_x-base:1.4
	netbsd-9-1-RELEASE:1.4
	phil-wifi-20200421:1.4
	phil-wifi-20200411:1.4
	is-mlppp:1.4.0.6
	is-mlppp-base:1.4
	phil-wifi-20200406:1.4
	netbsd-8-2-RELEASE:1.3
	netbsd-9-0-RELEASE:1.4
	netbsd-9-0-RC2:1.4
	netbsd-9-0-RC1:1.4
	phil-wifi-20191119:1.4
	netbsd-9:1.4.0.4
	netbsd-9-base:1.4
	phil-wifi-20190609:1.4
	netbsd-8-1-RELEASE:1.3
	netbsd-8-1-RC1:1.3
	pgoyette-compat-merge-20190127:1.3.8.1
	pgoyette-compat-20190127:1.4
	pgoyette-compat-20190118:1.4
	pgoyette-compat-1226:1.4
	pgoyette-compat-1126:1.4
	pgoyette-compat-1020:1.4
	pgoyette-compat-0930:1.4
	pgoyette-compat-0906:1.4
	pgoyette-compat-0728:1.4
	netbsd-8-0-RELEASE:1.3
	phil-wifi:1.4.0.2
	phil-wifi-base:1.4
	pgoyette-compat-0625:1.4
	netbsd-8-0-RC2:1.3
	pgoyette-compat-0521:1.3
	pgoyette-compat-0502:1.3
	pgoyette-compat-0422:1.3
	netbsd-8-0-RC1:1.3
	pgoyette-compat-0415:1.3
	pgoyette-compat-0407:1.3
	pgoyette-compat-0330:1.3
	pgoyette-compat-0322:1.3
	pgoyette-compat-0315:1.3
	pgoyette-compat:1.3.0.8
	pgoyette-compat-base:1.3
	matt-nb8-mediatek:1.3.0.6
	matt-nb8-mediatek-base:1.3
	perseant-stdc-iso10646:1.3.0.4
	perseant-stdc-iso10646-base:1.3
	netbsd-8:1.3.0.2
	netbsd-8-base:1.3
	prg-localcount2-base3:1.2
	prg-localcount2-base2:1.2
	prg-localcount2-base1:1.2
	prg-localcount2:1.2.0.6
	prg-localcount2-base:1.2
	pgoyette-localcount:1.2.0.4
	pgoyette-localcount-20170426:1.2
	bouyer-socketcan:1.2.0.2
	bouyer-socketcan-base1:1.2
	OpenBSD-20170410:1.1.1.1
	OPENBSD:1.1.1;
locks; strict;
comment	@# @;


1.7
date	2025.10.19.01.00.00;	author riastradh;	state Exp;
branches;
next	1.6;
commitid	so4x7W8YXx0gf7fG;

1.6
date	2025.09.18.03.36.01;	author mrg;	state Exp;
branches;
next	1.5;
commitid	RQc1sc69acbZ59bG;

1.5
date	2025.07.19.12.21.52;	author christos;	state Exp;
branches
	1.5.2.1;
next	1.4;
commitid	wddCBZjbuNXwYl3G;

1.4
date	2018.06.11.14.18.17;	author kamil;	state Exp;
branches
	1.4.14.1;
next	1.3;
commitid	9pG6Y4T5X8a51SFA;

1.3
date	2017.05.21.15.28.43;	author riastradh;	state Exp;
branches
	1.3.8.1;
next	1.2;
commitid	qFvwLLy2KgFGNgSz;

1.2
date	2017.04.10.16.37.48;	author christos;	state Exp;
branches
	1.2.2.1
	1.2.4.1;
next	1.1;
commitid	9tubolmWs4Ryw0Nz;

1.1
date	2017.04.10.16.34.18;	author christos;	state Exp;
branches
	1.1.1.1;
next	;
commitid	P9WVAD4QdW3Fv0Nz;

1.5.2.1
date	2025.11.20.18.46.43;	author martin;	state Exp;
branches;
next	;
commitid	ggkiZDsnElnr7kjG;

1.4.14.1
date	2025.08.02.05.58.25;	author perseant;	state Exp;
branches;
next	;
commitid	23j6GFaDws3O875G;

1.3.8.1
date	2018.06.25.07.26.10;	author pgoyette;	state Exp;
branches;
next	;
commitid	8PtAu9af7VvhiDHA;

1.2.2.1
date	2017.04.10.16.37.48;	author christos;	state dead;
branches;
next	1.2.2.2;

1.2.2.2
date	2017.04.10.16.37.49;	author christos;	state Exp;
branches;
next	;

1.2.4.1
date	2017.04.10.16.37.48;	author pgoyette;	state dead;
branches;
next	1.2.4.2;
commitid	ojV02aOSdzvBqZOz;

1.2.4.2
date	2017.04.26.02.53.34;	author pgoyette;	state Exp;
branches;
next	;
commitid	ojV02aOSdzvBqZOz;

1.1.1.1
date	2017.04.10.16.34.18;	author christos;	state Exp;
branches;
next	;
commitid	P9WVAD4QdW3Fv0Nz;


desc
@@


1.7
log
@openssl: Stop dragging libpthread into every libcrypto user.

With the new _NETBSD_PTHREAD_CREATE_WEAK, libcrypto can have a call
to pthread_create without linking against libpthread, so it is not
necessary to link all libcrypto users against 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
@
text
@#	$NetBSD: Makefile,v 1.6 2025/09/18 03:36:01 mrg Exp $

.include <bsd.own.mk>

PROG=	dc
SRCS=	main.c dc.c bcode.c inout.c mem.c stack.c

WARNS=6
LDADD=	-lcrypto
DPADD=	${LIBCRYPTO}

SUBDIR.roff+=USD.doc

COPTS.bcode.c+=	${CC_WNO_CALLOC_TRANSPOSED_ARGS}

.include <bsd.prog.mk>
.include <bsd.subdir.mk>
@


1.6
log
@introduce a couple of new turn-off-gcc-warning variables and use them.

GCC 14 has a new annoying calloc() checker that we turn off in a bunch
of places, and there are a few more dangling-pointer issuse that come up,
but seem bogus.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.5 2025/07/19 12:21:52 christos Exp $
d9 2
a10 2
LDADD=	-lcrypto -lpthread
DPADD=	${LIBCRYPTO} ${LIBPTHREAD}
@


1.5
log
@crypto needs threads
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.4 2018/06/11 14:18:17 kamil Exp $
d14 2
@


1.5.2.1
log
@Pull up following revision(s) (requested by riz in ticket #90):

	games/factor/Makefile: revision 1.17
	etc/mtree/NetBSD.dist.tests: revision 1.211
	usr.sbin/plainrsa-gen/Makefile: revision 1.8
	tests/lib/libpthread/weak/t_pthread_weak_threaded.c: revision 1.1
	lib/libc/shlib_version: revision 1.300
	tests/lib/libpthread/weak/test/Makefile: file removal
	libexec/httpd/Makefile: revision 1.37
	usr.bin/nbsvtool/Makefile: revision 1.5
	usr.bin/moduli/Makefile.inc: revision 1.4
	distrib/sets/lists/tests/shl.mi: revision 1.17
	external/bsd/nsd/Makefile.inc: revision 1.11
	tests/lib/libpthread/weak/test/t_pthread_weak_threaded.c: revision 1.1
	tests/lib/libpthread/weak/Makefile: revision 1.1
	tests/lib/libpthread/weak/test/Makefile: revision 1.1
	tests/lib/libpthread/weak/Makefile: revision 1.2
	lib/libpthread/pthread.c: revision 1.188
	crypto/external/apache2/openssl/dist/crypto/thread/api.c: revision 1.2
	usr.sbin/syslogd/Makefile: revision 1.39
	tests/lib/libpthread/weak/test/t_pthread_weak_nothread.c: file removal
	lib/libpthread/pthread_mi.expsym: revision 1.3
	distrib/sets/lists/base/shl.mi: revision 1.1015
	crypto/external/apache2/openssl/lib/libssl/thread.inc: revision 1.2
	usr.bin/dc/Makefile: revision 1.7
	tests/usr.bin/cc/Makefile: revision 1.10
	tests/crypto/libcrypto/Makefile: revision 1.18
	tests/lib/libpthread/weak/t_pthread_weak_nothread.c: revision 1.1
	lib/libpthread/pthread_attr.c: revision 1.22
	crypto/external/apache2/openssl/lib/libcrypto/thread.inc: revision 1.2
	external/bsd/wpa/bin/wpa_passphrase/Makefile: revision 1.8
	external/bsd/tcpdump/bin/Makefile: revision 1.29
	external/bsd/ppp/usr.sbin/pppd/Makefile: revision 1.6
	lib/libpthread/pthread.h: revision 1.42
	crypto/external/bsd/heimdal/Makefile.inc: revision 1.14
	tests/lib/libpthread/weak/test/t_pthread_weak_nothread.c: revision 1.1
	distrib/sets/lists/debug/shl.mi: revision 1.373
	usr.bin/ftp/Makefile: revision 1.44
	crypto/external/bsd/netpgp/bin/Makefile.inc: revision 1.2
	distrib/sets/lists/tests/mi: revision 1.1395
	external/bsd/pam-u2f/bin/pamu2fcfg/Makefile: revision 1.8
	distrib/sets/lists/tests/mi: revision 1.1396
	distrib/sets/lists/debug/shl.mi: revision 1.376
	tests/lib/libpthread/Makefile: revision 1.20
	tests/lib/libc/hash/Makefile: revision 1.6
	tests/crypto/libcrypto/dh/Makefile: revision 1.4
	tests/lib/libpthread/Makefile: revision 1.21
	tests/lib/libpthread/weak/lib/Makefile: revision 1.1
	tests/lib/libpthread/weak/Makefile.inc: revision 1.1
	tests/lib/libpthread/Makefile: revision 1.22
	crypto/external/apache2/openssl/lib/libcrypto/Makefile: revision 1.3
	external/bsd/libfido2/bin/Makefile.inc: revision 1.5
	lib/libc/include/reentrant.h: revision 1.24
	tests/lib/libpthread/weak/lib/h_pthread_weak.h: revision 1.1
	tests/lib/libpthread/weak/lib/h_pthread_weak.c: revision 1.1
	share/mk/bsd.prog.mk: revision 1.357
	tests/crypto/libcrypto/Makefile.inc: revision 1.14
	lib/libpthread/shlib_version: revision 1.21
	external/bsd/wpa/bin/hostapd/Makefile: revision 1.21
	external/bsd/ntp/Makefile.inc: revision 1.26
	crypto/external/bsd/heimdal/bin/hxtool/Makefile: revision 1.8
	external/bsd/wpa/bin/wpa_supplicant/Makefile: revision 1.14
	distrib/sets/lists/debug/mi: revision 1.487
	crypto/external/apache2/openssl/bin/Makefile: revision 1.2
	lib/libc/thread-stub/thread-stub.c: revision 1.34
	tests/usr.bin/cc/t_pthread_abuse.sh: revision 1.1
	tests/lib/libpthread/weak/test/t_pthread_weak_threaded.c: file removal
	crypto/external/bsd/openssh/bin/Makefile.inc: revision 1.8

libpthread: Test pthread_create link errors without -(l)pthread.

Prompted by:
PR lib/59685: libcrypto should not depend on libpthread

libc: Expose some more pthread stubs.

Additionally, provide the option for pthread.h to expose
pthread_create so that libc can provide a weak stub for it, if you
define _NETBSD_PTHREAD_CREATE_WEAK.

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.h macros defined:
pthread_attr_destroy            __libc_thr_attr_destroy
pthread_attr_init               __libc_thr_attr_init
pthread_attr_setdetachstate     __libc_thr_attr_setdetachstate
pthread_detach                  __libc_thr_detach
pthread_join                    __libc_thr_join

New pthread.h macros defined if _NETBSD_PTHREAD_CREATE_WEAK is
defined first:
pthread_create                  __libc_thr_create

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
for the real pthread_create, so there is no need to add a new one.
PR lib/59685: libcrypto should not depend on libpthread

libpthread: Test pthread stubs in threaded vs non-threaded programs.
PR lib/59685: libcrypto should not depend on libpthread

libpthread: append to SUBDIR instead of overwrite it
Noticed and from &lt;riastradh&gt;, thanks!
PR lib/59685: libcrypto should not depend on libpthread

tests/lib/libpthread: Fix tests in subdirectory.
Need to use TESTS_SUBDIRS for this, not SUBDIR.  Avoid the extra
nesting level while here; can make the library be a subdirectory of
the directory where the tests live.
PR lib/59685: libcrypto should not depend on libpthread

openssl: Stop dragging libpthread into every libcrypto user.

With the new _NETBSD_PTHREAD_CREATE_WEAK, libcrypto can have a call
to pthread_create without linking against libpthread, so it is not
necessary to link all libcrypto users against 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

libc, libpthread: Bump for pthread stub additions.

New symbols were added a couple weeks ago but I forgot to bump the
shlib minors.
PR lib/59685: libcrypto should not depend on libpthread
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.5 2025/07/19 12:21:52 christos Exp $
d9 2
a10 2
LDADD=	-lcrypto
DPADD=	${LIBCRYPTO}
@


1.4
log
@Restore the MKGROFF=bo MKCXX=yes build

Mark the documentation in dc(1), gprof(1), rogue(6) and fsck_ffs(8) with
the .roff flag in SUBDIR.

Sponsored by <The NetBSD Foundation>
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.3 2017/05/21 15:28:43 riastradh Exp $
d9 2
a10 2
LDADD=	-lcrypto
DPADD=	${LIBCRYPTO}
@


1.4.14.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.5 2025/07/19 12:21:52 christos Exp $
d9 2
a10 2
LDADD=	-lcrypto -lpthread
DPADD=	${LIBCRYPTO} ${LIBPTHREAD}
@


1.3
log
@Remove MKCRYPTO option.

Originally, MKCRYPTO was introduced because the United States
classified cryptography as a munition and restricted its export.  The
export controls were substantially relaxed fifteen years ago, and are
essentially irrelevant for software with published source code.

In the intervening time, nobody bothered to remove the option after
its motivation -- the US export restriction -- was eliminated.  I'm
not aware of any other operating system that has a similar option; I
expect it is mainly out of apathy for churn that we still have it.
Today, cryptography is an essential part of modern computing -- you
can't use the internet responsibly without cryptography.

The position of the TNF board of directors is that TNF makes no
representation that MKCRYPTO=no satisfies any country's cryptography
regulations.

My personal position is that the availability of cryptography is a
basic human right; that any local laws restricting it to a privileged
few are fundamentally immoral; and that it is wrong for developers to
spend effort crippling cryptography to work around such laws.

As proposed on tech-crypto, tech-security, and tech-userlevel to no
objections:

https://mail-index.netbsd.org/tech-crypto/2017/05/06/msg000719.html
https://mail-index.netbsd.org/tech-security/2017/05/06/msg000928.html
https://mail-index.netbsd.org/tech-userlevel/2017/05/06/msg010547.html

P.S.  Reviewing all the uses of MKCRYPTO in src revealed a lot of
*bad* crypto that was conditional on it, e.g. DES in telnet...  That
should probably be removed too, but on the grounds that it is bad,
not on the grounds that it is (nominally) crypto.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.2 2017/04/10 16:37:48 christos Exp $
d12 1
a12 1
SUBDIR+=USD.doc
@


1.3.8.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.4 2018/06/11 14:18:17 kamil Exp $
d12 1
a12 1
SUBDIR.roff+=USD.doc
@


1.2
log
@build fixes.
@
text
@d1 1
a1 1
#	$NetBSD$
a7 1
.if ${MKCRYPTO:Uno} == "yes"
a10 9
.else
OPENSSL=${NETBSDSRCDIR}/crypto/external/bsd/openssl/dist
.PATH: ${OPENSSL}/crypto/bn
CPPFLAGS+=-I${OPENSSL} -I${OPENSSL}/crypto
SRCS+= bn_lib.c bn_add.c bn_mul.c bn_div.c bn_asm.c bn_word.c bn_shift.c
SRCS+= bn_ctx.c bn_exp.c bn_mod.c bn_sqr.c bn_mont.c bn_recp.c bn_gcd.c
SRCS+= misc.c
COPTS.bn_lib.c += -Wno-cast-qual
.endif
@


1.2.2.1
log
@file Makefile was added on branch bouyer-socketcan on 2017-04-10 16:37:49 +0000
@
text
@d1 25
@


1.2.2.2
log
@758515
@
text
@a0 25
#	$NetBSD: Makefile,v 1.2 2017/04/10 16:37:48 christos Exp $

.include <bsd.own.mk>

PROG=	dc
SRCS=	main.c dc.c bcode.c inout.c mem.c stack.c

.if ${MKCRYPTO:Uno} == "yes"
WARNS=6
LDADD=	-lcrypto
DPADD=	${LIBCRYPTO}
.else
OPENSSL=${NETBSDSRCDIR}/crypto/external/bsd/openssl/dist
.PATH: ${OPENSSL}/crypto/bn
CPPFLAGS+=-I${OPENSSL} -I${OPENSSL}/crypto
SRCS+= bn_lib.c bn_add.c bn_mul.c bn_div.c bn_asm.c bn_word.c bn_shift.c
SRCS+= bn_ctx.c bn_exp.c bn_mod.c bn_sqr.c bn_mont.c bn_recp.c bn_gcd.c
SRCS+= misc.c
COPTS.bn_lib.c += -Wno-cast-qual
.endif

SUBDIR+=USD.doc

.include <bsd.prog.mk>
.include <bsd.subdir.mk>
@


1.2.4.1
log
@file Makefile was added on branch pgoyette-localcount on 2017-04-26 02:53:34 +0000
@
text
@d1 25
@


1.2.4.2
log
@Sync with HEAD
@
text
@a0 25
#	$NetBSD: Makefile,v 1.2 2017/04/10 16:37:48 christos Exp $

.include <bsd.own.mk>

PROG=	dc
SRCS=	main.c dc.c bcode.c inout.c mem.c stack.c

.if ${MKCRYPTO:Uno} == "yes"
WARNS=6
LDADD=	-lcrypto
DPADD=	${LIBCRYPTO}
.else
OPENSSL=${NETBSDSRCDIR}/crypto/external/bsd/openssl/dist
.PATH: ${OPENSSL}/crypto/bn
CPPFLAGS+=-I${OPENSSL} -I${OPENSSL}/crypto
SRCS+= bn_lib.c bn_add.c bn_mul.c bn_div.c bn_asm.c bn_word.c bn_shift.c
SRCS+= bn_ctx.c bn_exp.c bn_mod.c bn_sqr.c bn_mont.c bn_recp.c bn_gcd.c
SRCS+= misc.c
COPTS.bn_lib.c += -Wno-cast-qual
.endif

SUBDIR+=USD.doc

.include <bsd.prog.mk>
.include <bsd.subdir.mk>
@


1.1
log
@Initial revision
@
text
@d1 3
a3 1
#	$OpenBSD: Makefile,v 1.3 2015/10/10 19:28:54 deraadt Exp $
d7 3
a9 1
COPTS+= -Wall
d12 11
d25 1
@


1.1.1.1
log
@Import OpenBSD's dc.
@
text
@@
