Debian Codegraph @

debian/tests/engine-smoke

raw
1 #!/bin/sh
2
3 # This runs a quick check to see if the openssl engine from libp11 is available
4 # and can be loaded, and if its capabilities can be listed
5
6 set -e
7
8 ssl_cnf=$(mktemp)
9 DEB_BUILD_MULTIARCH="$(dpkg-architecture -q DEB_BUILD_MULTIARCH)"
10
11 cleanup() {
12 if [ -n "${ssl_cnf}" -a -f "${ssl_cnf}" ]; then
13 rm -f "${ssl_cnf}"
14 fi
15 }
16
17 trap cleanup EXIT
18
19 cat > ${ssl_cnf} <<EOF
20 HOME = .
21 openssl_conf = openssl_init
22
23 [openssl_init]
24 engines = engine_section
25
26 [engine_section]
27 pkcs11 = pkcs11_section
28
29 [pkcs11_section]
30 engine_id = pkcs11
31 dynamic_path = /usr/lib/${DEB_BUILD_MULTIARCH}/engines-3/pkcs11.so
32 MODULE_PATH = opensc-pkcs11.so
33 init = 0
34 EOF
35
36 OPENSSL_CONF="${ssl_cnf}" \
37 openssl engine -t -tt -c pkcs11