summaryrefslogtreecommitdiff
path: root/tests/cve-2008-4989.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-10-03 09:04:30 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-10-03 09:07:38 +0200
commitbd255113a4a94a4f71fd19fdad6ebd41cbba514c (patch)
tree05f4cc81b7bbe595081efafaf556f8949add13ab /tests/cve-2008-4989.c
parentceaf4128a457f9dcbb5d88635b34faf4260eee5c (diff)
downloadgnutls-bd255113a4a94a4f71fd19fdad6ebd41cbba514c.tar.gz
avoid the usage of error()
Diffstat (limited to 'tests/cve-2008-4989.c')
-rw-r--r--tests/cve-2008-4989.c52
1 files changed, 40 insertions, 12 deletions
diff --git a/tests/cve-2008-4989.c b/tests/cve-2008-4989.c
index 3c672be645..c054426b7f 100644
--- a/tests/cve-2008-4989.c
+++ b/tests/cve-2008-4989.c
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <error.h>
#include <string.h>
#include <utils.h>
@@ -166,30 +165,42 @@ main (int argc, char *argv[])
{
ret = gnutls_x509_crt_init (&certs[i]);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_init[%d]: %s", (int) i,
+ {
+ fprintf (stderr, "gnutls_x509_crt_init[%d]: %s", (int) i,
gnutls_strerror (ret));
+ exit(1);
+ }
tmp.data = (unsigned char *) pem_certs[i];
tmp.size = strlen (pem_certs[i]);
ret = gnutls_x509_crt_import (certs[i], &tmp, GNUTLS_X509_FMT_PEM);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_import[%d]: %s", (int) i,
+ {
+ fprintf (stderr, "gnutls_x509_crt_import[%d]: %s", (int) i,
gnutls_strerror (ret));
+ exit(1);
+ }
}
ret = gnutls_x509_crt_init (&ca);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_init: %s",
+ {
+ fprintf(stderr, "gnutls_x509_crt_init: %s",
gnutls_strerror (ret));
+ exit(1);
+ }
tmp.data = (unsigned char *) pem_ca;
tmp.size = strlen (pem_ca);
ret = gnutls_x509_crt_import (ca, &tmp, GNUTLS_X509_FMT_PEM);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_import: %s",
+ {
+ fprintf(stderr, "gnutls_x509_crt_import: %s",
gnutls_strerror (ret));
+ exit(1);
+ }
ret = gnutls_x509_crt_list_verify (certs, CHAIN_LENGTH,
&ca, 1,
@@ -197,11 +208,17 @@ main (int argc, char *argv[])
GNUTLS_VERIFY_DISABLE_TIME_CHECKS,
&verify_status);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_list_verify[%d]: %s", (int) i,
+ {
+ fprintf(stderr, "gnutls_x509_crt_list_verify[%d]: %s", (int) i,
gnutls_strerror (ret));
+ exit(1);
+ }
if (verify_status != (GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID))
- error (EXIT_FAILURE, 0, "verify_status: %d", verify_status);
+ {
+ fprintf( stderr, "verify_status: %d", verify_status);
+ exit(1);
+ }
gnutls_x509_crt_deinit (ca);
for (i = 0; i < CHAIN_LENGTH; i++)
@@ -212,28 +229,39 @@ main (int argc, char *argv[])
ret = gnutls_x509_crt_init (&self_cert);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_init: %s",
+ {
+ fprintf( stderr, "gnutls_x509_crt_init: %s",
gnutls_strerror (ret));
+ exit(1);
+ }
tmp.data = (unsigned char *) pem_self_cert;
tmp.size = strlen (pem_self_cert);
ret = gnutls_x509_crt_import (self_cert, &tmp, GNUTLS_X509_FMT_PEM);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_import: %s",
+ {
+ fprintf (stderr, "gnutls_x509_crt_import: %s",
gnutls_strerror (ret));
-
+ exit(1);
+ }
ret = gnutls_x509_crt_list_verify (&self_cert, 1,
&self_cert, 1,
NULL, 0,
GNUTLS_VERIFY_DISABLE_TIME_CHECKS,
&verify_status);
if (ret < 0)
- error (EXIT_FAILURE, 0, "gnutls_x509_crt_list_verify[%d]: %s", (int) i,
+ {
+ fprintf(stderr, "gnutls_x509_crt_list_verify[%d]: %s", (int) i,
gnutls_strerror (ret));
+ exit(1);
+ }
if (verify_status != 0)
- error (EXIT_FAILURE, 0, "verify_status: %d", verify_status);
+ {
+ fprintf(stderr, "verify_status: %d", verify_status);
+ exit(1);
+ }
gnutls_x509_crt_deinit (self_cert);