summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2017-10-21 15:17:22 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2017-10-21 15:17:27 +0200
commit3f94962533deba3bbfcbcc0d2bf866d1a1972f99 (patch)
tree9e075b21ee578005db37cbbcc72a234559190165
parent88984a77d7a07b6570b147700a6922d09c8160a9 (diff)
downloadgnutls-3f94962533deba3bbfcbcc0d2bf866d1a1972f99.tar.gz
tests: test whether PKCS#11 generation works without login
Resolves #147 Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rwxr-xr-xtests/suite/testpkcs11.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/suite/testpkcs11.sh b/tests/suite/testpkcs11.sh
index b5306cd973..d1158e857a 100755
--- a/tests/suite/testpkcs11.sh
+++ b/tests/suite/testpkcs11.sh
@@ -370,6 +370,26 @@ generate_temp_ecc_privkey () {
fi
}
+# $1: token
+# $2: PIN
+# $3: bits
+# The same as generate_temp_ecc_privkey but no explicit login is performed.
+# p11tool should detect that login is required for the operation.
+generate_temp_ecc_privkey_no_login () {
+ export GNUTLS_PIN="$2"
+ token="$1"
+ bits="$3"
+
+ echo -n "* Generating ECC private key without --login (${bits})... "
+ ${P11TOOL} ${ADDITIONAL_PARAM} --label "temp-ecc-no-${bits}" --generate-ecc --bits "${bits}" "${token}" --outfile tmp-client.pub >>"${TMPFILE}" 2>&1
+ if test $? = 0; then
+ echo ok
+ else
+ echo failed
+ exit 1
+ fi
+}
+
# $1: name
# $2: label prefix
# $3: generate option
@@ -847,6 +867,9 @@ write_privkey "${TOKEN}" "${GNUTLS_PIN}" "${srcdir}/pkcs11-certs/client.key"
generate_temp_ecc_privkey "${TOKEN}" "${GNUTLS_PIN}" 256
delete_temp_privkey "${TOKEN}" "${GNUTLS_PIN}" ecc-256
+generate_temp_ecc_privkey_no_login "${TOKEN}" "${GNUTLS_PIN}" 256
+delete_temp_privkey "${TOKEN}" "${GNUTLS_PIN}" ecc-no-256
+
generate_temp_ecc_privkey "${TOKEN}" "${GNUTLS_PIN}" 384
delete_temp_privkey "${TOKEN}" "${GNUTLS_PIN}" ecc-384