Debian Codegraph @

tests/ed448-keygen.softhsm

raw
1 #!/bin/bash
2
3 # Copyright © 2024 Mobi - Com Polska Sp. z o.o.
4 # Author: Małgorzata Olszówka <[email protected]>
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19 outdir="output.$$"
20
21 # Load common test functions
22 . ${srcdir}/common.sh
23
24 # Initialize SoftHSM DB
25 init_db
26
27 # Create token
28 init_card "token1"
29
30 # Load openssl settings
31 . ${srcdir}/openssl-settings.sh
32
33 # Restore openssl settings
34 trap cleanup EXIT
35
36 ${WRAPPER} ./ed448-keygen ${MODULE} token1 libp11-keylabel ${PIN} "${outdir}/engines.cnf"
37 rc=$?
38 if [[ $rc -eq 77 ]]; then
39 echo "Ed448 key generation test skipped."
40 rm -rf "$outdir"
41 exit 77
42 elif [[ $rc -ne 0 ]]; then
43 echo "Ed448 key generation test failed."
44 exit 1
45 fi
46
47 echo "Checking pkcs11-tool result..."
48 list_objects | grep -q libp11-keylabel
49 if [[ $? != 0 ]]; then
50 echo "Ed448 key was not properly generated."
51 exit 1
52 fi
53
54 rm -rf "$outdir"
55
56 exit 0