diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-06-16 11:30:13 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-06-16 11:30:15 +0200 |
commit | 59f02ca6a59b32e2dc4e492aa82bb6a33fc729f3 (patch) | |
tree | f4638e7115a4b985fd319609c91f890f0667d011 /tests | |
parent | 472ed0f4a8bbea3b3581e85d1ca1a8394df91bf6 (diff) | |
download | gnutls-59f02ca6a59b32e2dc4e492aa82bb6a33fc729f3.tar.gz |
Test the return code of gnutls_x509_trust_list_add_trust_file() when loading a PKCS #11 token.
Check whether the return code of gnutls_x509_trust_list_add_trust_file() is non-zero
when certificates are present.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/suite/pkcs11-chainverify.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/suite/pkcs11-chainverify.c b/tests/suite/pkcs11-chainverify.c index 2aebcf5967..4c1106cded 100644 --- a/tests/suite/pkcs11-chainverify.c +++ b/tests/suite/pkcs11-chainverify.c @@ -225,7 +225,9 @@ void doit(void) } /* write CA certificate to softhsm */ - ret = gnutls_pkcs11_copy_x509_crt(URL, ca, "test-ca", GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED|GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO); + ret = gnutls_pkcs11_copy_x509_crt(URL, ca, "test-ca", GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED| + GNUTLS_PKCS11_OBJ_FLAG_MARK_CA| + GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO); if (ret < 0) { fail("gnutls_pkcs11_copy_x509_crt: %s\n", gnutls_strerror(ret)); exit(1); @@ -235,7 +237,12 @@ void doit(void) ret = gnutls_x509_trust_list_add_trust_file(tl, URL, NULL, 0, 0, 0); if (ret < 0) { - fail("gnutls_x509_trust_list_add_trust_file\n"); + fail("gnutls_x509_trust_list_add_trust_file: %s\n", gnutls_strerror(ret)); + exit(1); + } + + if (ret < 1) { + fail("gnutls_x509_trust_list_add_trust_file returned zero!\n"); exit(1); } |