Changeset b0e5dae in mod_gnutls


Ignore:
Timestamp:
Feb 12, 2016, 9:20:46 PM (4 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
aeaf28b
Parents:
6f644fa
Message:

Test suite: Add support for SoftHSM 2

./configure now detects SoftHSM version 1 or 2, and test case
"24_pkcs11_cert" can use either to provide its PKCS #11 token.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r6f644fa rb0e5dae  
    172172MODULE_LIBS="${APR_MEMCACHE_LIBS} ${LIBGNUTLS_LIBS}"
    173173
    174 AC_PATH_PROGS([SOFTHSM], [softhsm], [no])
     174AC_PATH_PROGS([SOFTHSM], [softhsm2-util softhsm], [no])
    175175if test "${SOFTHSM}" != "no"; then
    176176        softhsm_version=$(${SOFTHSM} --version)
  • test/Makefile.am

    r6f644fa rb0e5dae  
    113113endif
    114114
    115 # SoftHSM files
    116 check_DATA += server/softhsm.db
    117 MOSTLYCLEANFILES += tests/24_pkcs11_cert/softhsm.conf server/softhsm.db
    118 
     115
     116# SoftHSM tokens. Note that the SoftHSM 2 token is a directory and
     117# hence has to be treated slightly differently.
     118SOFTHSM_TOKEN = server/softhsm.db
     119SOFTHSM2_TOKEN = server/softhsm2.db
     120
     121# Tokens should be cleaned whether or not the matching SoftHSM version
     122# was detected on the last ./configure run.
     123MOSTLYCLEANFILES += $(SOFTHSM_TOKEN)
     124# included in mostlyclean-local below
     125clean-softhsm2-db:
     126        -rm -rf $(SOFTHSM2_TOKEN)
     127
     128if HAVE_SOFTHSM1
     129check_DATA += $(SOFTHSM_TOKEN)
     130endif HAVE_SOFTHSM1
     131
     132if HAVE_SOFTHSM2
     133check_DATA += $(SOFTHSM2_TOKEN)
     134endif HAVE_SOFTHSM2
    119135
    120136check_DATA += make-test-dirs
     
    122138make-test-dirs:
    123139        mkdir -p $(extra_dirs)
    124 .PHONY: make-test-dirs
     140
     141.PHONY: make-test-dirs clean-softhsm2-db
     142
     143mostlyclean-local: clean-softhsm2-db
    125144
    126145clean-local:
  • test/test-24_pkcs11_cert.bash

    r6f644fa rb0e5dae  
    33testdir="$(dirname ${0})/tests/24_pkcs11_cert"
    44
    5 # The Apache/SoftHSM configuration mixes up directories, so generate a
    6 # config file with an absolute path to the token database from a
    7 # template. Generating it on every run avoids problems if the source
     5# The Apache/SoftHSM configuration mixes up directories, so generate
     6# config files with absolute paths to the token database from a
     7# template. Generating them on every run avoids problems if the source
    88# tree was moved.
    99tmp_softhsm_conf="$(mktemp mod_gnutls_test-XXXXXX.conf)"
     
    1414trap cleanup_tmpconf EXIT
    1515
    16 cat - >"${tmp_softhsm_conf}" <<EOF
     16if [ "${SOFTHSM_MAJOR_VERSION}" = "1" ]; then
     17    cat - >"${tmp_softhsm_conf}" <<EOF
    17180:$(realpath $(pwd))/server/softhsm.db
    1819EOF
    19 export SOFTHSM_CONF="${tmp_softhsm_conf}"
     20    export SOFTHSM_CONF="${tmp_softhsm_conf}"
     21elif [ "${SOFTHSM_MAJOR_VERSION}" = "2" ]; then
     22    cat - >"${tmp_softhsm_conf}" <<EOF
     23objectstore.backend = file
     24directories.tokendir = $(realpath $(pwd))/server/softhsm2.db
     25EOF
     26    export SOFTHSM2_CONF="${tmp_softhsm_conf}"
     27fi
     28
    2029echo "Generated temporary SoftHSM config ${tmp_softhsm_conf}:"
    2130cat "${tmp_softhsm_conf}"
  • test/test_ca.mk

    r6f644fa rb0e5dae  
    6464        $(srcdir)/softhsm.bash init $(dir $@)secret.key $(dir $@)x509.pem
    6565
     66%/softhsm2.conf: %/secret.key
     67        echo "objectstore.backend = file" > $@
     68        echo "directories.tokendir = $(dir $@)softhsm2.db" >> $@
     69
     70%/softhsm2.db: %/x509.pem %/secret.key %/softhsm2.conf
     71        mkdir -p $@
     72        SOFTHSM="@SOFTHSM@" \
     73        SOFTHSM2_CONF="$(dir $@)softhsm2.conf" \
     74        $(srcdir)/softhsm.bash init $(dir $@)secret.key $(dir $@)x509.pem
     75
    6676# Generate CRL revoking a certain certificate. Currently used to
    6777# revoke the server certificate and check if setting the CRL as
Note: See TracChangeset for help on using the changeset viewer.