2008-05-26 20:51:07 +04:00
|
|
|
# $NetBSD: Makefile,v 1.51 2008/05/26 16:51:07 christos Exp $
|
2000-06-16 08:21:31 +04:00
|
|
|
|
|
|
|
# RCSid:
|
|
|
|
# Id: Makefile,v 1.33 1998/11/11 11:53:53 sjg Exp
|
|
|
|
#
|
|
|
|
# @(#) Copyright (c) 1994 Simon J. Gerraty
|
|
|
|
#
|
|
|
|
# This file is provided in the hope that it will
|
|
|
|
# be of use. There is absolutely NO WARRANTY.
|
|
|
|
# Permission to copy, redistribute or otherwise
|
|
|
|
# use this file is hereby granted provided that
|
|
|
|
# the above copyright notice and this notice are
|
|
|
|
# left intact.
|
|
|
|
#
|
|
|
|
# Please send copies of changes and bug-fixes to:
|
|
|
|
# sjg@quick.com.au
|
|
|
|
#
|
|
|
|
|
Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry. RedHat has
evidently built all "core system packages" with this option for some time.
This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.
This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros. Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.
Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default. Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 16:06:17 +04:00
|
|
|
LIB= crypto
|
|
|
|
USE_FORT?= yes # cryptographic software
|
2002-10-07 04:53:31 +04:00
|
|
|
USE_SHLIBDIR= yes
|
2005-11-25 22:15:08 +03:00
|
|
|
USE_FIPS= no
|
2002-10-07 04:53:31 +04:00
|
|
|
|
2000-06-23 10:01:10 +04:00
|
|
|
.include <bsd.own.mk>
|
Only use the MKDYNAMICROOT semantics (i.e. -rpath=/lib,/usr/lib and
-dynamic-linker=/libexec/ld.elf_so) if the BINDIR of the program being
built is /bin or /sbin.
The reason we do this is because now all programs *except* those in
/bin and /sbin (i.e. the "special cases") match the default the compiler
uses, which is what is used for things in e.g. xsrc, pkgsrc, and other
random 3rd party programs.
This is done by decoupling where a shlib is installed from how it
is located. Two new variables, SHLIBINSTALLDIR and SHLINKINSTALLDIR,
contain the former information, and key off MKDYNAMICROOT only. SHLIBDIR
and SHLINKDIR contain the latter, and key off MKDYNAMICROOT and BINDIR.
The SHLIBINSTALLDIR, SHLIBDIR, _LIBSODIR, SHLINKINSTALLDIR, and
SHLINKDIR parameters are moved to a new <bsd.shlib.mk>; see bsd.README
for usage details.
2002-09-28 01:37:50 +04:00
|
|
|
.include <bsd.shlib.mk>
|
2003-10-26 10:25:33 +03:00
|
|
|
.include <bsd.sys.mk> # for HOST_SH
|
2000-06-23 10:01:10 +04:00
|
|
|
|
2000-06-16 10:16:37 +04:00
|
|
|
# XXX There's a bit of work to do before we can enable warnings.
|
|
|
|
WARNS=0
|
|
|
|
|
2008-05-10 01:52:18 +04:00
|
|
|
CPPFLAGS+= -Dlib${LIB} -I. -I${OPENSSLSRC}/crypto -I${OPENSSLSRC} -I${OPENSSLSRC}/crypto/asn1 -I${OPENSSLSRC}/crypto/evp
|
2000-06-16 08:21:31 +04:00
|
|
|
|
2002-08-19 13:41:27 +04:00
|
|
|
CRYPTODIST= ${NETBSDSRCDIR}/crypto/dist
|
2000-06-16 10:16:37 +04:00
|
|
|
|
2002-08-19 13:41:27 +04:00
|
|
|
.include "${NETBSDSRCDIR}/crypto/Makefile.openssl"
|
2000-06-16 08:21:31 +04:00
|
|
|
.PATH: ${OPENSSLSRC}
|
|
|
|
|
|
|
|
.include "srcs.inc"
|
|
|
|
|
2003-04-17 04:32:22 +04:00
|
|
|
|
2000-06-16 08:21:31 +04:00
|
|
|
# XXX
|
|
|
|
.if ${OBJECT_FMT} == "ELF"
|
|
|
|
AFLAGS+=-DELF
|
Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry. RedHat has
evidently built all "core system packages" with this option for some time.
This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.
This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros. Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.
Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default. Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 16:06:17 +04:00
|
|
|
LIBDPLIBS+= crypt ${.CURDIR}/../libcrypt
|
2000-06-16 08:21:31 +04:00
|
|
|
.else
|
|
|
|
AFLAGS+=-DOUT
|
2005-03-02 04:04:21 +03:00
|
|
|
# XXX: This is broken because we compile with the wrong des headers.
|
|
|
|
# NetBSD's crypt(3) library, in lieu of the one included with OpenSSL,
|
|
|
|
# since NetBSD's also supports MD5, SHA1 and Blowfish passwords.
|
|
|
|
.PATH: ${NETBSDSRCDIR}/lib/libcrypt
|
|
|
|
SRCS+= crypt.c md5crypt.c bcrypt.c crypt-sha1.c util.c
|
2000-06-16 08:21:31 +04:00
|
|
|
.endif
|
|
|
|
|
2003-10-26 10:25:33 +03:00
|
|
|
OS_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
|
2002-06-16 21:57:29 +04:00
|
|
|
|
|
|
|
# XXX CFLAGS: While it would be nice to know which compiler flags
|
|
|
|
# XXX the library was built with, we don't want pathname information
|
|
|
|
# XXX for the host toolchain embedded in the image.
|
2000-06-16 08:21:31 +04:00
|
|
|
${SRCS}: buildinf.h
|
2002-06-16 21:57:29 +04:00
|
|
|
buildinf.h: Makefile
|
2000-06-16 08:21:31 +04:00
|
|
|
@echo "#ifndef MK1MF_BUILD" >buildinf.h
|
2002-06-16 21:57:29 +04:00
|
|
|
@echo "#define CFLAGS \"`${CC} -v 2>&1 | grep version`\"" >>buildinf.h
|
2000-06-16 08:21:31 +04:00
|
|
|
@echo "#define PLATFORM \"NetBSD-${MACHINE_ARCH}\"" >>buildinf.h
|
2002-06-16 21:57:29 +04:00
|
|
|
@echo "#define DATE \"NetBSD ${OS_VERSION}\"" >>buildinf.h
|
2000-06-16 08:21:31 +04:00
|
|
|
@echo "#endif" >>buildinf.h
|
|
|
|
|
|
|
|
CLEANFILES+= buildinf.h
|
|
|
|
|
|
|
|
# This list is built from the contents of the include/openssl
|
|
|
|
# directory in the OpenSSL source distribution.
|
2003-07-24 18:16:30 +04:00
|
|
|
INCS+= aes.h asn1.h asn1_mac.h asn1t.h bio.h blowfish.h bn.h \
|
2008-05-10 01:52:18 +04:00
|
|
|
buffer.h cast.h cms.h comp.h conf.h conf_api.h crypto.h des.h \
|
2005-11-25 22:15:08 +03:00
|
|
|
dh.h dsa.h dso.h e_os2.h ebcdic.h ec.h ecdh.h ecdsa.h engine.h \
|
2003-07-24 18:16:30 +04:00
|
|
|
err.h evp.h hmac.h krb5_asn.h lhash.h md2.h md4.h md5.h \
|
|
|
|
obj_mac.h objects.h ocsp.h opensslconf.h opensslv.h ossl_typ.h \
|
|
|
|
pem.h pem2.h pkcs12.h pkcs7.h rand.h rc2.h rc4.h ripemd.h \
|
2008-05-10 01:52:18 +04:00
|
|
|
rsa.h safestack.h sha.h stack.h store.h symhacks.h ts.h txt_db.h \
|
2008-05-26 20:51:07 +04:00
|
|
|
ui.h ui_compat.h x509.h x509_vfy.h x509v3.h pqueue.h camellia.h
|
2003-07-24 18:16:30 +04:00
|
|
|
# des_old.h
|
2000-06-16 08:21:31 +04:00
|
|
|
|
2000-09-30 04:23:28 +04:00
|
|
|
# IDEA - patented, but we install the header anyways
|
2000-06-23 10:01:10 +04:00
|
|
|
INCS+= idea.h
|
|
|
|
|
2000-09-30 04:23:28 +04:00
|
|
|
# RC5 - patented, but we install the header anyways
|
2000-06-23 10:01:10 +04:00
|
|
|
INCS+= rc5.h
|
|
|
|
|
2003-07-14 17:49:21 +04:00
|
|
|
# MDC2 - patented, but we install the header anyways
|
|
|
|
INCS+= mdc2.h
|
|
|
|
|
2005-11-25 22:15:08 +03:00
|
|
|
.if (${USE_FIPS} != "no")
|
2005-03-25 23:14:40 +03:00
|
|
|
# FIPS
|
2005-03-26 05:21:34 +03:00
|
|
|
# This part is always included, because OpenSSL does not protect
|
|
|
|
# The FIPS include files
|
2005-03-25 23:14:40 +03:00
|
|
|
.PATH: ${OPENSSLSRC}/fips ${OPENSSLSRC}/fips/rand
|
|
|
|
INCS+= fips.h fips_rand.h
|
2005-11-25 22:15:08 +03:00
|
|
|
.endif
|
2005-03-25 23:14:40 +03:00
|
|
|
|
2005-03-26 05:21:34 +03:00
|
|
|
.if (${USE_FIPS} != "no")
|
|
|
|
CPPFLAGS+=-DOPENSSL_FIPS
|
|
|
|
.PATH: ${OPENSSLSRC}/fips/aes
|
|
|
|
SRCS+=fips_aes_core.c fips_aes_selftest.c
|
|
|
|
.PATH: ${OPENSSLSRC}/fips/des
|
|
|
|
SRCS+=fips_des_enc.c fips_des_selftest.c fips_set_key.c
|
|
|
|
# asm/fips-dx86-elf.s
|
|
|
|
.PATH: ${OPENSSLSRC}/fips/dh
|
|
|
|
SRCS+=fips_dh_check.c fips_dh_gen.c fips_dh_key.c
|
|
|
|
.PATH: ${OPENSSLSRC}/fips/dsa
|
|
|
|
SRCS+=fips_dsa_ossl.c fips_dsa_gen.c fips_dsa_selftest.c
|
|
|
|
#.PATH: ${OPENSSLSRC}/fips/rand
|
|
|
|
SRCS+=fips_rand.c
|
|
|
|
.PATH: ${OPENSSLSRC}/fips/rsa
|
|
|
|
SRCS+=fips_rsa_eay.c fips_rsa_gen.c fips_rsa_selftest.c
|
|
|
|
SRCS+=fips_sha1dgst.c fips_sha1_selftest.c
|
|
|
|
# asm/sx86-elf.s
|
|
|
|
.PATH: ${OPENSSLSRC}/fips/sha1
|
|
|
|
#.PATH: ${OPENSSLSRC}/fips
|
|
|
|
SRCS+=fips.c fips_err_wrapper.c
|
|
|
|
|
|
|
|
SRCS+=rc5_skey.c i_skey.c mdc2dgst.c
|
|
|
|
.endif
|
|
|
|
|
2006-11-09 23:45:01 +03:00
|
|
|
COPTS.eng_padlock.c = -Wno-stack-protector
|
|
|
|
|
2000-06-16 10:16:37 +04:00
|
|
|
INCSDIR=/usr/include/openssl
|
|
|
|
|
2000-06-16 08:21:31 +04:00
|
|
|
# this rebuilds the `srcs.inc' and the .inc files it reads.
|
2000-06-23 10:01:10 +04:00
|
|
|
# note that the resulting `srcs.inc' file needs to be modified
|
|
|
|
# to deal with our MKCRYPTO_* configuration variables.
|
2000-06-16 08:21:31 +04:00
|
|
|
|
2008-05-11 00:14:20 +04:00
|
|
|
xxx:
|
|
|
|
echo ${SRCS}
|
|
|
|
|
2000-06-16 10:16:37 +04:00
|
|
|
update_inc:
|
|
|
|
(cd ${.CURDIR}; find ${OPENSSLSRC}/crypto \
|
2007-12-10 00:57:35 +03:00
|
|
|
-name Makefile | \
|
2000-06-16 10:16:37 +04:00
|
|
|
perl ${OPENSSLSRC}/extsrcs.pl 2> srcs.inc )
|
2000-06-16 08:21:31 +04:00
|
|
|
|
|
|
|
.include <bsd.lib.mk>
|