1 # $NetBSD: Makefile,v 1.27 2023/05/09 19:22:07 christos Exp $ 2 3 # RCSid: 4 # Id: Makefile,v 1.33 1998/11/11 11:53:53 sjg Exp 5 # 6 # @(#) Copyright (c) 1994 Simon J. Gerraty 7 # 8 # This file is provided in the hope that it will 9 # be of use. There is absolutely NO WARRANTY. 10 # Permission to copy, redistribute or otherwise 11 # use this file is hereby granted provided that 12 # the above copyright notice and this notice are 13 # left intact. 14 # 15 # Please send copies of changes and bug-fixes to: 16 # sjg (at] quick.com.au 17 # 18 19 LIB= crypto 20 USE_FORT?= yes # cryptographic software 21 USE_SHLIBDIR= yes 22 USE_FIPS= no 23 #DBG=-g 24 25 .include <bsd.own.mk> 26 .include <bsd.shlib.mk> 27 28 # XXX: There's a bit of work to do before we can enable warnings. 29 WARNS=0 30 CWARNFLAGS.clang+= -Wno-empty-body -Wno-unused-value -Wno-parentheses -Wno-implicit-int-float-conversion 31 # XXX: This warning seems to trigger incorrectly 32 CWARNFLAGS.clang+= -Wno-atomic-alignment 33 34 LINTFLAGS+= -X 161 # constant in conditional context 35 LINTFLAGS+= -X 129 # expression has null effect 36 LINTFLAGS+= -X 117 # bitwise '>>' on signed value possibly nonportable 37 LINTFLAGS+= -X 231 # argument '%s' unused in function '%s' 38 LINTFLAGS+= -X 220 # fallthrough on case statement 39 LINTFLAGS+= -X 118 # semantics of '%s' change in ANSI C; use explicit cast 40 41 CPPFLAGS+= -Dlib${LIB} -I. -I${OPENSSLSRC}/crypto -I${OPENSSLSRC} 42 CPPFLAGS+= -I${OPENSSLSRC}/include -I${OPENSSLSRC}/crypto/include 43 CPPFLAGS+= -I${OPENSSLSRC}/crypto/asn1 -I${OPENSSLSRC}/crypto/evp 44 CPPFLAGS+= -I${OPENSSLSRC}/crypto/modes 45 CPPFLAGS+= -I${OPENSSLSRC}/../include 46 47 48 49 CRYPTODIST= ${NETBSDSRCDIR}/crypto 50 OPENSSLINC= ${OPENSSLSRC}/include/openssl 51 52 .include "${NETBSDSRCDIR}/crypto/Makefile.openssl" 53 .PATH: ${OPENSSLSRC} ${OPENSSLINC} 54 .PATH: ${OPENSSLSRC}/../include/openssl 55 56 .include "srcs.inc" 57 .include "${.CURDIR}/../libdefault/srcs.inc" 58 CPPFLAGS+= -I${.CURDIR}/../libdefault 59 CPPFLAGS+= -I${OPENSSLSRC}/providers/common/include 60 CPPFLAGS+= -I${OPENSSLSRC}/providers/implementations/include 61 .PATH: ${.CURDIR}/../libdefault 62 .include "${.CURDIR}/../libcommon/srcs.inc" 63 .PATH: ${.CURDIR}/../libcommon 64 65 AFLAGS+=-DELF 66 LIBDPLIBS+= crypt ${NETBSDSRCDIR}/lib/libcrypt 67 68 OS_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 69 70 # XXX CFLAGS: While it would be nice to know which compiler flags 71 # XXX the library was built with, we don't want pathname information 72 # XXX for the host toolchain embedded in the image. 73 ${SRCS}: buildinf.h 74 buildinf.h: Makefile 75 @echo "#ifndef MK1MF_BUILD" >buildinf.h 76 @echo "#define compiler_flags \"`${CC} -v 2>&1 | grep 'gcc version'`\"" >>buildinf.h 77 @echo "#define PLATFORM \"NetBSD-${MACHINE_ARCH}\"" >>buildinf.h 78 @echo "#define DATE \"NetBSD ${OS_VERSION}\"" >>buildinf.h 79 @echo "#endif" >>buildinf.h 80 81 CLEANFILES+= buildinf.h 82 83 # This list is built from the contents of the include/openssl 84 # directory in the OpenSSL source distribution. 85 INCS+= \ 86 aes.h \ 87 asn1.h \ 88 asn1_mac.h \ 89 asn1err.h \ 90 asn1t.h \ 91 async.h \ 92 asyncerr.h \ 93 bio.h \ 94 bioerr.h \ 95 blowfish.h \ 96 bn.h \ 97 bnerr.h \ 98 buffer.h \ 99 buffererr.h \ 100 camellia.h \ 101 cast.h \ 102 cmac.h \ 103 cmp.h \ 104 cmp_util.h \ 105 cmperr.h \ 106 cms.h \ 107 cmserr.h \ 108 comp.h \ 109 comperr.h \ 110 conf.h \ 111 conf_api.h \ 112 conferr.h \ 113 configuration.h \ 114 conftypes.h \ 115 core.h \ 116 core_dispatch.h \ 117 core_names.h \ 118 core_object.h \ 119 crmf.h \ 120 crmferr.h \ 121 crypto.h \ 122 cryptoerr.h \ 123 cryptoerr_legacy.h \ 124 ct.h \ 125 cterr.h \ 126 decoder.h \ 127 decodererr.h \ 128 des.h \ 129 dh.h \ 130 dherr.h \ 131 dsa.h \ 132 dsaerr.h \ 133 dtls1.h \ 134 e_os2.h \ 135 ebcdic.h \ 136 ec.h \ 137 ecdh.h \ 138 ecdsa.h \ 139 ecerr.h \ 140 encoder.h \ 141 encodererr.h \ 142 engine.h \ 143 engineerr.h \ 144 err.h \ 145 ess.h \ 146 esserr.h \ 147 evp.h \ 148 evperr.h \ 149 fips_names.h \ 150 fipskey.h \ 151 hmac.h \ 152 http.h \ 153 httperr.h \ 154 kdf.h \ 155 kdferr.h \ 156 lhash.h \ 157 macros.h \ 158 md2.h \ 159 md4.h \ 160 md5.h \ 161 modes.h \ 162 obj_mac.h \ 163 objects.h \ 164 objectserr.h \ 165 ocsp.h \ 166 ocsperr.h \ 167 opensslconf.h \ 168 opensslv.h \ 169 ossl_typ.h \ 170 param_build.h \ 171 params.h \ 172 pem.h \ 173 pem2.h \ 174 pemerr.h \ 175 pkcs12.h \ 176 pkcs12err.h \ 177 pkcs7.h \ 178 pkcs7err.h \ 179 prov_ssl.h \ 180 proverr.h \ 181 provider.h \ 182 rand.h \ 183 randerr.h \ 184 rc2.h \ 185 rc4.h \ 186 ripemd.h \ 187 rsa.h \ 188 rsaerr.h \ 189 safestack.h \ 190 seed.h \ 191 self_test.h \ 192 sha.h \ 193 srp.h \ 194 srtp.h \ 195 ssl.h \ 196 ssl2.h \ 197 ssl3.h \ 198 sslerr.h \ 199 sslerr_legacy.h \ 200 stack.h \ 201 store.h \ 202 storeerr.h \ 203 symhacks.h \ 204 tls1.h \ 205 trace.h \ 206 ts.h \ 207 tserr.h \ 208 txt_db.h \ 209 types.h \ 210 ui.h \ 211 uierr.h \ 212 whrlpool.h \ 213 x509.h \ 214 x509_vfy.h \ 215 x509err.h \ 216 x509v3.h \ 217 x509v3err.h 218 219 # IDEA - patented, but we install the header anyways 220 INCS+= idea.h 221 222 # RC5 - patented, but we install the header anyways 223 INCS+= rc5.h 224 225 # MDC2 - patented, but we install the header anyways 226 INCS+= mdc2.h 227 228 .if (${USE_FIPS} != "no") 229 # FIPS 230 # This part is always included, because OpenSSL does not protect 231 # The FIPS include files 232 .PATH: ${OPENSSLSRC}/fips ${OPENSSLSRC}/fips/rand 233 INCS+= fips.h fips_rand.h 234 .endif 235 236 .if (${USE_FIPS} != "no") 237 CPPFLAGS+=-DOPENSSL_FIPS 238 .PATH: ${OPENSSLSRC}/fips/aes 239 SRCS+=fips_aes_core.c fips_aes_selftest.c 240 .PATH: ${OPENSSLSRC}/fips/des 241 SRCS+=fips_des_enc.c fips_des_selftest.c fips_set_key.c 242 # asm/fips-dx86-elf.s 243 .PATH: ${OPENSSLSRC}/fips/dh 244 SRCS+=fips_dh_check.c fips_dh_gen.c fips_dh_key.c 245 .PATH: ${OPENSSLSRC}/fips/dsa 246 SRCS+=fips_dsa_ossl.c fips_dsa_gen.c fips_dsa_selftest.c 247 #.PATH: ${OPENSSLSRC}/fips/rand 248 SRCS+=fips_rand.c 249 .PATH: ${OPENSSLSRC}/fips/rsa 250 SRCS+=fips_rsa_eay.c fips_rsa_gen.c fips_rsa_selftest.c 251 SRCS+=fips_sha1dgst.c fips_sha1_selftest.c 252 # asm/sx86-elf.s 253 .PATH: ${OPENSSLSRC}/fips/sha1 254 #.PATH: ${OPENSSLSRC}/fips 255 SRCS+=fips.c fips_err_wrapper.c 256 257 SRCS+=rc5_skey.c i_skey.c mdc2dgst.c 258 .endif 259 260 COPTS.eng_padlock.c = -Wno-stack-protector 261 262 INCSDIR=/usr/include/openssl 263 264 LDFLAGS+=-Wl,--version-script=${.CURDIR}/crypto.map 265 266 PKGCONFIG=libcrypto 267 .include "${.CURDIR}/../../pkgconfig.mk" 268 269 # too much of a pain to generate opensslv.h / configuration.h / fipskey.h 270 GENH = \ 271 asn1.h \ 272 asn1t.h \ 273 bio.h \ 274 cmp.h \ 275 cms.h \ 276 conf.h \ 277 crmf.h \ 278 crypto.h \ 279 ct.h \ 280 err.h \ 281 ess.h \ 282 lhash.h \ 283 ocsp.h \ 284 pkcs12.h \ 285 pkcs7.h \ 286 safestack.h \ 287 srp.h \ 288 ssl.h \ 289 ui.h \ 290 x509.h \ 291 x509_vfy.h \ 292 x509v3.h 293 294 .for i in ${GENH} 295 $i: $i.in 296 ${_MKTARGET_CREATE} 297 ${.CURDIR}/gen ${.ALLSRC} > ${.TARGET} 298 .endfor 299 300 .include <bsd.lib.mk> 301 302