Skip to content

Commit

Permalink
Issue softhsm#230: Move configuration to an M4 script and update docu…
Browse files Browse the repository at this point in the history
…mentation
  • Loading branch information
bellgrim committed Sep 30, 2016
1 parent a0804df commit 5c0099a
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 26 deletions.
10 changes: 5 additions & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
ACLOCAL_AMFLAGS = -I m4

if P11_MODULE_FILE
p11moddir = $(pk_module_configs)
p11mod_DATA = softhsm2.module
endif

MAINTAINERCLEANFILES = \
config.log config.status softhsm2.module \
$(srcdir)/Makefile.in \
Expand All @@ -16,6 +11,11 @@ MAINTAINERCLEANFILES = \

SUBDIRS = src

if WITH_P11KIT
p11moddir = @P11KIT_PATH@
p11mod_DATA = softhsm2.module
endif

EXTRA_DIST = $(srcdir)/aes_wrap_key_with_pad/botan-diff \
$(srcdir)/aes_wrap_key_with_pad/README \
$(srcdir)/FIPS-NOTES.md \
Expand Down
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ SoftHSM develop
(Patch from Lars Silvén)
* Issue #223: Mark public key as non private by default.
(Patch from Nikos Mavrogiannopoulos)
* Issue #230: Install p11-kit module, to disable use --disable-p11-kit.
(Patch from David Woodhouse)
* Issue #237: Add windows continuous integration build.
(Patch from Peter Polačko)

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ because of the PKCS#11 interface.

## Developers

- Rickard Bellgrim (.SE, The Internet Infrastructure Foundation, www.iis.se)
- Rickard Bellgrim (Knowit Secure AB, www.knowitgroup.com)
- Francis Dupont (ISC, www.isc.org)
- René Post (XPT Software and Consulting, www.xpt.nl)
- Roland van Rijswijk (SURFnet bv, www.surfnet.nl)
Expand Down Expand Up @@ -72,6 +72,9 @@ Options:
--with-objectstore-backend-db
Build with database object store (SQLite3)
--with-sqlite3=PATH Specify prefix of path of SQLite3
--disable-p11-kit Disable p11-kit integration (default enabled)
--with-p11-kit=PATH Specify install path of the p11-kit module, will
override path given by pkg-config

For more options:

Expand Down
23 changes: 7 additions & 16 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ AC_INIT([SoftHSM],[SOFTHSM_VERSION_MAJOR.SOFTHSM_VERSION_MINOR.SOFTHSM_VERSION_F
AC_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([src/Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(foreign)
AM_INIT_AUTOMAKE([foreign subdir-objects])
ACX_PREFIXHACK

# Version info for the library
Expand Down Expand Up @@ -113,6 +113,9 @@ fi
# Set visibility flags so only PKCS#11 entry points are exported
ACX_VISIBILITY

# If we should install the p11-kit module
ACX_P11KIT

# Set full directory paths
full_sysconfdir=`eval eval eval eval eval echo "${sysconfdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
full_localstatedir=`eval eval eval eval eval echo "${localstatedir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
Expand All @@ -123,19 +126,7 @@ softhsmtokendir=${full_localstatedir}/lib/softhsm/tokens/
# Install the library in a sub-directory
full_libdir="$full_libdir/softhsm"
libdir=$full_libdir

AC_ARG_ENABLE([p11-kit],
AS_HELP_STRING([--disable-p11-kit], [Disable p11-kit integration]),
[use_p11kit=$enableval], [use_p11kit=yes])

pk_module_configs=
if test "x${use_p11kit}" != "xno"; then
AC_PATH_PROG(PKGCONFIG, [pkg-config])
if test "x${PKGCONFIG}" != "x" && ${PKGCONFIG} --exists p11-kit-1; then
pk_module_configs=`${PKGCONFIG} --variable=p11_module_configs p11-kit-1`
fi
fi
AM_CONDITIONAL([P11_MODULE_FILE], [test "x${pk_module_configs}" != "x"])
default_softhsm2_lib="$full_libdir/libsofthsm2.so"

# For getConfigPath()
AC_CHECK_FUNCS([getpwuid_r])
Expand Down Expand Up @@ -183,13 +174,13 @@ AC_DEFINE_UNQUOTED(
)
AC_DEFINE_UNQUOTED(
[DEFAULT_PKCS11_LIB],
["$full_libdir/libsofthsm2.so"],
["$default_softhsm2_lib"],
[The default PKCS#11 library]
)

AC_SUBST([pk_module_configs])
AC_SUBST([softhsmtokendir])
AC_SUBST([default_softhsm2_conf])
AC_SUBST([default_softhsm2_lib])

# Generate the libtool script and install script
AC_PROG_INSTALL
Expand Down
36 changes: 36 additions & 0 deletions m4/acx_p11kit.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
AC_DEFUN([ACX_P11KIT],[
AC_ARG_ENABLE([p11-kit],
AC_HELP_STRING([--enable-p11-kit],
[Enable p11-kit integration (default enabled)]
),
[enable_p11kit="${enableval}"],
[enable_p11kit="yes"]
)
AC_ARG_WITH(p11-kit,
AC_HELP_STRING([--with-p11-kit=PATH],[Specify install path of the p11-kit module, will override path given by pkg-config]),
[P11KIT_PATH="$withval"],
[P11KIT_PATH=""]
)
AC_MSG_CHECKING(for p11-kit integration)
if test "x${enable_p11kit}" = "xyes"; then
AC_MSG_RESULT(yes)
if test "x${P11KIT_PATH}" = "x"; then
AC_PATH_PROG(PKGCONFIG, [pkg-config])
if test "x${PKGCONFIG}" != "x" && ${PKGCONFIG} --exists p11-kit-1; then
P11KIT_PATH=`${PKGCONFIG} --variable=p11_module_configs p11-kit-1`
fi
fi
AC_MSG_CHECKING(where to install the p11-kit module)
AC_MSG_RESULT($P11KIT_PATH)
if test "x${P11KIT_PATH}" = "x"; then
AC_MSG_ERROR([Missing install path for the p11-kit module])
fi
else
AC_MSG_RESULT(no)
fi
AC_SUBST(P11KIT_PATH)
AM_CONDITIONAL([WITH_P11KIT], [test "x${enable_p11kit}" = "xyes"])
])
2 changes: 1 addition & 1 deletion softhsm2.module.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file describes how to load the pk11 module
# See: http://p11-glue.freedesktop.org/doc/p11-kit/config.html

module: @libdir@/libsofthsm2.so
module: @default_softhsm2_lib@
7 changes: 4 additions & 3 deletions testing/build-softhsm2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ case "$DISTRIBUTION" in
cd build &&
../configure --prefix="$INSTALL_ROOT" \
--disable-non-paged-memory \
--disable-p11-kit \
--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
--with-migrate \
--with-crypto-backend=botan \
--with-botan="$INSTALL_ROOT" &&
Expand All @@ -46,7 +46,7 @@ case "$DISTRIBUTION" in
cd build &&
../configure --prefix="$INSTALL_ROOT" \
--disable-non-paged-memory \
--disable-p11-kit \
--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
--with-migrate \
--with-crypto-backend=botan \
--with-botan="$INSTALL_ROOT" \
Expand All @@ -66,6 +66,7 @@ case "$DISTRIBUTION" in
cd build &&
../configure --prefix="$INSTALL_ROOT" \
--disable-non-paged-memory \
--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
--with-migrate \
--with-crypto-backend=botan \
--with-botan="$INSTALL_ROOT" \
Expand All @@ -85,7 +86,7 @@ case "$DISTRIBUTION" in
cd build &&
../configure --prefix="$INSTALL_ROOT" \
--disable-non-paged-memory \
--disable-p11-kit \
--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
--with-migrate \
--with-crypto-backend=botan \
--with-botan="$INSTALL_ROOT" &&
Expand Down

0 comments on commit 5c0099a

Please sign in to comment.