Skip to content

Commit

Permalink
Bug 835919 - Allow optionally building nss without softoken in the tr…
Browse files Browse the repository at this point in the history
…ee, r=rrelyea
  • Loading branch information
Elio Maldonado committed Apr 29, 2013
1 parent bae14cb commit 3404ed4
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 9 deletions.
8 changes: 8 additions & 0 deletions cmd/Makefile
Expand Up @@ -14,6 +14,14 @@ ifdef BUILD_LIBPKIX_TESTS
DIRS += libpkix
endif

ifeq ($(NSS_BUILD_WITHOUT_SOFTOKEN),1)
BLTEST_SRCDIR=
FIPSTEST_SRCDIR=
else
BLTEST_SRCDIR = bltest
FIPSTEST_SRCDIR = fipstest
endif

LOWHASHTEST_SRCDIR=
ifeq ($(FREEBL_LOWHASH),1)
LOWHASHTEST_SRCDIR = lowhashtest # Add the lowhashtest directory to DIRS.
Expand Down
4 changes: 2 additions & 2 deletions cmd/manifest.mn
Expand Up @@ -11,7 +11,7 @@ REQUIRES = nss nspr libdbm
DIRS = lib \
addbuiltin \
atob \
bltest \
$(BLTEST_SRCDIR) \
btoa \
certcgi \
certutil \
Expand All @@ -23,7 +23,7 @@ DIRS = lib \
derdump \
digest \
httpserv \
fipstest \
$(FIPSTEST_SRCDIR) \
$(LOWHASHTEST_SRCDIR) \
listsuites \
makepqg \
Expand Down
31 changes: 28 additions & 3 deletions cmd/platlibs.mk
Expand Up @@ -36,7 +36,18 @@ ifdef USE_STATIC_LIBS

DEFINES += -DNSS_USE_STATIC_LIBS
# $(PROGRAM) has explicit dependencies on $(EXTRA_LIBS)
CRYPTOLIB=$(SOFTOKEN_LIB_DIR)/$(LIB_PREFIX)freebl.$(LIB_SUFFIX)
ifndef USE_SYSTEM_FREEBL
CRYPTOLIB=$(DIST)/lib/$(LIB_PREFIX)freebl.$(LIB_SUFFIX)
SOFTOKENLIB=$(DIST)/lib/$(LIB_PREFIX)softokn.$(LIB_SUFFIX)
else
# Use the system freebl and softoken libraries
CRYPTOLIB=$(FREEBL_LIB_DIR)/$(LIB_PREFIX)freebl.$(LIB_SUFFIX)
SOFTOKENLIB=
EXTRA_SHARED_LIBS += \
-L$(SOFTOKEN_LIB_DIR) \
-lsoftokn3 \
$(NULL)
endif

PKIXLIB = \
$(DIST)/lib/$(LIB_PREFIX)pkixtop.$(LIB_SUFFIX) \
Expand Down Expand Up @@ -67,7 +78,7 @@ EXTRA_LIBS += \
$(DIST)/lib/$(LIB_PREFIX)cryptohi.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)pk11wrap.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)certdb.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)softokn.$(LIB_SUFFIX) \
$(SOFTOKENLIB) \
$(CRYPTOLIB) \
$(DIST)/lib/$(LIB_PREFIX)nsspki.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)nssdev.$(LIB_SUFFIX) \
Expand Down Expand Up @@ -102,7 +113,7 @@ EXTRA_LIBS += \
$(DIST)/lib/$(LIB_PREFIX)certhi.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)nsspki.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)pk11wrap.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)softokn.$(LIB_SUFFIX) \
$(SOFTOKENLIB) \
$(DIST)/lib/$(LIB_PREFIX)certdb.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)nsspki.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)nssdev.$(LIB_SUFFIX) \
Expand Down Expand Up @@ -185,8 +196,22 @@ EXTRA_SHARED_LIBS += \
$(NULL)
endif

ifdef SOFTOKEN_LIB_DIR
ifdef NSS_USE_SYSTEM_FREEBL
EXTRA_SHARED_LIBS += -L$(SOFTOKEN_LIB_DIR) -lsoftokn3
endif
endif

endif # USE_STATIC_LIBS

# If a platform has a system freebl, set USE_SYSTEM_FREEBL to 1 and
# FREEBL_LIBS to the linker command-line arguments for the system nss-util
# (for example, -lfreebl3 on fedora) in the platform's config file in coreconf.
ifdef NSS_USE_SYSTEM_FREEBL
FREEBL_LIBS = $(FREEBL_LIB_DIR)/$(LIB_PREFIX)freebl.$(LIB_SUFFIX)
EXTRA_LIBS += $(FREEBL_LIBS)
endif

# If a platform has a system zlib, set USE_SYSTEM_ZLIB to 1 and
# ZLIB_LIBS to the linker command-line arguments for the system zlib
# (for example, -lz) in the platform's config file in coreconf.
Expand Down
7 changes: 5 additions & 2 deletions cmd/shlibsign/Makefile
Expand Up @@ -45,7 +45,10 @@ endif


# sign any and all shared libraries that contain the word freebl

ifeq ($(NSS_BUILD_WITHOUT_SOFTOKEN),1))
CHECKLIBS=
CHECKLOC=
else
CHECKLIBS = $(DIST)/lib/$(DLL_PREFIX)softokn3.$(DLL_SUFFIX)
CHECKLIBS += $(wildcard $(DIST)/lib/$(DLL_PREFIX)freebl*3.$(DLL_SUFFIX))
ifndef NSS_DISABLE_DBM
Expand All @@ -55,7 +58,7 @@ CHECKLOC = $(CHECKLIBS:.$(DLL_SUFFIX)=.chk)

MD_LIB_RELEASE_FILES = $(CHECKLOC)
ALL_TRASH += $(CHECKLOC)

endif

#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
Expand Down
11 changes: 11 additions & 0 deletions lib/Makefile
Expand Up @@ -62,3 +62,14 @@ include $(CORE_DEPTH)/coreconf/rules.mk
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

ifeq ($(NSS_BUILD_WITHOUT_SOFTOKEN),1)
# Not included when building nss without softoken
UTIL_SRCDIR=
FREEBL_SRCDIR=
SOFTOKEN_SRCDIR=
else
# default is to include all
UTIL_SRCDIR = util
FREEBL_SRCDIR = freebl
SOFTOKEN_SRCDIR = softoken
endif
2 changes: 1 addition & 1 deletion lib/manifest.mn
Expand Up @@ -16,7 +16,7 @@ DEPTH = ..
# smime
# ckfw (builtins module)
# crmf jar (not dll's)
DIRS = util freebl $(SQLITE_SRCDIR) $(DBM_SRCDIR) softoken \
DIRS = $(UTIL_SRCDIR) $(FREEBL_SRCDIR) $(SQLITE_SRCDIR) $(DBM_SRCDIR) $(SOFTOKEN_SRCDIR) \
base dev pki \
libpkix \
certdb certhigh pk11wrap cryptohi nss \
Expand Down
13 changes: 12 additions & 1 deletion tests/cipher/cipher.sh
Expand Up @@ -66,13 +66,16 @@ cipher_main()
failedStr=""
inOff=0
res=0
# If nss was built without softoken use the system installed bltest tool.
# The FREEBL_BINDIR location is platform dependent. See the comments
# regarding this location in tests/common/init.sh.
while [ $inOff -lt 8 ]
do
outOff=0
while [ $outOff -lt 8 ]
do
echo "bltest -T -m $PARAM -d $CIPHERTESTDIR -1 $inOff -2 $outOff"
${PROFTOOL} ${BINDIR}/bltest -T -m $PARAM -d $CIPHERTESTDIR -1 $inOff -2 $outOff
${PROFTOOL} ${FREEBL_BINDIR}/bltest${PROG_SUFFIX} -T -m $PARAM -d $CIPHERTESTDIR -1 $inOff -2 $outOff
if [ $? -ne 0 ]; then
failedStr="$failedStr[$inOff:$outOff]"
fi
Expand Down Expand Up @@ -120,6 +123,14 @@ cipher_cleanup()

################## main #################################################

# When building without softoken, bltest isn't built. It was already
# built and the cipher suite run as part of an nss-softoken build.
if [ ! -x ${DIST}/${OBJDIR}/bin/bltest${PROG_SUFFIX} ]; then
echo "bltest not built, skipping this test." >> ${LOGFILE}
res = 0
html_msg $res $EXP_RET "$TESTNAME"
return 0
fi
cipher_init
cipher_main
cipher_gcm
Expand Down
11 changes: 11 additions & 0 deletions tests/common/init.sh
Expand Up @@ -647,6 +647,17 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
ulimit -c unlimited
fi

#################################################################
# If we built nss without softoken use the system installed tool.
# Fedora, for example, uses /usr/lib${ARCH}/unsupported-tools but
# other platform may place the system installed tests somewhere else.
# The FREEBL_BINDIR environment variable will have been set by the
# package maintainer.
if [ ${NSS_BUILD_WITHOUT_SOFTOKEN} = "1" ]; then
export FREEBL_BINDIR=${FREEBL_BINDIR}
else
export FREEBL_BINDIR=${BINDIR}
fi
SCRIPTNAME=$0
INIT_SOURCED=TRUE #whatever one does - NEVER export this one please
fi
6 changes: 6 additions & 0 deletions tests/fips/fips.sh
Expand Up @@ -233,6 +233,12 @@ fips_140()

echo "mangling ${SOFTOKEN}"
echo "mangle -i ${SOFTOKEN} -o -8 -b 5"
# If nss was built without softoken use the system installed one.
# It's location must be specified by the package maintainer.
if [ ! -e ${MANGLEDIR}/${DLL_PREFIX}softokn3.${DLL_SUFFIX} ]; then
echo "cp ${SOFTOKEN_LIB_DIR}/${DLL_PREFIX}softokn3.${DLL_SUFFIX} ${MANGLEDIR}"
cp ${SOFTOKEN_LIB_DIR}/${DLL_PREFIX}softokn3.${DLL_SUFFIX} ${MANGLEDIR}
fi
${BINDIR}/mangle -i ${SOFTOKEN} -o -8 -b 5 2>&1
if [ $? -eq 0 ]; then
if [ "${OS_ARCH}" = "WINNT" ]; then
Expand Down

0 comments on commit 3404ed4

Please sign in to comment.