]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Add test for gnutls_x509_crt_list_import2 with flag GNUTLS_X509_CRT_LIST_FAIL_IF_UNSO...
authorTim Kosse <tim.kosse@filezilla-project.org>
Sat, 9 Jul 2016 11:03:55 +0000 (13:03 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 28 Jul 2016 08:54:15 +0000 (10:54 +0200)
tests/chainverify-unsorted.c

index 829b13636ffa605bee22a1d25c75c17061067e6e..8dc99bbbd972f8d7a9a0e623da57ff52a0b94949 100644 (file)
@@ -654,6 +654,17 @@ void doit(void)
        /* Chain 2 */
        data.data = (void *) chain2;
        data.size = sizeof(chain2);
+
+       /* verify whether the GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED flag is
+        * considered by gnutls_x509_crt_list_import2() */
+       ret =
+               gnutls_x509_crt_list_import2(&crts, &crts_size, &data,
+                                        GNUTLS_X509_FMT_PEM, GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED);
+       if (ret != GNUTLS_E_CERTIFICATE_LIST_UNSORTED) {
+               fail("gnutls_x509_crt_list_import2 with flag GNUTLS_E_CERTIFICATE_LIST_UNSORTED on unsorted chain didn't fail: %s\n",  gnutls_strerror(ret));
+               exit(1);
+       }
+
        ret =
            gnutls_x509_crt_list_import2(&crts, &crts_size, &data,
                                         GNUTLS_X509_FMT_PEM, 0);