зеркало из https://github.com/mozilla/gecko-dev.git
Bug 303508: Add freebl shared libs that do 64-bit integer math. Bug 274984: softoken fails to load freebl in setuid programs. freebl becomes a shared library on all platforms. r=nelson
Modified Files: coreconf/HP-UXB.11.mk coreconf/SunOS5.mk nss/cmd/shlibsign/Makefile nss/cmd/shlibsign/manifest.mn nss/lib/freebl/Makefile nss/lib/freebl/arcfour.c nss/lib/freebl/blapi.h nss/lib/freebl/config.mk nss/lib/freebl/ldvector.c nss/lib/freebl/loader.c nss/lib/freebl/loader.h nss/lib/freebl/manifest.mn Added Files: nss/lib/freebl/freebl.def
This commit is contained in:
Родитель
52eeba63ea
Коммит
0194469cc5
|
@ -36,15 +36,11 @@
|
|||
# ***** END LICENSE BLOCK *****
|
||||
include $(CORE_DEPTH)/coreconf/HP-UX.mk
|
||||
|
||||
ifdef USE_LONG_LONGS
|
||||
USE_HYBRID = 1
|
||||
endif
|
||||
|
||||
ifndef NS_USE_GCC
|
||||
CCC = /opt/aCC/bin/aCC -ext
|
||||
ifeq ($(USE_64), 1)
|
||||
ifeq ($(OS_TEST), ia64)
|
||||
OS_CFLAGS += -Aa +e +p +DD64
|
||||
ARCHFLAG = -Aa +e +p +DD64
|
||||
else
|
||||
# Our HP-UX build machine has a strange problem. If
|
||||
# a 64-bit PA-RISC executable calls getcwd() in a
|
||||
|
@ -57,27 +53,23 @@ ifndef NS_USE_GCC
|
|||
# as a 32-bit PA-RISC executable for 64-bit PA-RISC
|
||||
# builds. -- wtc 2003-06-03
|
||||
ifdef INTERNAL_TOOLS
|
||||
OS_CFLAGS += +DAportable +DS2.0
|
||||
ARCHFLAG = +DAportable +DS2.0
|
||||
else
|
||||
OS_CFLAGS += -Aa +e +DA2.0W +DS2.0 +DChpux
|
||||
ARCHFLAG = -Aa +e +DA2.0W +DS2.0 +DChpux
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(OS_TEST), ia64)
|
||||
OS_CFLAGS += -Aa +e +p +DD32
|
||||
ARCHFLAG = -Aa +e +p +DD32
|
||||
else
|
||||
ifdef USE_HYBRID
|
||||
OS_CFLAGS += -Aa +e +DA2.0 +DS2.0
|
||||
else
|
||||
OS_CFLAGS += +DAportable +DS2.0
|
||||
endif
|
||||
ARCHFLAG = +DAportable +DS2.0
|
||||
endif
|
||||
endif
|
||||
else
|
||||
CCC = aCC
|
||||
endif
|
||||
|
||||
OS_CFLAGS += -DHPUX11
|
||||
OS_CFLAGS += $(ARCHFLAG) -DHPUX11
|
||||
OS_LIBS += -lpthread -lm -lrt
|
||||
#ifeq ($(USE_64), 1)
|
||||
#OS_LIBS += -ldl
|
||||
|
|
|
@ -50,8 +50,7 @@ endif
|
|||
# Sun's WorkShop defines v8, v8plus and v9 architectures.
|
||||
# gcc on Solaris defines v8 and v9 "cpus".
|
||||
# gcc's v9 is equivalent to Workshop's v8plus.
|
||||
# gcc apparently has no equivalent to Workshop's v9
|
||||
# We always use Sun's assembler and linker, which use Sun's naming convention.
|
||||
# gcc's -m64 is equivalent to Workshop's v9
|
||||
|
||||
ifeq ($(USE_64), 1)
|
||||
ifdef NS_USE_GCC
|
||||
|
@ -66,17 +65,9 @@ ifeq ($(USE_64), 1)
|
|||
else
|
||||
ifneq ($(OS_TEST),i86pc)
|
||||
ifdef NS_USE_GCC
|
||||
ifdef USE_HYBRID
|
||||
ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plus
|
||||
else
|
||||
ARCHFLAG=-mcpu=v8
|
||||
endif
|
||||
ARCHFLAG=-mcpu=v8
|
||||
else
|
||||
ifdef USE_HYBRID
|
||||
ARCHFLAG=-xarch=v8plus
|
||||
else
|
||||
ARCHFLAG=-xarch=v8
|
||||
endif
|
||||
ARCHFLAG=-xarch=v8
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -58,28 +58,11 @@ include $(CORE_DEPTH)/coreconf/config.mk
|
|||
|
||||
include ../platlibs.mk
|
||||
|
||||
#
|
||||
# we really should have this driven from a list file made during the normal
|
||||
# NSS build prodecure.
|
||||
#
|
||||
ifndef USE_64
|
||||
ifeq ($(OS_TARGET), HP-UX)
|
||||
ifneq ($(OS_TEST), ia64)
|
||||
LOADABLE_FREEBL= 1
|
||||
endif
|
||||
endif
|
||||
ifeq ($(OS_TARGET), SunOS)
|
||||
ifeq ($(CPU_ARCH), sparc)
|
||||
LOADABLE_FREEBL = 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
# sign any and all shared libraries that contain the word freebl
|
||||
|
||||
ifdef LOADABLE_FREEBL
|
||||
CHECKFILES += freebl_pure32_3.chk freebl_hybrid_3.chk
|
||||
endif
|
||||
|
||||
CHECKLOC=$(addprefix $(DIST)/lib/$(DLL_PREFIX), $(CHECKFILES))
|
||||
CHECKLIBS = $(DIST)/lib/$(DLL_PREFIX)softokn3.$(DLL_SUFFIX)
|
||||
CHECKLIBS += $(wildcard $(DIST)/lib/$(DLL_PREFIX)freebl*3.$(DLL_SUFFIX))
|
||||
CHECKLOC = $(CHECKLIBS:.$(DLL_SUFFIX)=.chk)
|
||||
|
||||
MD_LIB_RELEASE_FILES = $(CHECKLOC)
|
||||
ALL_TRASH += $(CHECKLOC)
|
||||
|
@ -105,9 +88,9 @@ include ../platrules.mk
|
|||
|
||||
%.chk: %.$(DLL_SUFFIX)
|
||||
ifeq ($(OS_TARGET), OS2)
|
||||
@cmd.exe /c sign.cmd $(DIST) $(OBJDIR) $(OS_TARGET) $(NSPR_LIB_DIR) $<
|
||||
cmd.exe /c sign.cmd $(DIST) $(OBJDIR) $(OS_TARGET) $(NSPR_LIB_DIR) $<
|
||||
else
|
||||
@sh ./sign.sh $(DIST) $(OBJDIR) $(OS_TARGET) $(NSPR_LIB_DIR) $<
|
||||
sh ./sign.sh $(DIST) $(OBJDIR) $(OS_TARGET) $(NSPR_LIB_DIR) $<
|
||||
endif
|
||||
|
||||
libs install :: $(CHECKLOC)
|
||||
|
|
|
@ -46,8 +46,6 @@ CSRCS = \
|
|||
shlibsign.c \
|
||||
$(NULL)
|
||||
|
||||
CHECKFILES = softokn3.chk
|
||||
|
||||
# headers for the MODULE (defined above) are implicitly required.
|
||||
REQUIRES = dbm seccmd
|
||||
|
||||
|
|
|
@ -62,12 +62,16 @@ include $(CORE_DEPTH)/coreconf/config.mk
|
|||
|
||||
-include config.mk
|
||||
|
||||
# default for all platforms
|
||||
# unset this on those that have multiple freebl libraries
|
||||
FREEBL_BUILD_SINGLE_SHLIB = 1
|
||||
|
||||
ifdef USE_64
|
||||
DEFINES += -DNSS_USE_64
|
||||
endif
|
||||
|
||||
ifdef USE_HYBRID
|
||||
DEFINES += -DNSS_USE_HYBRID
|
||||
ifdef USE_ABI32_FPU
|
||||
DEFINES += -DNSS_USE_ABI32_FPU
|
||||
endif
|
||||
|
||||
# des.c wants _X86_ defined for intel CPUs.
|
||||
|
@ -83,7 +87,12 @@ ifeq ($(OS_TARGET),OSF1)
|
|||
MPI_SRCS += mpvalpha.c
|
||||
endif
|
||||
|
||||
ifeq (OS2,$(OS_TARGET))
|
||||
LN_S = cp
|
||||
endif
|
||||
|
||||
ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET))) #omits WIN16 and WINCE
|
||||
LN_S = cp
|
||||
ifdef NS_USE_GCC
|
||||
# Ideally, we want to use assembler
|
||||
# ASFILES = mpi_x86.s
|
||||
|
@ -104,6 +113,7 @@ endif
|
|||
endif
|
||||
|
||||
ifeq ($(OS_TARGET),WINCE)
|
||||
LN_S = cp
|
||||
DEFINES += -DMP_ARGCHK=0 # no assert in WinCE
|
||||
DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512
|
||||
endif
|
||||
|
@ -160,10 +170,15 @@ endif # AIX
|
|||
|
||||
ifeq ($(OS_TARGET), HP-UX)
|
||||
ifneq ($(OS_TEST), ia64)
|
||||
MKSHLIB += +k +vshlibunsats -u FREEBL_GetVector +e FREEBL_GetVector
|
||||
ifndef FREEBL_EXTENDED_BUILD
|
||||
ifdef USE_PURE_32
|
||||
# build for DA1.1 (HP PA 1.1) pure 32 bit model
|
||||
# PA-RISC
|
||||
ifndef USE_64
|
||||
FREEBL_BUILD_SINGLE_SHLIB =
|
||||
HAVE_ABI32_INT32 = 1
|
||||
HAVE_ABI32_FPU = 1
|
||||
endif
|
||||
ifdef FREEBL_CHILD_BUILD
|
||||
ifdef USE_ABI32_INT32
|
||||
# build for DA1.1 (HP PA 1.1) 32-bit ABI build with 32-bit arithmetic
|
||||
DEFINES += -DMP_USE_UINT_DIGIT -DMP_NO_MP_WORD
|
||||
DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512
|
||||
else
|
||||
|
@ -173,68 +188,136 @@ ifdef USE_64
|
|||
ASFILES += hpma512.s hppa20.s
|
||||
DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE
|
||||
else
|
||||
# this builds for DA2.0 (HP PA 2.0 Narrow) hybrid model
|
||||
# this builds for DA2.0 (HP PA 2.0 Narrow) ABI32_FPU model
|
||||
# (the 32-bit ABI with 64-bit registers) using 32-bit digits
|
||||
MPI_SRCS += mpi_hp.c
|
||||
ASFILES += hpma512.s hppa20.s
|
||||
DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_ASSEMBLY_SQUARE
|
||||
ARCHFLAG = -Aa +e +DA2.0 +DS2.0
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Note: -xarch=v8 or v9 is now done in coreconf
|
||||
ifeq ($(OS_TARGET),SunOS)
|
||||
|
||||
# The -R '$ORIGIN' linker option instructs this library to search for its
|
||||
# dependencies in the same directory where it resides.
|
||||
MKSHLIB += -R '$$ORIGIN'
|
||||
ifdef NS_USE_GCC
|
||||
ifdef GCC_USE_GNU_LD
|
||||
MKSHLIB += -Wl,-Bsymbolic,-z,defs,-z,now,-z,text
|
||||
else
|
||||
MKSHLIB += -Wl,-B,symbolic,-z,defs,-z,now,-z,text
|
||||
endif # GCC_USE_GNU_LD
|
||||
else
|
||||
MKSHLIB += -B symbolic -z defs -z now -z text
|
||||
endif # NS_USE_GCC
|
||||
|
||||
# Sun's WorkShop defines v8, v8plus and v9 architectures.
|
||||
# gcc on Solaris defines v8 and v9 "cpus".
|
||||
# gcc's v9 is equivalent to Workshop's v8plus.
|
||||
# gcc's -m64 is equivalent to Workshop's v9
|
||||
# We always use Sun's assembler, which uses Sun's naming convention.
|
||||
ifeq ($(CPU_ARCH),sparc)
|
||||
ifndef NS_USE_GCC
|
||||
ifdef USE_HYBRID
|
||||
OS_CFLAGS += -xchip=ultra2
|
||||
endif # USE_HYBRID
|
||||
endif # NS_USE_GCC
|
||||
SYSV_SPARC=1
|
||||
FREEBL_BUILD_SINGLE_SHLIB=
|
||||
ifdef USE_64
|
||||
HAVE_ABI64_INT = 1
|
||||
HAVE_ABI64_FPU = 1
|
||||
else
|
||||
HAVE_ABI32_INT32 = 1
|
||||
HAVE_ABI32_FPU = 1
|
||||
HAVE_ABI32_INT64 = 1
|
||||
endif
|
||||
SYSV_SPARC = 1
|
||||
SOLARIS_AS = /usr/ccs/bin/as
|
||||
#### set arch, asm, c flags
|
||||
ifdef NS_USE_GCC
|
||||
ifdef GCC_USE_GNU_LD
|
||||
MKSHLIB += -Wl,-Bsymbolic,-z,defs,-z,now,-z,text,--version-script,mapfile.Solaris
|
||||
else
|
||||
MKSHLIB += -Wl,-B,symbolic,-z,defs,-z,now,-z,text,-M,mapfile.Solaris
|
||||
endif # GCC_USE_GNU_LD
|
||||
else
|
||||
MKSHLIB += -B symbolic -z defs -z now -z text -M mapfile.Solaris
|
||||
endif # NS_USE_GCC
|
||||
ifdef USE_PURE_32
|
||||
# this builds for Sparc v8 pure 32-bit architecture
|
||||
ASFILES = mpv_sparcv8x.s
|
||||
DEFINES += -DMP_USE_LONG_LONG_MULTIPLY -DMP_USE_UINT_DIGIT
|
||||
DEFINES += -DMP_NO_MP_WORD
|
||||
DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512
|
||||
DEFINES += -DMP_ASSEMBLY_MULTIPLY
|
||||
else
|
||||
ifdef USE_64
|
||||
ifdef USE_ABI32_INT32
|
||||
# default ARCHFLAG=-mcpu=v8 set by coreconf/sunOS5.mk
|
||||
endif
|
||||
ifdef USE_ABI32_INT64
|
||||
ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plus
|
||||
endif
|
||||
ifdef USE_ABI32_FPU
|
||||
ARCHFLAG=-mcpu=v9 -Wa,-xarch=v8plus
|
||||
endif # USE_ABI32_FPU
|
||||
ifdef USE_ABI64_INT
|
||||
# this builds for Sparc v9a pure 64-bit architecture
|
||||
MPI_SRCS += mpi_sparc.c
|
||||
ASFILES = mpv_sparcv9.s montmulfv9.s
|
||||
DEFINES += -DMP_ASSEMBLY_MULTIPLY -DMP_USING_MONT_MULF
|
||||
DEFINES += -DMP_USE_UINT_DIGIT
|
||||
SOLARIS_FLAGS = -fast -xO5 -xrestrict=%all -xchip=ultra -xarch=v9a
|
||||
SOLARIS_FLAGS += -KPIC -mt
|
||||
SOLARIS_AS_FLAGS = -xarch=v9a -K PIC
|
||||
else
|
||||
# this builds for Sparc v8+a hybrid architecture, 64-bit registers,
|
||||
# 32-bit ABI
|
||||
MPI_SRCS += mpi_sparc.c
|
||||
ASFILES = mpv_sparcv8.s montmulfv8.s
|
||||
DEFINES += -DMP_NO_MP_WORD -DMP_ASSEMBLY_MULTIPLY
|
||||
DEFINES += -DMP_USING_MONT_MULF -DMP_USE_UINT_DIGIT
|
||||
endif
|
||||
ifdef USE_ABI64_FPU
|
||||
# this builds for Sparc v9a pure 64-bit architecture
|
||||
# It uses floating point, and 32-bit word size
|
||||
endif
|
||||
else # NS_USE_GCC
|
||||
ifdef USE_ABI32_INT32
|
||||
#ARCHFLAG=-xarch=v8 set in coreconf/sunOS5.mk
|
||||
endif
|
||||
ifdef USE_ABI32_INT64
|
||||
# this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers,
|
||||
# 32-bit ABI, it uses 64-bit words, integer arithmetic, no FPU
|
||||
SOL_CFLAGS += -fast -xO5 -xrestrict=%all -xchip=ultra
|
||||
ARCHFLAG = -xarch=v8plusa
|
||||
SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC
|
||||
endif # USE_64
|
||||
endif # USE_PURE_32
|
||||
endif
|
||||
ifdef USE_ABI32_FPU
|
||||
# this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers,
|
||||
# 32-bit ABI, it uses FPU code, and 32-bit word size
|
||||
SOL_CFLAGS += -fast -xO5 -xrestrict=%all -xchip=ultra
|
||||
ARCHFLAG = -xarch=v8plusa
|
||||
SOLARIS_AS_FLAGS = -xarch=v8plusa -K PIC
|
||||
endif
|
||||
ifdef USE_ABI64_INT
|
||||
# this builds for Sparc v9a pure 64-bit architecture
|
||||
SOL_CFLAGS += -fast -xO5 -xrestrict=%all -xchip=ultra
|
||||
SOL_CFLAGS += -mt
|
||||
ARCHFLAG = -xarch=v9a
|
||||
SOLARIS_AS_FLAGS = -xarch=v9a -K PIC
|
||||
endif
|
||||
ifdef USE_ABI64_FPU
|
||||
# this builds for Sparc v9a pure 64-bit architecture
|
||||
# It uses floating point, and 32-bit word size
|
||||
SOL_CFLAGS += -fast -xO5 -xrestrict=%all -xchip=ultra
|
||||
SOL_CFLAGS += -mt
|
||||
ARCHFLAG = -xarch=v9a
|
||||
SOLARIS_AS_FLAGS = -xarch=v9a -K PIC
|
||||
endif
|
||||
endif # NS_USE_GCC
|
||||
|
||||
### set MP_ flags for both GCC and Sun cc
|
||||
ifdef USE_ABI32_INT32
|
||||
# this builds for Sparc v8 pure 32-bit architecture
|
||||
DEFINES += -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY
|
||||
ASFILES = mpv_sparcv8x.s
|
||||
DEFINES += -DSHA_NO_LONG_LONG # avoid 64-bit arithmetic in SHA512
|
||||
endif
|
||||
ifdef USE_ABI32_INT64
|
||||
# this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers,
|
||||
# 32-bit ABI, it uses 64-bit words, integer arithmetic, no FPU
|
||||
# best times are with no MP_ flags specified
|
||||
endif
|
||||
ifdef USE_ABI32_FPU
|
||||
# this builds for Sparc v8+a ABI32_FPU architecture, 64-bit registers,
|
||||
# 32-bit ABI, it uses FPU code, and 32-bit word size
|
||||
MPI_SRCS += mpi_sparc.c
|
||||
ASFILES = mpv_sparcv8.s montmulfv8.s
|
||||
DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY
|
||||
DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL
|
||||
endif
|
||||
ifdef USE_ABI64_INT
|
||||
# this builds for Sparc v9a pure 64-bit architecture
|
||||
# best times are with no MP_ flags specified
|
||||
endif
|
||||
ifdef USE_ABI64_FPU
|
||||
# this builds for Sparc v9a pure 64-bit architecture
|
||||
# It uses floating point, and 32-bit word size
|
||||
MPI_SRCS += mpi_sparc.c
|
||||
ASFILES = mpv_sparcv9.s montmulfv9.s
|
||||
DEFINES += -DMP_NO_MP_WORD -DMP_USE_UINT_DIGIT -DMP_ASSEMBLY_MULTIPLY
|
||||
DEFINES += -DMP_USING_MONT_MULF -DMP_MONT_USE_MP_MUL
|
||||
endif
|
||||
|
||||
ifdef NSS_ENABLE_ECC
|
||||
DEFINES += -DECL_USE_FP
|
||||
ECL_SRCS += ecp_fp160.c ecp_fp192.c ecp_fp224.c ecp_fp.c
|
||||
|
@ -298,7 +381,7 @@ rijndael_tables:
|
|||
$(DEFINES) $(INCLUDES) $(OBJDIR)/libfreebl.a
|
||||
$(OBJDIR)/make_rijndael_tab
|
||||
|
||||
ifdef USE_PURE_32
|
||||
ifdef FREEBL_CHILD_BUILD
|
||||
vpath %.h $(FREEBL_PARENT)/ecl $(FREEBL_PARENT)/mpi $(FREEBL_PARENT)
|
||||
vpath %.c $(FREEBL_PARENT)/ecl $(FREEBL_PARENT)/mpi $(FREEBL_PARENT)
|
||||
vpath %.S $(FREEBL_PARENT)/ecl $(FREEBL_PARENT)/mpi $(FREEBL_PARENT)
|
||||
|
@ -322,22 +405,24 @@ MPI_USERS = dh.c pqg.c dsa.c rsa.c ec.c
|
|||
MPI_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_SRCS:.c=$(OBJ_SUFFIX)))
|
||||
MPI_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(MPI_USERS:.c=$(OBJ_SUFFIX)))
|
||||
|
||||
$(MPI_OBJS): $(MPI_HDRS)
|
||||
|
||||
ECL_USERS = ec.c
|
||||
|
||||
ECL_OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_SRCS:.c=$(OBJ_SUFFIX)) $(ECL_ASM_SRCS:$(ASM_SUFFIX)=$(OBJ_SUFFIX)))
|
||||
ECL_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_USERS:.c=$(OBJ_SUFFIX)))
|
||||
|
||||
$(MPI_OBJS): $(MPI_HDRS)
|
||||
|
||||
$(ECL_OBJS): $(ECL_HDRS)
|
||||
|
||||
|
||||
|
||||
$(OBJDIR)/$(PROG_PREFIX)mpprime$(OBJ_SUFFIX): primes.c
|
||||
|
||||
$(OBJDIR)/ldvector$(OBJ_SUFFIX) $(OBJDIR)/loader$(OBJ_SUFFIX) : loader.h
|
||||
|
||||
ifeq ($(SYSV_SPARC),1)
|
||||
|
||||
$(OBJDIR)/mpv_sparcv8.o $(OBJDIR)/montmulfv8.o : $(OBJDIR)/%.o : %.s
|
||||
$(OBJDIR)/mpv_sparcv8.o $(OBJDIR)/mpv_sparcv8x.o $(OBJDIR)/montmulfv8.o : $(OBJDIR)/%.o : %.s
|
||||
@$(MAKE_OBJDIR)
|
||||
$(SOLARIS_AS) -o $@ $(SOLARIS_AS_FLAGS) $<
|
||||
|
||||
|
@ -349,39 +434,131 @@ $(OBJDIR)/mpmontg.o: mpmontg.c montmulf.h
|
|||
|
||||
endif
|
||||
|
||||
ifdef FREEBL_EXTENDED_BUILD
|
||||
ifndef LN_S
|
||||
LN_S = ln -s
|
||||
endif
|
||||
|
||||
PURE32DIR = $(OBJDIR)/$(OS_TARGET)pure32
|
||||
ALL_TRASH += $(PURE32DIR)
|
||||
ifndef FREEBL_CHILD_BUILD
|
||||
|
||||
FILES2LN = \
|
||||
$(wildcard *.tab) \
|
||||
$(wildcard mapfile.*) \
|
||||
Makefile manifest.mn config.mk
|
||||
|
||||
LINKEDFILES = $(addprefix $(PURE32DIR)/, $(FILES2LN))
|
||||
# Parent build. This is where we decide which shared libraries to build
|
||||
|
||||
CDDIR := $(shell pwd)
|
||||
FILES2LN = Makefile manifest.mn config.mk
|
||||
|
||||
$(PURE32DIR):
|
||||
-mkdir $(PURE32DIR)
|
||||
-ln -s $(CDDIR)/mpi $(PURE32DIR)
|
||||
ifdef FREEBL_BUILD_SINGLE_SHLIB
|
||||
|
||||
$(LINKEDFILES) : $(PURE32DIR)/% : %
|
||||
ln -s $(CDDIR)/$* $(PURE32DIR)
|
||||
################### Single shared lib stuff #########################
|
||||
SINGLE_SHLIB_DIR = $(OBJDIR)/$(OS_TARGET)_SINGLE_SHLIB
|
||||
SINGLE_SHLIB_FILES = $(addprefix $(SINGLE_SHLIB_DIR)/, $(FILES2LN))
|
||||
ALL_TRASH += $(SINGLE_SHLIB_DIR)
|
||||
|
||||
libs::
|
||||
$(MAKE) FREEBL_RECURSIVE_BUILD=1 USE_HYBRID=1 libs
|
||||
$(SINGLE_SHLIB_DIR):
|
||||
-mkdir $(SINGLE_SHLIB_DIR)
|
||||
|
||||
libs:: $(PURE32DIR) $(LINKEDFILES)
|
||||
cd $(PURE32DIR) && $(MAKE) FREEBL_RECURSIVE_BUILD=1 USE_PURE_32=1 FREEBL_PARENT=$(CDDIR) CORE_DEPTH=$(CDDIR)/$(CORE_DEPTH) libs
|
||||
$(SINGLE_SHLIB_FILES) : $(SINGLE_SHLIB_DIR)/% : %
|
||||
$(LN_S) $(CDDIR)/$* $(SINGLE_SHLIB_DIR)
|
||||
|
||||
release_md::
|
||||
$(MAKE) FREEBL_RECURSIVE_BUILD=1 USE_HYBRID=1 $@
|
||||
cd $(PURE32DIR) && $(MAKE) FREEBL_RECURSIVE_BUILD=1 USE_PURE_32=1 FREEBL_PARENT=$(CDDIR) CORE_DEPTH=$(CDDIR)/$(CORE_DEPTH) $@
|
||||
release_md libs:: $(SINGLE_SHLIB_DIR) $(SINGLE_SHLIB_FILES)
|
||||
cd $(SINGLE_SHLIB_DIR) && $(MAKE) FREEBL_CHILD_BUILD=1 \
|
||||
FREEBL_PARENT=../.. CORE_DEPTH=../../$(CORE_DEPTH) $@
|
||||
######################## common stuff #########################
|
||||
|
||||
endif
|
||||
|
||||
# multiple shared libraries
|
||||
|
||||
######################## ABI32_FPU stuff #########################
|
||||
ifdef HAVE_ABI32_FPU
|
||||
ABI32_FPU_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_FPU
|
||||
ABI32_FPU_FILES = $(addprefix $(ABI32_FPU_DIR)/, $(FILES2LN))
|
||||
ALL_TRASH += $(ABI32_FPU_DIR)
|
||||
|
||||
$(ABI32_FPU_DIR):
|
||||
-mkdir $(ABI32_FPU_DIR)
|
||||
|
||||
$(ABI32_FPU_FILES) : $(ABI32_FPU_DIR)/% : %
|
||||
$(LN_S) $(CDDIR)/$* $(ABI32_FPU_DIR)
|
||||
|
||||
release_md libs:: $(ABI32_FPU_DIR) $(ABI32_FPU_FILES)
|
||||
cd $(ABI32_FPU_DIR) && $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI32_FPU=1 \
|
||||
FREEBL_PARENT=../.. CORE_DEPTH=../../$(CORE_DEPTH) $@
|
||||
endif
|
||||
|
||||
######################## ABI32_INT32 stuff #########################
|
||||
ifdef HAVE_ABI32_INT32
|
||||
ABI32_INT32_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_INT32
|
||||
ABI32_INT32_FILES = $(addprefix $(ABI32_INT32_DIR)/, $(FILES2LN))
|
||||
ALL_TRASH += $(ABI32_INT32_DIR)
|
||||
|
||||
$(ABI32_INT32_DIR):
|
||||
-mkdir $(ABI32_INT32_DIR)
|
||||
|
||||
$(ABI32_INT32_FILES) : $(ABI32_INT32_DIR)/% : %
|
||||
$(LN_S) $(CDDIR)/$* $(ABI32_INT32_DIR)
|
||||
|
||||
release_md libs:: $(ABI32_INT32_DIR) $(ABI32_INT32_FILES)
|
||||
cd $(ABI32_INT32_DIR) && $(MAKE) FREEBL_CHILD_BUILD=1 \
|
||||
USE_ABI32_INT32=1 FREEBL_PARENT=../.. CORE_DEPTH=../../$(CORE_DEPTH) $@
|
||||
endif
|
||||
|
||||
######################## ABI32_INT64 stuff #########################
|
||||
ifdef HAVE_ABI32_INT64
|
||||
ABI32_INT64_DIR = $(OBJDIR)/$(OS_TARGET)_ABI32_INT64
|
||||
ABI32_INT64_FILES = $(addprefix $(ABI32_INT64_DIR)/, $(FILES2LN))
|
||||
ALL_TRASH += $(ABI32_INT64_DIR)
|
||||
|
||||
$(ABI32_INT64_DIR):
|
||||
-mkdir $(ABI32_INT64_DIR)
|
||||
|
||||
$(ABI32_INT64_FILES) : $(ABI32_INT64_DIR)/% : %
|
||||
$(LN_S) $(CDDIR)/$* $(ABI32_INT64_DIR)
|
||||
|
||||
release_md libs:: $(ABI32_INT64_DIR) $(ABI32_INT64_FILES)
|
||||
cd $(ABI32_INT64_DIR) && $(MAKE) FREEBL_CHILD_BUILD=1 \
|
||||
USE_ABI32_INT64=1 FREEBL_PARENT=../.. CORE_DEPTH=../../$(CORE_DEPTH) $@
|
||||
endif
|
||||
|
||||
######################## END of 32-bit stuff #########################
|
||||
|
||||
# above is 32-bit builds, below is 64-bit builds
|
||||
|
||||
######################## ABI64_FPU stuff #########################
|
||||
ifdef HAVE_ABI64_FPU
|
||||
ABI64_FPU_DIR = $(OBJDIR)/$(OS_TARGET)_ABI64_FPU
|
||||
ABI64_FPU_FILES = $(addprefix $(ABI64_FPU_DIR)/, $(FILES2LN))
|
||||
ALL_TRASH += $(ABI64_FPU_DIR)
|
||||
|
||||
$(ABI64_FPU_DIR):
|
||||
-mkdir $(ABI64_FPU_DIR)
|
||||
|
||||
$(ABI64_FPU_FILES) : $(ABI64_FPU_DIR)/% : %
|
||||
$(LN_S) $(CDDIR)/$* $(ABI64_FPU_DIR)
|
||||
|
||||
release_md libs:: $(ABI64_FPU_DIR) $(ABI64_FPU_FILES)
|
||||
cd $(ABI64_FPU_DIR) && $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI64_FPU=1 \
|
||||
FREEBL_PARENT=../.. CORE_DEPTH=../../$(CORE_DEPTH) $@
|
||||
endif
|
||||
|
||||
######################## ABI64_INT stuff #########################
|
||||
ifdef HAVE_ABI64_INT
|
||||
ABI64_INT_DIR = $(OBJDIR)/$(OS_TARGET)_ABI64_INT
|
||||
ABI64_INT_FILES = $(addprefix $(ABI64_INT_DIR)/, $(FILES2LN))
|
||||
ALL_TRASH += $(ABI64_INT_DIR)
|
||||
|
||||
$(ABI64_INT_DIR):
|
||||
-mkdir $(ABI64_INT_DIR)
|
||||
|
||||
$(ABI64_INT_FILES) : $(ABI64_INT_DIR)/% : %
|
||||
$(LN_S) $(CDDIR)/$* $(ABI64_INT_DIR)
|
||||
|
||||
release_md libs:: $(ABI64_INT_DIR) $(ABI64_INT_FILES)
|
||||
cd $(ABI64_INT_DIR) && $(MAKE) FREEBL_CHILD_BUILD=1 USE_ABI64_INT=1 \
|
||||
FREEBL_PARENT=../.. CORE_DEPTH=../../$(CORE_DEPTH) $@
|
||||
endif
|
||||
|
||||
endif # FREEBL_CHILD_BUILD
|
||||
|
||||
|
||||
# Bugzilla Bug 209827: disable optimization to work around what appears
|
||||
# to be a VACPP optimizer bug.
|
||||
ifdef XP_OS2_VACPP
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
#define WORD ARC4WORD
|
||||
#endif
|
||||
|
||||
#if defined(NSS_USE_HYBRID) && !defined(SOLARIS) && !defined(NSS_USE_64)
|
||||
#if defined(IS_64) && !defined(__sparc) && !defined(NSS_USE_64)
|
||||
typedef unsigned long long WORD;
|
||||
#else
|
||||
typedef unsigned long WORD;
|
||||
|
@ -351,7 +351,7 @@ rc4_unrolled(RC4Context *cx, unsigned char *output,
|
|||
ARCFOUR_NEXT_BYTE(); streamWord |= (WORD)cx->S[t] << (n );
|
||||
#endif
|
||||
|
||||
#if (defined(NSS_USE_HYBRID) && !defined(SOLARIS)) || defined(NSS_USE_64)
|
||||
#if (defined(IS_64) && !defined(__sparc)) || defined(NSS_USE_64)
|
||||
/* 64-bit wordsize */
|
||||
#ifdef IS_LITTLE_ENDIAN
|
||||
#define ARCFOUR_NEXT_WORD() \
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* $Id: blapi.h,v 1.22 2005/08/27 01:09:21 wtchang%redhat.com Exp $ */
|
||||
/* $Id: blapi.h,v 1.23 2005/09/07 02:47:16 saul.edwards%sun.com Exp $ */
|
||||
|
||||
#ifndef _BLAPI_H_
|
||||
#define _BLAPI_H_
|
||||
|
@ -982,6 +982,7 @@ extern SECStatus RNG_GenerateGlobalRandomBytes(void *dest, size_t len);
|
|||
*/
|
||||
extern void RNG_RNGShutdown(void);
|
||||
|
||||
extern void RNG_SystemInfoForRNG(void);
|
||||
|
||||
/* Generate PQGParams and PQGVerify structs.
|
||||
* Length of seed and length of h both equal length of P.
|
||||
|
|
|
@ -36,38 +36,21 @@
|
|||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# only do this in the outermost freebl build.
|
||||
ifndef FREEBL_RECURSIVE_BUILD
|
||||
# we only do this stuff for some of the 32-bit builds, no 64-bit builds
|
||||
ifndef USE_64
|
||||
ifndef FREEBL_CHILD_BUILD
|
||||
|
||||
ifeq ($(OS_TARGET), HP-UX)
|
||||
ifneq ($(OS_TEST), ia64)
|
||||
FREEBL_EXTENDED_BUILD = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_TARGET),SunOS)
|
||||
ifeq ($(CPU_ARCH),sparc)
|
||||
FREEBL_EXTENDED_BUILD = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef FREEBL_EXTENDED_BUILD
|
||||
# We're going to change this build so that it builds libfreebl.a with
|
||||
# just loader.c. Then we have to build this directory twice again to
|
||||
# build the two DSOs.
|
||||
# To build libfreebl.a with just loader.c, we must now override many
|
||||
# of the make variables setup by the prior inclusion of CORECONF's config.mk
|
||||
|
||||
CSRCS = loader.c sysrand.c
|
||||
CSRCS = loader.c
|
||||
SIMPLE_OBJS = $(CSRCS:.c=$(OBJ_SUFFIX))
|
||||
OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(SIMPLE_OBJS))
|
||||
ALL_TRASH := $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \
|
||||
$(NOSUCHFILE) so_locations
|
||||
endif
|
||||
|
||||
#end of 32-bit only stuff.
|
||||
endif
|
||||
# this is not a recursive child make. We make a static lib. (archive)
|
||||
|
||||
# Override the values defined in coreconf's ruleset.mk.
|
||||
#
|
||||
|
@ -83,25 +66,50 @@ endif
|
|||
PROGRAM =
|
||||
|
||||
else
|
||||
# This is a recursive build.
|
||||
# This is a recursive child make. We build the shared lib.
|
||||
|
||||
TARGETS = $(SHARED_LIBRARY)
|
||||
TARGETS = $(SHARED_LIBRARY)
|
||||
LIBRARY =
|
||||
PROGRAM =
|
||||
|
||||
#ifeq ($(OS_TARGET), HP-UX)
|
||||
EXTRA_LIBS += \
|
||||
$(DIST)/lib/libsecutil.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
EXTRA_LIBS += $(DIST)/lib/$(LIB_PREFIX)secutil.$(LIB_SUFFIX)
|
||||
|
||||
# $(PROGRAM) has NO explicit dependencies on $(EXTRA_SHARED_LIBS)
|
||||
# $(EXTRA_SHARED_LIBS) come before $(OS_LIBS), except on AIX.
|
||||
EXTRA_SHARED_LIBS += \
|
||||
-L$(DIST)/lib/ \
|
||||
ifeq (,$(filter-out WIN%,$(OS_TARGET)))
|
||||
|
||||
# don't want the 32 in the shared library name
|
||||
SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
||||
#IMPORT_LIBRARY = $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
|
||||
IMPORT_LIBRARY =
|
||||
|
||||
# do we need these?
|
||||
#RES = $(OBJDIR)/freebl.res
|
||||
#RESNAME = freebl.rc
|
||||
|
||||
ifdef NS_USE_GCC
|
||||
EXTRA_SHARED_LIBS += \
|
||||
-L$(NSPR_LIB_DIR) \
|
||||
-lplc4 \
|
||||
-lplds4 \
|
||||
-lnspr4 \
|
||||
-lc
|
||||
#endif
|
||||
$(NULL)
|
||||
else # ! NS_USE_GCC
|
||||
EXTRA_SHARED_LIBS += \
|
||||
$(NSPR_LIB_DIR)/$(NSPR31_LIB_PREFIX)plc4.lib \
|
||||
$(NSPR_LIB_DIR)/$(NSPR31_LIB_PREFIX)plds4.lib \
|
||||
$(NSPR_LIB_DIR)/$(NSPR31_LIB_PREFIX)nspr4.lib \
|
||||
$(NULL)
|
||||
endif # NS_USE_GCC
|
||||
|
||||
else
|
||||
|
||||
EXTRA_SHARED_LIBS += \
|
||||
-L$(DIST)/lib/ \
|
||||
-L$(NSPR_LIB_DIR) \
|
||||
-lplc4 \
|
||||
-lplds4 \
|
||||
-lnspr4 \
|
||||
$(NULL)
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
;+#
|
||||
;+# ***** BEGIN LICENSE BLOCK *****
|
||||
;+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
;+#
|
||||
;+# The contents of this file are subject to the Mozilla Public License Version
|
||||
;+# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
;+# the License. You may obtain a copy of the License at
|
||||
;+# http://www.mozilla.org/MPL/
|
||||
;+#
|
||||
;+# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
;+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
;+# for the specific language governing rights and limitations under the
|
||||
;+# License.
|
||||
;+#
|
||||
;+# The Original Code is the Netscape security libraries.
|
||||
;+#
|
||||
;+# The Initial Developer of the Original Code is
|
||||
;+# Netscape Communications Corporation.
|
||||
;+# Portions created by the Initial Developer are Copyright (C) 2000
|
||||
;+# the Initial Developer. All Rights Reserved.
|
||||
;+#
|
||||
;+# Contributor(s):
|
||||
;+#
|
||||
;+# Alternatively, the contents of this file may be used under the terms of
|
||||
;+# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
;+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
;+# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
;+# of those above. If you wish to allow use of your version of this file only
|
||||
;+# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
;+# use your version of this file under the terms of the MPL, indicate your
|
||||
;+# decision by deleting the provisions above and replace them with the notice
|
||||
;+# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
;+# the provisions above, a recipient may use your version of this file under
|
||||
;+# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
;+#
|
||||
;+# ***** END LICENSE BLOCK *****
|
||||
;+#
|
||||
;+# OK, this file is meant to support SUN, LINUX, AIX and WINDOWS
|
||||
;+# 1. For all unix platforms, the string ";-" means "remove this line"
|
||||
;+# 2. For all unix platforms, the string " DATA " will be removed from any
|
||||
;+# line on which it occurs.
|
||||
;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
|
||||
;+# On AIX, lines containing ";+" will be removed.
|
||||
;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
|
||||
;+# 5. For all unix platforms, after the above processing has taken place,
|
||||
;+# all characters after the first ";" on the line will be removed.
|
||||
;+# And for AIX, the first ";" will also be removed.
|
||||
;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
|
||||
;+# directives are hidden behind ";", ";+", and ";-"
|
||||
;+
|
||||
;+NSSprivate_3.11 { # NSS 3.11 release
|
||||
;+ global:
|
||||
LIBRARY freebl_3 ;-
|
||||
EXPORTS ;-
|
||||
FREEBL_GetVector;
|
||||
;+ local:
|
||||
;+ *;
|
||||
;+};
|
|
@ -37,7 +37,7 @@
|
|||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* $Id: ldvector.c,v 1.11 2005/08/09 02:54:54 nelsonb%netscape.com Exp $ */
|
||||
/* $Id: ldvector.c,v 1.12 2005/09/07 02:47:16 saul.edwards%sun.com Exp $ */
|
||||
|
||||
#include "loader.h"
|
||||
#include "alghmac.h"
|
||||
|
@ -219,6 +219,8 @@ static const struct FREEBLVectorStr vector =
|
|||
HMAC_Finish,
|
||||
HMAC_Destroy,
|
||||
|
||||
RNG_SystemInfoForRNG,
|
||||
|
||||
/* End of Version 3.008. */
|
||||
};
|
||||
|
||||
|
|
|
@ -37,210 +37,193 @@
|
|||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* $Id: loader.c,v 1.21 2005/08/09 02:54:54 nelsonb%netscape.com Exp $ */
|
||||
/* $Id: loader.c,v 1.22 2005/09/07 02:47:16 saul.edwards%sun.com Exp $ */
|
||||
|
||||
#include "loader.h"
|
||||
#include "prmem.h"
|
||||
#include "prerror.h"
|
||||
#include "prinit.h"
|
||||
|
||||
static const char* default_name =
|
||||
SHLIB_PREFIX"freebl"SHLIB_VERSION"."SHLIB_SUFFIX;
|
||||
|
||||
/* getLibName() returns the name of the library to load. */
|
||||
|
||||
#if defined(SOLARIS)
|
||||
#include <stddef.h>
|
||||
#include <strings.h>
|
||||
#include <sys/systeminfo.h>
|
||||
#if defined(SOLARIS2_5)
|
||||
static int
|
||||
isHybrid(void)
|
||||
{
|
||||
long buflen;
|
||||
int rv = 0; /* false */
|
||||
char buf[256];
|
||||
buflen = sysinfo(SI_MACHINE, buf, sizeof buf);
|
||||
if (buflen > 0) {
|
||||
rv = (!strcmp(buf, "sun4u") || !strcmp(buf, "sun4u1"));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
#else /* SunOS2.6or higher has SI_ISALIST */
|
||||
|
||||
static int
|
||||
isHybrid(void)
|
||||
{
|
||||
long buflen;
|
||||
int rv = 0; /* false */
|
||||
char buf[256];
|
||||
buflen = sysinfo(SI_ISALIST, buf, sizeof buf);
|
||||
if (buflen > 0) {
|
||||
#if defined(NSS_USE_64)
|
||||
char * found = strstr(buf, "sparcv9+vis");
|
||||
|
||||
#if defined(__x86_64__) || defined(__x86_64) || defined(_X86_)
|
||||
|
||||
static const char * getLibName(void) { return default_name; }
|
||||
|
||||
#else
|
||||
char * found = strstr(buf, "sparcv8plus+vis");
|
||||
#if defined(NSS_USE_64)
|
||||
|
||||
const static char fast_hybrid_shared_lib[] = "libfreebl_64fpu_3.so";
|
||||
const static char slow_hybrid_shared_lib[] = "libfreebl_64int_3.so";
|
||||
const static char non_hybrid_shared_lib[] = "libfreebl_64fpu_3.so";
|
||||
|
||||
const static char slow_hybrid_isa[] = "sparcv9";
|
||||
const static char fast_hybrid_isa[] = "sparcv9+vis";
|
||||
|
||||
#else
|
||||
|
||||
const static char fast_hybrid_shared_lib[] = "libfreebl_32fpu_3.so";
|
||||
const static char slow_hybrid_shared_lib[] = "libfreebl_32int64_3.so";
|
||||
const static char non_hybrid_shared_lib[] = "libfreebl_32int_3.so";
|
||||
|
||||
const static char slow_hybrid_isa[] = "sparcv8plus";
|
||||
const static char fast_hybrid_isa[] = "sparcv8plus+vis";
|
||||
|
||||
#endif
|
||||
rv = (found != 0);
|
||||
|
||||
static const char *
|
||||
getLibName(void)
|
||||
{
|
||||
char * found_slow_hybrid;
|
||||
char * found_fast_hybrid;
|
||||
long buflen;
|
||||
char buf[256];
|
||||
|
||||
buflen = sysinfo(SI_ISALIST, buf, sizeof buf);
|
||||
if (buflen <= 0)
|
||||
return NULL;
|
||||
found_slow_hybrid = strstr(buf, slow_hybrid_isa);
|
||||
found_fast_hybrid = strstr(buf, fast_hybrid_isa);
|
||||
if (found_fast_hybrid &&
|
||||
(!found_slow_hybrid ||
|
||||
(found_slow_hybrid - found_fast_hybrid) >= 0)) {
|
||||
return fast_hybrid_shared_lib;
|
||||
}
|
||||
return rv;
|
||||
if (found_slow_hybrid) {
|
||||
return slow_hybrid_shared_lib;
|
||||
}
|
||||
return non_hybrid_shared_lib;
|
||||
}
|
||||
#endif
|
||||
#elif defined(HPUX)
|
||||
#endif /* x86_64 Solaris */
|
||||
|
||||
#elif defined(HPUX) && !defined(NSS_USE_64) && !defined(__ia64)
|
||||
/* This code tests to see if we're running on a PA2.x CPU.
|
||||
** It returns true (1) if so, and false (0) otherwise.
|
||||
*/
|
||||
static int
|
||||
isHybrid(void)
|
||||
static const char *
|
||||
getLibName(void)
|
||||
{
|
||||
long cpu = sysconf(_SC_CPU_VERSION);
|
||||
return (cpu == CPU_PA_RISC2_0);
|
||||
return (cpu == CPU_PA_RISC2_0)
|
||||
? "libfreebl_32fpu_3.sl"
|
||||
: "libfreebl_32int32_3.sl" ;
|
||||
}
|
||||
|
||||
#else
|
||||
#error "code for this platform is missing."
|
||||
/* default case, for platforms/ABIs that have only one freebl shared lib. */
|
||||
static const char * getLibName(void) { return default_name; }
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On Solaris, if an application using libnss3.so is linked
|
||||
* with the -R linker option, the -R search patch is only used
|
||||
* to search for the direct dependencies of the application
|
||||
* (such as libnss3.so) and is not used to search for the
|
||||
* dependencies of libnss3.so. So we build libnss3.so with
|
||||
* the -R '$ORIGIN' linker option to instruct it to search for
|
||||
* its dependencies (libfreebl_*.so) in the same directory
|
||||
* where it resides. This requires that libnss3.so, not
|
||||
* libnspr4.so, be the shared library that calls dlopen().
|
||||
* Therefore we have to duplicate the relevant code in the PR
|
||||
* load library functions here.
|
||||
* We use PR_GetLibraryFilePathname to get the pathname of the loaded
|
||||
* shared lib that contains this function, and then do a PR_LoadLibrary
|
||||
* with an absolute pathname for the freebl shared library.
|
||||
*/
|
||||
|
||||
#if defined(SOLARIS)
|
||||
#include "prio.h"
|
||||
#include "prprf.h"
|
||||
#include <stdio.h>
|
||||
#include "prsystem.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
const char* softoken=SHLIB_PREFIX"softokn"SOFTOKEN_SHLIB_VERSION"."SHLIB_SUFFIX;
|
||||
|
||||
typedef struct {
|
||||
void *dlh;
|
||||
PRLibrary *dlh;
|
||||
} BLLibrary;
|
||||
|
||||
static BLLibrary *
|
||||
bl_LoadLibrary(const char *name)
|
||||
{
|
||||
BLLibrary *lib;
|
||||
const char *error;
|
||||
BLLibrary *lib = NULL;
|
||||
PRFuncPtr fn_addr;
|
||||
char* softokenPath = NULL;
|
||||
char* fullName = NULL;
|
||||
PRLibSpec libSpec;
|
||||
|
||||
libSpec.type = PR_LibSpec_Pathname;
|
||||
lib = PR_NEWZAP(BLLibrary);
|
||||
if (NULL == lib) {
|
||||
PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
|
||||
return NULL;
|
||||
}
|
||||
lib->dlh = dlopen(name, RTLD_NOW | RTLD_LOCAL);
|
||||
if (NULL == lib->dlh) {
|
||||
PR_SetError(PR_LOAD_LIBRARY_ERROR, 0);
|
||||
error = dlerror();
|
||||
if (NULL != error)
|
||||
PR_SetErrorText(strlen(error), error);
|
||||
PR_Free(lib);
|
||||
return NULL;
|
||||
|
||||
/* Get the pathname for the loaded libsoftokn, i.e. /usr/lib/libsoftokn3.so
|
||||
* PR_GetLibraryFilePathname works with either the base library name or a
|
||||
* function pointer, depending on the platform. So call it even if fn_addr
|
||||
* is NULL. We can't query an exported symbol such as NSC_GetFunctionList,
|
||||
* because on some platforms we can't find symbols in loaded implicit
|
||||
* dependencies such as libsoftokn.
|
||||
* But we can just get the address of this function !
|
||||
*/
|
||||
fn_addr = (PRFuncPtr) &bl_LoadLibrary;
|
||||
softokenPath = PR_GetLibraryFilePathname(softoken, fn_addr);
|
||||
|
||||
/* Remove "libsoftokn" from the pathname and add the freebl libname */
|
||||
if (softokenPath) {
|
||||
char* c = strrchr(softokenPath, PR_GetDirectorySeparator());
|
||||
if (c) {
|
||||
size_t softoknPathSize = 1 + c - softokenPath;
|
||||
fullName = (char*) PORT_Alloc(strlen(name) + softoknPathSize + 2);
|
||||
if (fullName) {
|
||||
fullName[0] = NULL;
|
||||
strncat(fullName, softokenPath, softoknPathSize);
|
||||
strcat(fullName, name);
|
||||
}
|
||||
}
|
||||
PR_Free(softokenPath);
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
static void *
|
||||
bl_FindSymbol(BLLibrary *lib, const char *name)
|
||||
{
|
||||
void *f;
|
||||
const char *error;
|
||||
|
||||
f = dlsym(lib->dlh, name);
|
||||
if (NULL == f) {
|
||||
PR_SetError(PR_FIND_SYMBOL_ERROR, 0);
|
||||
error = dlerror();
|
||||
if (NULL != error)
|
||||
PR_SetErrorText(strlen(error), error);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
static PRStatus
|
||||
bl_UnloadLibrary(BLLibrary *lib)
|
||||
{
|
||||
const char *error;
|
||||
|
||||
if (dlclose(lib->dlh) == -1) {
|
||||
PR_SetError(PR_UNLOAD_LIBRARY_ERROR, 0);
|
||||
error = dlerror();
|
||||
if (NULL != error)
|
||||
PR_SetErrorText(strlen(error), error);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
PR_Free(lib);
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
#elif defined(HPUX)
|
||||
|
||||
#include <dl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef struct {
|
||||
shl_t dlh;
|
||||
} BLLibrary;
|
||||
|
||||
static BLLibrary *
|
||||
bl_LoadLibrary(const char *name)
|
||||
{
|
||||
BLLibrary *lib;
|
||||
const char *error;
|
||||
|
||||
lib = PR_NEWZAP(BLLibrary);
|
||||
if (NULL == lib) {
|
||||
PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
|
||||
return NULL;
|
||||
}
|
||||
lib->dlh = shl_load(name, DYNAMIC_PATH | BIND_IMMEDIATE, 0L);
|
||||
if (NULL == lib->dlh) {
|
||||
PR_SetError(PR_LOAD_LIBRARY_ERROR, errno);
|
||||
error = strerror(errno);
|
||||
if (NULL != error)
|
||||
PR_SetErrorText(strlen(error), error);
|
||||
PR_Free(lib);
|
||||
return NULL;
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
static void *
|
||||
bl_FindSymbol(BLLibrary *lib, const char *name)
|
||||
{
|
||||
void *f;
|
||||
const char *error;
|
||||
|
||||
if (shl_findsym(&lib->dlh, name, TYPE_PROCEDURE, &f) == -1) {
|
||||
f = NULL;
|
||||
PR_SetError(PR_FIND_SYMBOL_ERROR, errno);
|
||||
error = strerror(errno);
|
||||
if (NULL != error)
|
||||
PR_SetErrorText(strlen(error), error);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
static PRStatus
|
||||
bl_UnloadLibrary(BLLibrary *lib)
|
||||
{
|
||||
const char *error;
|
||||
|
||||
if (shl_unload(lib->dlh) == -1) {
|
||||
PR_SetError(PR_UNLOAD_LIBRARY_ERROR, errno);
|
||||
error = strerror(errno);
|
||||
if (NULL != error)
|
||||
PR_SetErrorText(strlen(error), error);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
PR_Free(lib);
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
#error "code for this platform is missing."
|
||||
if (fullName) {
|
||||
#ifdef DEBUG_LOADER
|
||||
PR_fprintf(PR_STDOUT, "\nAttempting to load fully-qualified %s\n",
|
||||
fullName);
|
||||
#endif
|
||||
libSpec.value.pathname = fullName;
|
||||
lib->dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL);
|
||||
PORT_Free(fullName);
|
||||
}
|
||||
if (!lib->dlh) {
|
||||
#ifdef DEBUG_LOADER
|
||||
PR_fprintf(PR_STDOUT, "\nAttempting to load %s\n", name);
|
||||
#endif
|
||||
libSpec.value.pathname = name;
|
||||
lib->dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL);
|
||||
}
|
||||
if (NULL == lib->dlh) {
|
||||
#ifdef DEBUG_LOADER
|
||||
PR_fprintf(PR_STDOUT, "\nLoading failed : %s.\n", name);
|
||||
#endif
|
||||
PR_Free(lib);
|
||||
lib = NULL;
|
||||
}
|
||||
return lib;
|
||||
}
|
||||
|
||||
static void *
|
||||
bl_FindSymbol(BLLibrary *lib, const char *name)
|
||||
{
|
||||
void *f;
|
||||
|
||||
f = PR_FindSymbol(lib->dlh, name);
|
||||
return f;
|
||||
}
|
||||
|
||||
static PRStatus
|
||||
bl_UnloadLibrary(BLLibrary *lib)
|
||||
{
|
||||
if (PR_SUCCESS != PR_UnloadLibrary(lib->dlh)) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
PR_Free(lib);
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
#define LSB(x) ((x)&0xff)
|
||||
#define MSB(x) ((x)>>8)
|
||||
|
@ -253,18 +236,13 @@ static const char *libraryName = NULL;
|
|||
static PRStatus
|
||||
freebl_LoadDSO( void )
|
||||
{
|
||||
int hybrid = isHybrid();
|
||||
BLLibrary * handle;
|
||||
const char * name;
|
||||
const char * name = getLibName();
|
||||
|
||||
name = hybrid ?
|
||||
#if defined( AIX )
|
||||
"libfreebl_hybrid_3_shr.a" : "libfreebl_pure32_3_shr.a";
|
||||
#elif defined( HPUX )
|
||||
"libfreebl_hybrid_3.sl" : "libfreebl_pure32_3.sl";
|
||||
#else
|
||||
"libfreebl_hybrid_3.so" : "libfreebl_pure32_3.so";
|
||||
#endif
|
||||
if (!name) {
|
||||
PR_SetError(PR_LOAD_LIBRARY_ERROR, 0);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
handle = bl_LoadLibrary(name);
|
||||
if (handle) {
|
||||
|
@ -1530,7 +1508,7 @@ HMAC_Init(HMACContext *cx, const SECHashObject *hashObj,
|
|||
const unsigned char *secret, unsigned int secret_len, PRBool isFIPS)
|
||||
{
|
||||
if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
||||
return NULL;
|
||||
return SECFailure;
|
||||
return (vector->p_HMAC_Init)(cx, hashObj, secret, secret_len, isFIPS);
|
||||
}
|
||||
|
||||
|
@ -1567,3 +1545,11 @@ HMAC_Clone(HMACContext *cx)
|
|||
return (vector->p_HMAC_Clone)(cx);
|
||||
}
|
||||
|
||||
void
|
||||
RNG_SystemInfoForRNG(void)
|
||||
{
|
||||
if (!vector && PR_SUCCESS != freebl_RunLoaderOnce())
|
||||
return ;
|
||||
(vector->p_RNG_SystemInfoForRNG)();
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* $Id: loader.h,v 1.15 2005/08/09 02:54:54 nelsonb%netscape.com Exp $ */
|
||||
/* $Id: loader.h,v 1.16 2005/09/07 02:47:16 saul.edwards%sun.com Exp $ */
|
||||
|
||||
#ifndef _LOADER_H_
|
||||
#define _LOADER_H_ 1
|
||||
|
@ -446,6 +446,8 @@ struct FREEBLVectorStr {
|
|||
unsigned int max_result_len);
|
||||
void (* p_HMAC_Destroy)(HMACContext *cx);
|
||||
|
||||
void (* p_RNG_SystemInfoForRNG)(void);
|
||||
|
||||
/* Version 3.008 came to here */
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#
|
||||
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
|
@ -36,25 +36,47 @@
|
|||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# NOTE: any ifdefs in this file must be defined on the gmake command line
|
||||
# (if anywhere). They cannot come from Makefile or config.mk
|
||||
|
||||
CORE_DEPTH = ../../..
|
||||
|
||||
MODULE = nss
|
||||
|
||||
ifndef FREEBL_RECURSIVE_BUILD
|
||||
LIBRARY_NAME = freebl
|
||||
else
|
||||
ifdef USE_PURE_32
|
||||
CORE_DEPTH = ../../../..
|
||||
LIBRARY_NAME = freebl_pure32
|
||||
else
|
||||
LIBRARY_NAME = freebl_hybrid
|
||||
ifdef FREEBL_CHILD_BUILD
|
||||
ifdef USE_ABI32_INT32
|
||||
LIBRARY_NAME = freebl_32int
|
||||
endif
|
||||
ifdef USE_ABI32_INT64
|
||||
LIBRARY_NAME = freebl_32int64
|
||||
endif
|
||||
ifdef USE_ABI32_FPU
|
||||
LIBRARY_NAME = freebl_32fpu
|
||||
endif
|
||||
ifdef USE_ABI64_INT
|
||||
LIBRARY_NAME = freebl_64int
|
||||
endif
|
||||
ifdef USE_ABI64_FPU
|
||||
LIBRARY_NAME = freebl_64fpu
|
||||
endif
|
||||
endif
|
||||
ifndef LIBRARY_NAME
|
||||
LIBRARY_NAME = freebl
|
||||
endif
|
||||
|
||||
# same version as rest of freebl
|
||||
LIBRARY_VERSION = _3
|
||||
$(LIBRARY_NAME).def: ../../freebl.def
|
||||
cp ../../freebl.def $(LIBRARY_NAME).def
|
||||
|
||||
DEFINES += -DSHLIB_SUFFIX=\"$(DLL_SUFFIX)\" -DSHLIB_PREFIX=\"$(DLL_PREFIX)\"
|
||||
MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def
|
||||
|
||||
SOFTOKEN_LIBRARY_VERSION = 3
|
||||
# same version as rest of NSS, but prefixed with _
|
||||
LIBRARY_VERSION = _$(SOFTOKEN_LIBRARY_VERSION)
|
||||
|
||||
DEFINES += -DSHLIB_SUFFIX=\"$(DLL_SUFFIX)\" -DSHLIB_PREFIX=\"$(DLL_PREFIX)\" \
|
||||
-DSHLIB_VERSION=\"$(LIBRARY_VERSION)\" \
|
||||
-DSOFTOKEN_SHLIB_VERSION=\"$(SOFTOKEN_LIBRARY_VERSION)\"
|
||||
|
||||
REQUIRES =
|
||||
|
||||
|
@ -76,6 +98,8 @@ PRIVATE_EXPORTS = \
|
|||
|
||||
MPI_HDRS = mpi-config.h mpi.h mpi-priv.h mplogic.h mpprime.h logtab.h mp_gf2m.h
|
||||
MPI_SRCS = mpprime.c mpmontg.c mplogic.c mpi.c mp_gf2m.c
|
||||
|
||||
|
||||
ECL_HDRS = ecl-exp.h ecl.h ec2.h ecp.h ecl-priv.h
|
||||
ifdef NSS_ENABLE_ECC
|
||||
ECL_SRCS = ecl.c ecl_curve.c ecl_mult.c ecl_gf.c \
|
||||
|
@ -134,6 +158,7 @@ ALL_HDRS = \
|
|||
vis_proto.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
ifdef NSS_ENABLE_ECC
|
||||
DEFINES += -DNSS_ENABLE_ECC
|
||||
endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче