Skip to content

Commit f0a0bcc

Browse files
authored
Add nss.fips.cfg support to OpenJDK tree (#22)
Reviewed-by: @martinuy
1 parent 0bd5ca9 commit f0a0bcc

File tree

5 files changed

+43
-1
lines changed

5 files changed

+43
-1
lines changed

make/autoconf/build-aux/pkg.m4

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,19 @@ else
179179
ifelse([$3], , :, [$3])
180180
fi[]dnl
181181
])# PKG_CHECK_MODULES
182+
183+
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
184+
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
185+
dnl -------------------------------------------
186+
dnl Since: 0.28
187+
dnl
188+
dnl Retrieves the value of the pkg-config variable for the given module.
189+
AC_DEFUN([PKG_CHECK_VAR],
190+
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
191+
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
192+
193+
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
194+
AS_VAR_COPY([$1], [pkg_cv_][$1])
195+
196+
AS_VAR_IF([$1], [""], [$5], [$4])dnl
197+
])dnl PKG_CHECK_VAR

make/autoconf/lib-sysconf.m4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ AC_DEFUN_ONCE([LIB_SETUP_SYSCONF_LIBS],
3232
#
3333
# Check for the NSS library
3434
#
35+
AC_MSG_CHECKING([for NSS library directory])
36+
PKG_CHECK_VAR(NSS_LIBDIR, nss, libdir, [AC_MSG_RESULT([$NSS_LIBDIR])], [AC_MSG_RESULT([not found])])
3537
36-
AC_MSG_CHECKING([whether to use the system NSS library with the System Configurator (libsysconf)])
38+
AC_MSG_CHECKING([whether to link the system NSS library with the System Configurator (libsysconf)])
3739
3840
# default is not available
3941
DEFAULT_SYSCONF_NSS=no
@@ -81,4 +83,5 @@ AC_DEFUN_ONCE([LIB_SETUP_SYSCONF_LIBS],
8183
fi
8284
fi
8385
AC_SUBST(USE_SYSCONF_NSS)
86+
AC_SUBST(NSS_LIBDIR)
8487
])

make/autoconf/spec.gmk.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@ INSTALL_SYSCONFDIR=@sysconfdir@
839839
USE_SYSCONF_NSS:=@USE_SYSCONF_NSS@
840840
NSS_LIBS:=@NSS_LIBS@
841841
NSS_CFLAGS:=@NSS_CFLAGS@
842+
NSS_LIBDIR:=@NSS_LIBDIR@
842843

843844
USE_EXTERNAL_LCMS:=@USE_EXTERNAL_LCMS@
844845
LCMS_CFLAGS:=@LCMS_CFLAGS@

make/modules/java.base/Gendata.gmk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,17 @@ $(GENDATA_JAVA_SECURITY): $(BUILD_TOOLS_JDK) $(GENDATA_JAVA_SECURITY_SRC) $(REST
9898
TARGETS += $(GENDATA_JAVA_SECURITY)
9999

100100
################################################################################
101+
102+
GENDATA_NSS_FIPS_CFG_SRC := $(TOPDIR)/src/java.base/share/conf/security/nss.fips.cfg.in
103+
GENDATA_NSS_FIPS_CFG := $(SUPPORT_OUTPUTDIR)/modules_conf/java.base/security/nss.fips.cfg
104+
105+
$(GENDATA_NSS_FIPS_CFG): $(GENDATA_NSS_FIPS_CFG_SRC)
106+
$(call LogInfo, Generating nss.fips.cfg)
107+
$(call MakeTargetDir)
108+
$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_$(@F), \
109+
( $(SED) -e 's:@NSS_LIBDIR@:$(NSS_LIBDIR):g' $< ) > $@ \
110+
)
111+
112+
TARGETS += $(GENDATA_NSS_FIPS_CFG)
113+
114+
################################################################################
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name = NSS-FIPS
2+
nssLibraryDirectory = @NSS_LIBDIR@
3+
nssSecmodDirectory = sql:/etc/pki/nssdb
4+
nssDbMode = readOnly
5+
nssModule = fips
6+
7+
attributes(*,CKO_SECRET_KEY,CKK_GENERIC_SECRET)={ CKA_SIGN=true }
8+

0 commit comments

Comments
 (0)