summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/Makefile8
-rw-r--r--cmd/manifest.mn4
-rw-r--r--cmd/platlibs.mk31
-rw-r--r--lib/Makefile11
-rw-r--r--lib/manifest.mn2
-rwxr-xr-xtests/cipher/cipher.sh13
-rw-r--r--tests/common/init.sh8
-rwxr-xr-xtests/fips/fips.sh17
8 files changed, 85 insertions, 9 deletions
diff --git a/cmd/Makefile b/cmd/Makefile
index b98205926..0ae45649c 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -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.
diff --git a/cmd/manifest.mn b/cmd/manifest.mn
index f66abc306..4ebe00478 100644
--- a/cmd/manifest.mn
+++ b/cmd/manifest.mn
@@ -11,7 +11,7 @@ REQUIRES = nss nspr libdbm
DIRS = lib \
addbuiltin \
atob \
- bltest \
+ $(BLTEST_SRCDIR) \
btoa \
certcgi \
certutil \
@@ -23,7 +23,7 @@ DIRS = lib \
derdump \
digest \
httpserv \
- fipstest \
+ $(FIPSTEST_SRCDIR) \
$(LOWHASHTEST_SRCDIR) \
listsuites \
makepqg \
diff --git a/cmd/platlibs.mk b/cmd/platlibs.mk
index 332681dd4..200faf701 100644
--- a/cmd/platlibs.mk
+++ b/cmd/platlibs.mk
@@ -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) \
@@ -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) \
@@ -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) \
@@ -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.
diff --git a/lib/Makefile b/lib/Makefile
index 669b41bb0..620fc5c5b 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -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
diff --git a/lib/manifest.mn b/lib/manifest.mn
index 4c27f931a..ac009d3d2 100644
--- a/lib/manifest.mn
+++ b/lib/manifest.mn
@@ -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 \
diff --git a/tests/cipher/cipher.sh b/tests/cipher/cipher.sh
index 1eb4a3f0a..6703ad9fd 100755
--- a/tests/cipher/cipher.sh
+++ b/tests/cipher/cipher.sh
@@ -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
@@ -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
diff --git a/tests/common/init.sh b/tests/common/init.sh
index b3d44b034..d625b7701 100644
--- a/tests/common/init.sh
+++ b/tests/common/init.sh
@@ -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
diff --git a/tests/fips/fips.sh b/tests/fips/fips.sh
index 183d01516..39b49bb75 100755
--- a/tests/fips/fips.sh
+++ b/tests/fips/fips.sh
@@ -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--------------------------"