1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/freebl/Makefile Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,670 @@ 1.4 +#! gmake 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 +####################################################################### 1.11 +# (1) Include initial platform-independent assignments (MANDATORY). # 1.12 +####################################################################### 1.13 + 1.14 +include manifest.mn 1.15 + 1.16 +####################################################################### 1.17 +# (2) Include "global" configuration information. (OPTIONAL) # 1.18 +####################################################################### 1.19 + 1.20 +include $(CORE_DEPTH)/coreconf/config.mk 1.21 + 1.22 +####################################################################### 1.23 +# (3) Include "component" configuration information. (OPTIONAL) # 1.24 +####################################################################### 1.25 + 1.26 + 1.27 + 1.28 +####################################################################### 1.29 +# (4) Include "local" platform-dependent assignments (OPTIONAL). # 1.30 +####################################################################### 1.31 + 1.32 +include config.mk 1.33 + 1.34 +# default for all platforms 1.35 +# unset this on those that have multiple freebl libraries 1.36 +FREEBL_BUILD_SINGLE_SHLIB = 1 1.37 + 1.38 +ifdef USE_64 1.39 + DEFINES += -DNSS_USE_64 1.40 +endif 1.41 + 1.42 +ifdef USE_ABI32_FPU 1.43 + DEFINES += -DNSS_USE_ABI32_FPU 1.44 +endif 1.45 + 1.46 +ifeq ($(FREEBL_NO_DEPEND),1) 1.47 + DEFINES += -DFREEBL_NO_DEPEND 1.48 + STUBS_SRCS = stubs.c 1.49 +endif 1.50 + 1.51 +ifeq ($(FREEBL_LOWHASH),1) 1.52 + LOWHASH_SRCS = nsslowhash.c 1.53 + LOWHASH_EXPORTS = nsslowhash.h 1.54 + MAPFILE_SOURCE = freebl_hash.def 1.55 +else 1.56 + MAPFILE_SOURCE = freebl.def 1.57 +endif 1.58 + 1.59 +# FREEBL_USE_PRELINK 1.60 +# 1.61 +# Most modern version of Linux support a speed optimization scheme where an 1.62 +# application called prelink modifies programs and shared libraries to quickly 1.63 +# load if they fit into an already designed address space. In short, prelink 1.64 +# scans the list of programs and libraries on your system, assigns them a 1.65 +# predefined space in the the address space, then provides the fixups to the 1.66 +# library. 1.67 +# 1.68 +# The modification of the shared library is correctly detected by the freebl 1.69 +# FIPS checksum scheme where we check a signed hash of the library against the 1.70 +# library itself. 1.71 +# 1.72 +# The prelink command itself can reverse the process of modification and output 1.73 +# the prestine shared library as it was before prelink made it's changes. 1.74 +# This option tells Freebl could use prelink to output the original copy of 1.75 +# the shared library before prelink modified it. 1.76 +# 1.77 +# FREEBL_PRELINK_COMMAND 1.78 +# 1.79 +# This is an optional environment variable which can override the default 1.80 +# prelink command. It could be used on systems that did something similiar to 1.81 +# prelink but used a different command and syntax. The only requirement is the 1.82 +# program must take the library as the last argument, the program must output 1.83 +# the original library to standard out, and the program does not need to take 1.84 +# any quoted or imbedded spaces in its arguments (except the path to the 1.85 +# library itself, which can have imbedded spaces or special characters). 1.86 +# 1.87 +ifdef FREEBL_USE_PRELINK 1.88 + DEFINES += -DFREEBL_USE_PRELINK 1.89 +ifdef LINUX 1.90 + DEFINES += -D__GNU_SOURCE=1 1.91 +endif 1.92 +endif 1.93 +ifdef FREEBL_PRELINK_COMMAND 1.94 + DEFINES +=-DFREEBL_PRELINK_COMMAND=\"$(FREEBL_PRELINK_COMMAND)\" 1.95 +endif 1.96 +# NSS_X86 means the target is a 32-bits x86 CPU architecture 1.97 +# NSS_X64 means the target is a 64-bits 64 CPU architecture 1.98 +# NSS_X86_OR_X64 means the target is either x86 or x64 1.99 +ifeq (,$(filter-out i386 x386 x86 x86_64,$(CPU_ARCH))) 1.100 + DEFINES += -DNSS_X86_OR_X64 1.101 +ifneq (,$(USE_64)$(USE_X32)) 1.102 + DEFINES += -DNSS_X64 1.103 +else 1.104 + DEFINES += -DNSS_X86 1.105 +endif 1.106 +endif 1.107 + 1.108 +ifeq ($(OS_TARGET),OSF1) 1.109 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_NO_MP_WORD 1.110 + MPI_SRCS += mpvalpha.c 1.111 +endif 1.112 + 1.113 +ifeq (OS2,$(OS_TARGET)) 1.114 + ASFILES = mpi_x86_os2.s 1.115 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 1.116 + DEFINES += -DMP_ASSEMBLY_DIV_2DX1D 1.117 + DEFINES += -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD 1.118 + DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN 1.119 +endif 1.120 + 1.121 +ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET))) 1.122 +ifndef USE_64 1.123 +# 32-bit Windows 1.124 +ifdef NS_USE_GCC 1.125 +# Ideally, we want to use assembler 1.126 +# ASFILES = mpi_x86.s 1.127 +# DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE \ 1.128 +# -DMP_ASSEMBLY_DIV_2DX1D 1.129 +# but we haven't figured out how to make it work, so we are not 1.130 +# using assembler right now. 1.131 + ASFILES = 1.132 + DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT 1.133 +else 1.134 +# MSVC 1.135 + MPI_SRCS += mpi_x86_asm.c 1.136 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 1.137 + DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD 1.138 + ifdef BUILD_OPT 1.139 + OPTIMIZER += -Ox # maximum optimization for freebl 1.140 + endif 1.141 + # The Intel AES assembly code requires Visual C++ 2010. 1.142 + # if $(_MSC_VER) >= 1600 (Visual C++ 2010) 1.143 + ifeq ($(firstword $(sort $(_MSC_VER) 1600)),1600) 1.144 + DEFINES += -DUSE_HW_AES -DINTEL_GCM 1.145 + ASFILES += intel-aes-x86-masm.asm intel-gcm-x86-masm.asm 1.146 + EXTRA_SRCS += intel-gcm-wrap.c 1.147 + endif 1.148 +endif 1.149 +else 1.150 + # -DMP_NO_MP_WORD 1.151 + DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN 1.152 +ifdef NS_USE_GCC 1.153 +# Ideally, we should use amd64 assembly code, but it's not yet mingw-w64 1.154 +# compatible. 1.155 +else 1.156 +# MSVC 1.157 + ifdef BUILD_OPT 1.158 + OPTIMIZER += -Ox # maximum optimization for freebl 1.159 + endif 1.160 + ASFILES = arcfour-amd64-masm.asm mpi_amd64_masm.asm mp_comba_amd64_masm.asm 1.161 + DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY 1.162 + DEFINES += -DNSS_USE_COMBA 1.163 + # The Intel AES assembly code requires Visual C++ 2010 (10.0). The _xgetbv 1.164 + # compiler intrinsic function requires Visual C++ 2010 (10.0) SP1. 1.165 + ifeq ($(_MSC_VER_GE_10SP1),1) 1.166 + DEFINES += -DUSE_HW_AES -DINTEL_GCM 1.167 + ASFILES += intel-aes-x64-masm.asm intel-gcm-x64-masm.asm 1.168 + EXTRA_SRCS += intel-gcm-wrap.c 1.169 + endif 1.170 + MPI_SRCS += mpi_amd64.c 1.171 +endif 1.172 +endif 1.173 +endif 1.174 + 1.175 +ifeq ($(OS_TARGET),IRIX) 1.176 +ifeq ($(USE_N32),1) 1.177 + ASFILES = mpi_mips.s 1.178 + ifeq ($(NS_USE_GCC),1) 1.179 + ASFLAGS = -Wp,-P -Wp,-traditional -O -mips3 1.180 + else 1.181 + ASFLAGS = -O -OPT:Olimit=4000 -dollar -fullwarn -xansi -n32 -mips3 1.182 + endif 1.183 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 1.184 + DEFINES += -DMP_USE_UINT_DIGIT 1.185 +endif 1.186 +endif 1.187 + 1.188 +ifeq ($(OS_TARGET),Darwin) 1.189 +ifeq ($(CPU_ARCH),x86) 1.190 + ASFILES = mpi_sse2.s 1.191 + DEFINES += -DMP_USE_UINT_DIGIT 1.192 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 1.193 + DEFINES += -DMP_ASSEMBLY_DIV_2DX1D 1.194 +endif 1.195 +endif # Darwin 1.196 + 1.197 +ifeq ($(OS_TARGET),Linux) 1.198 +ifeq ($(CPU_ARCH),x86_64) 1.199 + ASFILES = arcfour-amd64-gas.s mpi_amd64_gas.s 1.200 + ASFLAGS += -fPIC -Wa,--noexecstack 1.201 + DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY 1.202 + DEFINES += -DNSS_USE_COMBA 1.203 + DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN 1.204 +# DEFINES += -DMPI_AMD64_ADD 1.205 + # comment the next four lines to turn off Intel HW acceleration. 1.206 + DEFINES += -DUSE_HW_AES -DINTEL_GCM 1.207 + ASFILES += intel-aes.s intel-gcm.s 1.208 + EXTRA_SRCS += intel-gcm-wrap.c 1.209 + INTEL_GCM = 1 1.210 + MPI_SRCS += mpi_amd64.c mp_comba.c 1.211 +endif 1.212 +ifeq ($(CPU_ARCH),x86) 1.213 + ASFILES = mpi_x86.s 1.214 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 1.215 + DEFINES += -DMP_ASSEMBLY_DIV_2DX1D -DMP_USE_UINT_DIGIT 1.216 + DEFINES += -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN 1.217 + # The floating point ECC code doesn't work on Linux x86 (bug 311432). 1.218 + #ECL_USE_FP = 1 1.219 +endif 1.220 +ifeq ($(CPU_ARCH),arm) 1.221 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 1.222 + DEFINES += -DMP_USE_UINT_DIGIT 1.223 + DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512 1.224 + MPI_SRCS += mpi_arm.c 1.225 +endif 1.226 +endif # Linux 1.227 + 1.228 +ifeq ($(OS_TARGET),AIX) 1.229 + DEFINES += -DMP_USE_UINT_DIGIT 1.230 + ifndef USE_64 1.231 + DEFINES += -DMP_NO_DIV_WORD -DMP_NO_ADD_WORD -DMP_NO_SUB_WORD 1.232 + endif 1.233 +endif # AIX 1.234 + 1.235 +ifeq ($(OS_TARGET), HP-UX) 1.236 +ifneq ($(OS_TEST), ia64) 1.237 +# PA-RISC 1.238 +ASFILES += ret_cr16.s 1.239 +ifndef USE_64 1.240 + FREEBL_BUILD_SINGLE_SHLIB = 1.241 + HAVE_ABI32_INT32 = 1 1.242 + HAVE_ABI32_FPU = 1 1.243 +endif 1.244 +ifdef FREEBL_CHILD_BUILD 1.245 +ifdef USE_ABI32_INT32 1.246 +# build for DA1.1 (HP PA 1.1) 32-bit ABI build with 32-bit arithmetic 1.247 + DEFINES += -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD 1.248 + DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512 1.249 +else 1.250 +ifdef USE_64 1.251 +# this builds for DA2.0W (HP PA 2.0 Wide), the LP64 ABI, using 64-bit digits 1.252 + MPI_SRCS += mpi_hp.c 1.253 + ASFILES += hpma512.s hppa20.s 1.254 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 1.255 +else 1.256 +# this builds for DA2.0 (HP PA 2.0 Narrow) ABI32_FPU model 1.257 +# (the 32-bit ABI with 64-bit registers) using 64-bit digits 1.258 + MPI_SRCS += mpi_hp.c 1.259 + ASFILES += hpma512.s hppa20.s 1.260 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 1.261 +ifndef NS_USE_GCC 1.262 + ARCHFLAG = -Aa +e +DA2.0 +DS2.0 1.263 +endif 1.264 +endif 1.265 +endif 1.266 +endif 1.267 +endif 1.268 +endif 1.269 + 1.270 +# The blapi functions are defined not only in the freebl shared 1.271 +# libraries but also in the shared libraries linked with loader.c 1.272 +# (libsoftokn3.so and libssl3.so). We need to use GNU ld's 1.273 +# -Bsymbolic option or the equivalent option for other linkers 1.274 +# to bind the blapi function references in FREEBLVector vector 1.275 +# (ldvector.c) to the blapi functions defined in the freebl 1.276 +# shared libraries. 1.277 +ifeq (,$(filter-out BSD_OS FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET))) 1.278 + MKSHLIB += -Wl,-Bsymbolic 1.279 +endif 1.280 + 1.281 +ifeq ($(OS_TARGET),SunOS) 1.282 + 1.283 +ifdef NS_USE_GCC 1.284 + ifdef GCC_USE_GNU_LD 1.285 + MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text 1.286 + else 1.287 + MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text 1.288 + endif # GCC_USE_GNU_LD 1.289 +else 1.290 + MKSHLIB += -B symbolic -z now -z text 1.291 +endif # NS_USE_GCC 1.292 + 1.293 +# Sun's WorkShop defines v8, v8plus and v9 architectures. 1.294 +# gcc on Solaris defines v8 and v9 "cpus". 1.295 +# gcc's v9 is equivalent to Workshop's v8plus. 1.296 +# gcc's -m64 is equivalent to Workshop's v9 1.297 +# We always use Sun's assembler, which uses Sun's naming convention. 1.298 +ifeq ($(CPU_ARCH),sparc) 1.299 + FREEBL_BUILD_SINGLE_SHLIB= 1.300 + ifdef USE_64 1.301 + HAVE_ABI64_INT = 1 1.302 + HAVE_ABI64_FPU = 1 1.303 + else 1.304 + HAVE_ABI32_FPU = 1 1.305 + HAVE_ABI32_INT64 = 1 1.306 + endif 1.307 + SYSV_SPARC = 1 1.308 + SOLARIS_AS = /usr/ccs/bin/as 1.309 + #### set arch, asm, c flags 1.310 + ifdef NS_USE_GCC 1.311 + ifdef USE_ABI32_INT64 1.312 + ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plus 1.313 + SOLARIS_AS_FLAGS = -xarch=v8plus -K PIC 1.314 + endif 1.315 + ifdef USE_ABI32_FPU 1.316 + ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plusa 1.317 + SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC 1.318 + endif # USE_ABI32_FPU 1.319 + ifdef USE_ABI64_INT 1.320 + # this builds for Sparc v9a pure 64-bit architecture 1.321 + ARCHFLAG += -mcpu=v9 -Wa,-xarch=v9 1.322 + SOLARIS_AS_FLAGS = -xarch=v9 -K PIC 1.323 + endif 1.324 + ifdef USE_ABI64_FPU 1.325 + # this builds for Sparc v9a pure 64-bit architecture 1.326 + # It uses floating point, and 32-bit word size 1.327 + ARCHFLAG += -mcpu=v9 -Wa,-xarch=v9a 1.328 + SOLARIS_AS_FLAGS = -xarch=v9a -K PIC 1.329 + endif 1.330 + else # NS_USE_GCC 1.331 + # FPU_TARGET_OPTIMIZER specifies the target processor and cache 1.332 + # properties of the ABI32_FPU and ABI64_FPU architectures for use 1.333 + # by the optimizer. 1.334 + ifeq (,$(findstring Sun WorkShop 6,$(shell $(CC) -V 2>&1))) 1.335 + # if the compiler is not Forte 6 1.336 + FPU_TARGET_OPTIMIZER = -xcache=64/32/4:1024/64/4 -xchip=ultra3 1.337 + else 1.338 + # Forte 6 C compiler generates incorrect code for rijndael.c 1.339 + # if -xchip=ultra3 is used (Bugzilla bug 333925). So we revert 1.340 + # to what we used in NSS 3.10. 1.341 + FPU_TARGET_OPTIMIZER = -xchip=ultra2 1.342 + endif 1.343 + ifdef USE_ABI32_INT64 1.344 + # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, 1.345 + # 32-bit ABI, it uses 64-bit words, integer arithmetic, 1.346 + # no FPU (non-VIS cpus). 1.347 + # These flags were suggested by the compiler group for building 1.348 + # with SunStudio 10. 1.349 + ifdef BUILD_OPT 1.350 + SOL_CFLAGS += -xO4 1.351 + endif 1.352 + SOL_CFLAGS += -xtarget=generic 1.353 + ARCHFLAG = -xarch=v8plus 1.354 + SOLARIS_AS_FLAGS = -xarch=v8plus -K PIC 1.355 + endif 1.356 + ifdef USE_ABI32_FPU 1.357 + # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, 1.358 + # 32-bit ABI, it uses FPU code, and 32-bit word size. 1.359 + # these flags were determined by running cc -### -fast and copying 1.360 + # the generated flag settings 1.361 + SOL_CFLAGS += -fsingle -xmemalign=8s 1.362 + ifdef BUILD_OPT 1.363 + SOL_CFLAGS += -D__MATHERR_ERRNO_DONTCARE -fsimple=1 1.364 + SOL_CFLAGS += -xalias_level=basic -xbuiltin=%all 1.365 + SOL_CFLAGS += $(FPU_TARGET_OPTIMIZER) -xdepend 1.366 + SOL_CFLAGS += -xlibmil -xO5 1.367 + endif 1.368 + ARCHFLAG = -xarch=v8plusa 1.369 + SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC 1.370 + endif 1.371 + ifdef USE_ABI64_INT 1.372 + # this builds for Sparc v9a pure 64-bit architecture, 1.373 + # no FPU (non-VIS cpus). For building with SunStudio 10. 1.374 + ifdef BUILD_OPT 1.375 + SOL_CFLAGS += -xO4 1.376 + endif 1.377 + SOL_CFLAGS += -xtarget=generic 1.378 + ARCHFLAG = -xarch=v9 1.379 + SOLARIS_AS_FLAGS = -xarch=v9 -K PIC 1.380 + endif 1.381 + ifdef USE_ABI64_FPU 1.382 + # this builds for Sparc v9a pure 64-bit architecture 1.383 + # It uses floating point, and 32-bit word size. 1.384 + # See comment for USE_ABI32_FPU. 1.385 + SOL_CFLAGS += -fsingle -xmemalign=8s 1.386 + ifdef BUILD_OPT 1.387 + SOL_CFLAGS += -D__MATHERR_ERRNO_DONTCARE -fsimple=1 1.388 + SOL_CFLAGS += -xalias_level=basic -xbuiltin=%all 1.389 + SOL_CFLAGS += $(FPU_TARGET_OPTIMIZER) -xdepend 1.390 + SOL_CFLAGS += -xlibmil -xO5 1.391 + endif 1.392 + ARCHFLAG = -xarch=v9a 1.393 + SOLARIS_AS_FLAGS = -xarch=v9a -K PIC 1.394 + endif 1.395 + endif # NS_USE_GCC 1.396 + 1.397 + ### set flags for both GCC and Sun cc 1.398 + ifdef USE_ABI32_INT64 1.399 + # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, 1.400 + # 32-bit ABI, it uses 64-bit words, integer arithmetic, no FPU 1.401 + # best times are with no MP_ flags specified 1.402 + endif 1.403 + ifdef USE_ABI32_FPU 1.404 + # this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers, 1.405 + # 32-bit ABI, it uses FPU code, and 32-bit word size 1.406 + MPI_SRCS += mpi_sparc.c 1.407 + ASFILES = mpv_sparcv8.s montmulfv8.s 1.408 + DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY 1.409 + DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL 1.410 + ECL_USE_FP = 1 1.411 + endif 1.412 + ifdef USE_ABI64_INT 1.413 + # this builds for Sparc v9a pure 64-bit architecture 1.414 + # best times are with no MP_ flags specified 1.415 + endif 1.416 + ifdef USE_ABI64_FPU 1.417 + # this builds for Sparc v9a pure 64-bit architecture 1.418 + # It uses floating point, and 32-bit word size 1.419 + MPI_SRCS += mpi_sparc.c 1.420 + ASFILES = mpv_sparcv9.s montmulfv9.s 1.421 + DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY 1.422 + DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL 1.423 + ECL_USE_FP = 1 1.424 + endif 1.425 + 1.426 +else 1.427 + # Solaris for non-sparc family CPUs 1.428 + ifdef NS_USE_GCC 1.429 + LD = gcc 1.430 + AS = gcc 1.431 + ASFLAGS = -x assembler-with-cpp 1.432 + endif 1.433 + ifeq ($(USE_64),1) 1.434 + # Solaris for AMD64 1.435 + ifdef NS_USE_GCC 1.436 + ASFILES = arcfour-amd64-gas.s mpi_amd64_gas.s 1.437 + ASFLAGS += -march=opteron -m64 -fPIC 1.438 + MPI_SRCS += mp_comba.c 1.439 + # comment the next four lines to turn off Intel HW acceleration 1.440 + ASFILES += intel-gcm.s 1.441 + EXTRA_SRCS += intel-gcm-wrap.c 1.442 + INTEL_GCM = 1 1.443 + DEFINES += -DINTEL_GCM 1.444 + else 1.445 + ASFILES = arcfour-amd64-sun.s mpi_amd64_sun.s sha-fast-amd64-sun.s 1.446 + ASFILES += mp_comba_amd64_sun.s mpcpucache_amd64.s 1.447 + ASFLAGS += -xarch=generic64 -K PIC 1.448 + SOL_CFLAGS += -xprefetch=no 1.449 + SHA_SRCS = 1.450 + MPCPU_SRCS = 1.451 + # Intel acceleration for GCM does not build currently with Studio 1.452 + endif 1.453 + DEFINES += -DNSS_BEVAND_ARCFOUR -DMPI_AMD64 -DMP_ASSEMBLY_MULTIPLY 1.454 + DEFINES += -DNSS_USE_COMBA -DMP_CHAR_STORE_SLOW -DMP_IS_LITTLE_ENDIAN 1.455 + # comment the next two lines to turn off Intel HW acceleration 1.456 + DEFINES += -DUSE_HW_AES 1.457 + ASFILES += intel-aes.s 1.458 + MPI_SRCS += mpi_amd64.c 1.459 + else 1.460 + # Solaris x86 1.461 + DEFINES += -DMP_USE_UINT_DIGIT 1.462 + DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE 1.463 + DEFINES += -DMP_ASSEMBLY_DIV_2DX1D 1.464 + ASFILES = mpi_i86pc.s 1.465 + ifndef NS_USE_GCC 1.466 + MPCPU_SRCS = 1.467 + ASFILES += mpcpucache_x86.s 1.468 + endif 1.469 + endif 1.470 +endif # Solaris for non-sparc family CPUs 1.471 +endif # target == SunOS 1.472 + 1.473 +ifndef NSS_DISABLE_ECC 1.474 + ifdef ECL_USE_FP 1.475 + #enable floating point ECC code 1.476 + DEFINES += -DECL_USE_FP 1.477 + ECL_SRCS += ecp_fp160.c ecp_fp192.c ecp_fp224.c ecp_fp.c 1.478 + ECL_HDRS += ecp_fp.h 1.479 + endif 1.480 +endif 1.481 + 1.482 +####################################################################### 1.483 +# (5) Execute "global" rules. (OPTIONAL) # 1.484 +####################################################################### 1.485 + 1.486 +include $(CORE_DEPTH)/coreconf/rules.mk 1.487 + 1.488 +####################################################################### 1.489 +# (6) Execute "component" rules. (OPTIONAL) # 1.490 +####################################################################### 1.491 + 1.492 + 1.493 + 1.494 +####################################################################### 1.495 +# (7) Execute "local" rules. (OPTIONAL). # 1.496 +####################################################################### 1.497 + 1.498 +export:: private_export 1.499 + 1.500 +rijndael_tables: 1.501 + $(CC) -o $(OBJDIR)/make_rijndael_tab rijndael_tables.c \ 1.502 + $(DEFINES) $(INCLUDES) $(OBJDIR)/libfreebl.a 1.503 + $(OBJDIR)/make_rijndael_tab 1.504 + 1.505 +vpath %.h mpi ecl 1.506 +vpath %.c mpi ecl 1.507 +vpath %.S mpi ecl 1.508 +vpath %.s mpi ecl 1.509 +vpath %.asm mpi ecl 1.510 +INCLUDES += -Impi -Iecl 1.511 + 1.512 + 1.513 +DEFINES += -DMP_API_COMPATIBLE 1.514 + 1.515 +MPI_USERS = dh.c pqg.c dsa.c rsa.c ec.c 1.516 + 1.517 +MPI_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_SRCS:.c=$(OBJ_SUFFIX))) 1.518 +MPI_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_USERS:.c=$(OBJ_SUFFIX))) 1.519 + 1.520 +$(MPI_OBJS): $(MPI_HDRS) 1.521 + 1.522 +ECL_USERS = ec.c 1.523 + 1.524 +ECL_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_SRCS:.c=$(OBJ_SUFFIX)) $(ECL_ASM_SRCS:$(ASM_SUFFIX)=$(OBJ_SUFFIX))) 1.525 +ECL_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_USERS:.c=$(OBJ_SUFFIX))) 1.526 + 1.527 +$(ECL_OBJS): $(ECL_HDRS) 1.528 + 1.529 + 1.530 + 1.531 +$(OBJDIR)/sysrand$(OBJ_SUFFIX): sysrand.c unix_rand.c win_rand.c os2_rand.c 1.532 + 1.533 +$(OBJDIR)/$(PROG_PREFIX)mpprime$(OBJ_SUFFIX): primes.c 1.534 + 1.535 +$(OBJDIR)/ldvector$(OBJ_SUFFIX) $(OBJDIR)/loader$(OBJ_SUFFIX) : loader.h 1.536 + 1.537 +ifeq ($(SYSV_SPARC),1) 1.538 + 1.539 +$(OBJDIR)/mpv_sparcv8.o $(OBJDIR)/mpv_sparcv8x.o $(OBJDIR)/montmulfv8.o : $(OBJDIR)/%.o : %.s 1.540 + @$(MAKE_OBJDIR) 1.541 + $(SOLARIS_AS) -o $@ $(SOLARIS_AS_FLAGS) $< 1.542 + 1.543 +$(OBJDIR)/mpv_sparcv9.o $(OBJDIR)/montmulfv9.o : $(OBJDIR)/%.o : %.s 1.544 + @$(MAKE_OBJDIR) 1.545 + $(SOLARIS_AS) -o $@ $(SOLARIS_AS_FLAGS) $< 1.546 + 1.547 +$(OBJDIR)/mpmontg.o: mpmontg.c montmulf.h 1.548 + 1.549 +endif 1.550 + 1.551 +ifndef FREEBL_CHILD_BUILD 1.552 + 1.553 +# Parent build. This is where we decide which shared libraries to build 1.554 + 1.555 +ifdef FREEBL_BUILD_SINGLE_SHLIB 1.556 + 1.557 +################### Single shared lib stuff ######################### 1.558 +SINGLE_SHLIB_DIR = $(OBJDIR)/$(OS_TARGET)_SINGLE_SHLIB 1.559 +ALL_TRASH += $(SINGLE_SHLIB_DIR) 1.560 + 1.561 +$(SINGLE_SHLIB_DIR): 1.562 + -mkdir $(SINGLE_SHLIB_DIR) 1.563 + 1.564 +release_md libs:: $(SINGLE_SHLIB_DIR) 1.565 + $(MAKE) FREEBL_CHILD_BUILD=1 \ 1.566 + OBJDIR=$(SINGLE_SHLIB_DIR) $@ 1.567 +######################## common stuff ######################### 1.568 + 1.569 +endif 1.570 + 1.571 +# multiple shared libraries 1.572 + 1.573 +######################## ABI32_FPU stuff ######################### 1.574 +ifdef HAVE_ABI32_FPU 1.575 +ABI32_FPU_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_FPU 1.576 +ALL_TRASH += $(ABI32_FPU_DIR) 1.577 + 1.578 +$(ABI32_FPU_DIR): 1.579 + -mkdir $(ABI32_FPU_DIR) 1.580 + 1.581 +release_md libs:: $(ABI32_FPU_DIR) 1.582 + $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_FPU=1 \ 1.583 + OBJDIR=$(ABI32_FPU_DIR) $@ 1.584 +endif 1.585 + 1.586 +######################## ABI32_INT32 stuff ######################### 1.587 +ifdef HAVE_ABI32_INT32 1.588 +ABI32_INT32_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_INT32 1.589 +ALL_TRASH += $(ABI32_INT32_DIR) 1.590 + 1.591 +$(ABI32_INT32_DIR): 1.592 + -mkdir $(ABI32_INT32_DIR) 1.593 + 1.594 +release_md libs:: $(ABI32_INT32_DIR) 1.595 + $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_INT32=1 \ 1.596 + OBJDIR=$(ABI32_INT32_DIR) $@ 1.597 +endif 1.598 + 1.599 +######################## ABI32_INT64 stuff ######################### 1.600 +ifdef HAVE_ABI32_INT64 1.601 +ABI32_INT64_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_INT64 1.602 +ALL_TRASH += $(ABI32_INT64_DIR) 1.603 + 1.604 +$(ABI32_INT64_DIR): 1.605 + -mkdir $(ABI32_INT64_DIR) 1.606 + 1.607 +release_md libs:: $(ABI32_INT64_DIR) 1.608 + $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_INT64=1\ 1.609 + OBJDIR=$(ABI32_INT64_DIR) $@ 1.610 +endif 1.611 + 1.612 +######################## END of 32-bit stuff ######################### 1.613 + 1.614 +# above is 32-bit builds, below is 64-bit builds 1.615 + 1.616 +######################## ABI64_FPU stuff ######################### 1.617 +ifdef HAVE_ABI64_FPU 1.618 +ABI64_FPU_DIR = $(OBJDIR)/$(OS_TARGET)_ABI64_FPU 1.619 +ALL_TRASH += $(ABI64_FPU_DIR) 1.620 + 1.621 +$(ABI64_FPU_DIR): 1.622 + -mkdir $(ABI64_FPU_DIR) 1.623 + 1.624 +release_md libs:: $(ABI64_FPU_DIR) 1.625 + $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI64_FPU=1 \ 1.626 + OBJDIR=$(ABI64_FPU_DIR) $@ 1.627 +endif 1.628 + 1.629 +######################## ABI64_INT stuff ######################### 1.630 +ifdef HAVE_ABI64_INT 1.631 +ABI64_INT_DIR = $(OBJDIR)/$(OS_TARGET)_ABI64_INT 1.632 +ALL_TRASH += $(ABI64_INT_DIR) 1.633 + 1.634 +$(ABI64_INT_DIR): 1.635 + -mkdir $(ABI64_INT_DIR) 1.636 + 1.637 +release_md libs:: $(ABI64_INT_DIR) 1.638 + $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI64_INT=1 \ 1.639 + OBJDIR=$(ABI64_INT_DIR) $@ 1.640 +endif 1.641 + 1.642 +endif # FREEBL_CHILD_BUILD 1.643 + 1.644 + 1.645 +# Bugzilla Bug 333917: the non-x86 code in desblapi.c seems to violate 1.646 +# ANSI C's strict aliasing rules. 1.647 +ifeq ($(OS_TARGET),Linux) 1.648 +ifneq ($(CPU_ARCH),x86) 1.649 +$(OBJDIR)/$(PROG_PREFIX)desblapi$(OBJ_SUFFIX): desblapi.c 1.650 + @$(MAKE_OBJDIR) 1.651 +ifdef NEED_ABSOLUTE_PATH 1.652 + $(CC) -o $@ -c $(CFLAGS) -fno-strict-aliasing $(call core_abspath,$<) 1.653 +else 1.654 + $(CC) -o $@ -c $(CFLAGS) -fno-strict-aliasing $< 1.655 +endif 1.656 +endif 1.657 +endif 1.658 + 1.659 +ifdef INTEL_GCM 1.660 +# 1.661 +# GCM binary needs -mssse3 1.662 +# 1.663 +$(OBJDIR)/$(PROG_PREFIX)intel-gcm-wrap$(OBJ_SUFFIX): CFLAGS += -mssse3 1.664 + 1.665 +# The integrated assembler in Clang 3.2 does not support % in the 1.666 +# expression of a .set directive. intel-gcm.s uses .set to give 1.667 +# symbolic names to registers, for example, 1.668 +# .set Htbl, %rdi 1.669 +# So we can't use Clang's integrated assembler with intel-gcm.s. 1.670 +ifneq (,$(findstring clang,$(shell $(AS) --version))) 1.671 +$(OBJDIR)/$(PROG_PREFIX)intel-gcm$(OBJ_SUFFIX): ASFLAGS += -no-integrated-as 1.672 +endif 1.673 +endif