Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 835919 - Allow optionally building nss without softoken in the tr…
…ee, r=rrelya
  • Loading branch information
Elio Maldonado committed Apr 10, 2013
1 parent 4142b66 commit 0ca144c
Show file tree
Hide file tree
Showing 8 changed files with 85 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
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) $(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 built nss without softoken use the system installed bltest tool.
# The FREEBL_BINDIR location is plaform dependent. See the comments
# regarding this location in nss/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} ${FREBL_BINDIR}/bltest -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
8 changes: 8 additions & 0 deletions tests/common/init.sh
Expand Up @@ -647,6 +647,14 @@ 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.
#
FREEBL_BINDIR = [ ${NSS_BUILD_WITHOUT_SOFTOKEN} = "1" ] && ${FREEBL_BINDIR} || ${BINDIR}
SCRIPTNAME=$0
INIT_SOURCED=TRUE #whatever one does - NEVER export this one please
fi
17 changes: 15 additions & 2 deletions tests/fips/fips.sh
Expand Up @@ -223,9 +223,22 @@ fips_140()
# is needed to copy files one by one.
echo "mkdir ${MANGLEDIR}"
mkdir ${MANGLEDIR}
# When building nss without softoken use the system installed softoken library located
# in SOFTOKEN_LIB_DIR. This variable will have been set by the nss package mainainer.
# Fedora, for example, installs it in /usr/lib${ARCH} but other platforms may place
# the libraries in a different location.
for lib in `ls ${LIBDIR}`; do
echo "cp ${LIBDIR}/${lib} ${MANGLEDIR}"
cp ${LIBDIR}/${lib} ${MANGLEDIR}
# Only softoken is used in the mangling test
if [ ${lib} = ${DLL_PREFIX}softokn3.so ]; then
if [ ${NSS_BUILD_WITHOUT_SOFTOKEN} = "1" ]; then
# use the system installed softoken library
echo "cp ${SOFTOKEN_LIB_DIR}/${lib} ${MANGLEDIR}"
cp ${SOFTOKEN_LIB_DIR}/${lib} ${MANGLEDIR}
else
echo "cp ${LIBDIR}/${lib} ${MANGLEDIR}"
cp ${LIBDIR}/${lib} ${MANGLEDIR}
fi
fi
done

echo "$SCRIPTNAME: Detect mangled softoken--------------------------"
Expand Down

0 comments on commit 0ca144c

Please sign in to comment.