1 # $NetBSD: Makefile,v 1.25 2023/05/07 19:13:15 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 CRYPTODIST= ${NETBSDSRCDIR}/crypto 49 OPENSSLINC= ${OPENSSLSRC}/include/openssl 50 51 .include "${NETBSDSRCDIR}/crypto/Makefile.openssl" 52 .PATH: ${OPENSSLSRC} ${OPENSSLINC} 53 .PATH: ${OPENSSLSRC}/../include/openssl 54 55 .include "srcs.inc" 56 .include "${.CURDIR}/../libdefault/srcs.inc" 57 CPPFLAGS+= -I${.CURDIR}/../libdefault 58 .PATH: ${.CURDIR}/../libdefault 59 .include "${.CURDIR}/../libcommon/srcs.inc" 60 .PATH: ${.CURDIR}/../libcommon 61 62 AFLAGS+=-DELF 63 LIBDPLIBS+= crypt ${NETBSDSRCDIR}/lib/libcrypt 64 65 OS_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 66 67 # XXX CFLAGS: While it would be nice to know which compiler flags 68 # XXX the library was built with, we don't want pathname information 69 # XXX for the host toolchain embedded in the image. 70 ${SRCS}: buildinf.h 71 buildinf.h: Makefile 72 @echo "#ifndef MK1MF_BUILD" >buildinf.h 73 @echo "#define compiler_flags \"`${CC} -v 2>&1 | grep 'gcc version'`\"" >>buildinf.h 74 @echo "#define PLATFORM \"NetBSD-${MACHINE_ARCH}\"" >>buildinf.h 75 @echo "#define DATE \"NetBSD ${OS_VERSION}\"" >>buildinf.h 76 @echo "#endif" >>buildinf.h 77 78 CLEANFILES+= buildinf.h 79 80 # This list is built from the contents of the include/openssl 81 # directory in the OpenSSL source distribution. 82 INCS+= \ 83 aes.h \ 84 asn1.h \ 85 asn1_mac.h \ 86 asn1err.h \ 87 asn1t.h \ 88 async.h \ 89 asyncerr.h \ 90 bio.h \ 91 bioerr.h \ 92 blowfish.h \ 93 bn.h \ 94 bnerr.h \ 95 buffer.h \ 96 buffererr.h \ 97 camellia.h \ 98 cast.h \ 99 cmac.h \ 100 cmp.h \ 101 cmp_util.h \ 102 cmperr.h \ 103 cms.h \ 104 cmserr.h \ 105 comp.h \ 106 comperr.h \ 107 conf.h \ 108 conf_api.h \ 109 conferr.h \ 110 configuration.h \ 111 conftypes.h \ 112 core.h \ 113 core_dispatch.h \ 114 core_names.h \ 115 core_object.h \ 116 crmf.h \ 117 crmferr.h \ 118 crypto.h \ 119 cryptoerr.h \ 120 cryptoerr_legacy.h \ 121 ct.h \ 122 cterr.h \ 123 decoder.h \ 124 decodererr.h \ 125 des.h \ 126 dh.h \ 127 dherr.h \ 128 dsa.h \ 129 dsaerr.h \ 130 dtls1.h \ 131 e_os2.h \ 132 ebcdic.h \ 133 ec.h \ 134 ecdh.h \ 135 ecdsa.h \ 136 ecerr.h \ 137 encoder.h \ 138 encodererr.h \ 139 engine.h \ 140 engineerr.h \ 141 err.h \ 142 ess.h \ 143 esserr.h \ 144 evp.h \ 145 evperr.h \ 146 fips_names.h \ 147 fipskey.h \ 148 hmac.h \ 149 http.h \ 150 httperr.h \ 151 kdf.h \ 152 kdferr.h \ 153 lhash.h \ 154 macros.h \ 155 md2.h \ 156 md4.h \ 157 md5.h \ 158 modes.h \ 159 obj_mac.h \ 160 objects.h \ 161 objectserr.h \ 162 ocsp.h \ 163 ocsperr.h \ 164 opensslconf.h \ 165 opensslv.h \ 166 ossl_typ.h \ 167 param_build.h \ 168 params.h \ 169 pem.h \ 170 pem2.h \ 171 pemerr.h \ 172 pkcs12.h \ 173 pkcs12err.h \ 174 pkcs7.h \ 175 pkcs7err.h \ 176 prov_ssl.h \ 177 proverr.h \ 178 provider.h \ 179 rand.h \ 180 randerr.h \ 181 rc2.h \ 182 rc4.h \ 183 ripemd.h \ 184 rsa.h \ 185 rsaerr.h \ 186 safestack.h \ 187 seed.h \ 188 self_test.h \ 189 sha.h \ 190 srp.h \ 191 srtp.h \ 192 ssl.h \ 193 ssl2.h \ 194 ssl3.h \ 195 sslerr.h \ 196 sslerr_legacy.h \ 197 stack.h \ 198 store.h \ 199 storeerr.h \ 200 symhacks.h \ 201 tls1.h \ 202 trace.h \ 203 ts.h \ 204 tserr.h \ 205 txt_db.h \ 206 types.h \ 207 ui.h \ 208 uierr.h \ 209 whrlpool.h \ 210 x509.h \ 211 x509_vfy.h \ 212 x509err.h \ 213 x509v3.h \ 214 x509v3err.h 215 216 # IDEA - patented, but we install the header anyways 217 INCS+= idea.h 218 219 # RC5 - patented, but we install the header anyways 220 INCS+= rc5.h 221 222 # MDC2 - patented, but we install the header anyways 223 INCS+= mdc2.h 224 225 .if (${USE_FIPS} != "no") 226 # FIPS 227 # This part is always included, because OpenSSL does not protect 228 # The FIPS include files 229 .PATH: ${OPENSSLSRC}/fips ${OPENSSLSRC}/fips/rand 230 INCS+= fips.h fips_rand.h 231 .endif 232 233 .if (${USE_FIPS} != "no") 234 CPPFLAGS+=-DOPENSSL_FIPS 235 .PATH: ${OPENSSLSRC}/fips/aes 236 SRCS+=fips_aes_core.c fips_aes_selftest.c 237 .PATH: ${OPENSSLSRC}/fips/des 238 SRCS+=fips_des_enc.c fips_des_selftest.c fips_set_key.c 239 # asm/fips-dx86-elf.s 240 .PATH: ${OPENSSLSRC}/fips/dh 241 SRCS+=fips_dh_check.c fips_dh_gen.c fips_dh_key.c 242 .PATH: ${OPENSSLSRC}/fips/dsa 243 SRCS+=fips_dsa_ossl.c fips_dsa_gen.c fips_dsa_selftest.c 244 #.PATH: ${OPENSSLSRC}/fips/rand 245 SRCS+=fips_rand.c 246 .PATH: ${OPENSSLSRC}/fips/rsa 247 SRCS+=fips_rsa_eay.c fips_rsa_gen.c fips_rsa_selftest.c 248 SRCS+=fips_sha1dgst.c fips_sha1_selftest.c 249 # asm/sx86-elf.s 250 .PATH: ${OPENSSLSRC}/fips/sha1 251 #.PATH: ${OPENSSLSRC}/fips 252 SRCS+=fips.c fips_err_wrapper.c 253 254 SRCS+=rc5_skey.c i_skey.c mdc2dgst.c 255 .endif 256 257 COPTS.eng_padlock.c = -Wno-stack-protector 258 259 INCSDIR=/usr/include/openssl 260 261 LDFLAGS+=-Wl,--version-script=${.CURDIR}/crypto.map 262 263 PKGCONFIG=libcrypto 264 .include "${.CURDIR}/../../pkgconfig.mk" 265 266 # too much of a pain to generate opensslv.h / configuration.h / fipskey.h 267 GENH = \ 268 asn1.h \ 269 asn1t.h \ 270 bio.h \ 271 cmp.h \ 272 cms.h \ 273 conf.h \ 274 crmf.h \ 275 crypto.h \ 276 ct.h \ 277 err.h \ 278 ess.h \ 279 lhash.h \ 280 ocsp.h \ 281 pkcs12.h \ 282 pkcs7.h \ 283 safestack.h \ 284 srp.h \ 285 ui.h \ 286 x509.h \ 287 x509_vfy.h \ 288 x509v3.h 289 290 .for i in ${GENH} 291 $i: $i.in 292 ${_MKTARGET_CREATE} 293 ${.CURDIR}/gen ${.ALLSRC} > ${.TARGET} 294 .endfor 295 296 .include <bsd.lib.mk> 297 298