diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-07-28 08:46:18 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-08-04 13:54:42 +0200 |
commit | b9f8a51fca7552be88efa8789ed504ae415106d1 (patch) | |
tree | 2263cc28f3d37f3f3a2ac0ed6e17f6925d92a344 | |
parent | 98aef258ac83312449d59adf8e75932df4c7e9be (diff) | |
download | gnutls-b9f8a51fca7552be88efa8789ed504ae415106d1.tar.gz |
tests: added basic unit test of gnutls_pkcs11_token_check_mechanism
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | tests/pkcs11/pkcs11-mechanisms.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/pkcs11/pkcs11-mechanisms.c b/tests/pkcs11/pkcs11-mechanisms.c index 424037e345..c38f6ac193 100644 --- a/tests/pkcs11/pkcs11-mechanisms.c +++ b/tests/pkcs11/pkcs11-mechanisms.c @@ -93,10 +93,22 @@ void doit(void) if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) break; success("mech: %lu\n", mech); + ret = gnutls_pkcs11_token_check_mechanism("pkcs11:", mech, NULL, 0, 0); + if (ret == 0) { + fail("mechanism %ld was reported are supported, but is not found!\n", mech); + } } if (debug) printf("done\n\n\n"); + ret = gnutls_pkcs11_token_check_mechanism("pkcs11:", -1, NULL, 0, 0); + if (ret != 0) + fail("found invalid mechanism1\n"); + + ret = gnutls_pkcs11_token_check_mechanism("pkcs11:", -3, NULL, 0, 0); + if (ret != 0) + fail("found invalid mechanism2\n"); + gnutls_pkcs11_deinit(); gnutls_global_deinit(); } |