diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-10-09 12:34:46 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-10-09 12:39:24 +0200 |
commit | f734509643ff3f2ec63b50efe62772002b216158 (patch) | |
tree | 2f812b350e9e8721f8bc3d57504bc5f64d5708b3 /tests/chainverify.c | |
parent | ceb3dc6a4969fd7903460e89d57f0c93aa2d5071 (diff) | |
download | gnutls-f734509643ff3f2ec63b50efe62772002b216158.tar.gz |
tests: allow running specific chainverify tests on fixed dates
Diffstat (limited to 'tests/chainverify.c')
-rw-r--r-- | tests/chainverify.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/chainverify.c b/tests/chainverify.c index 85cf690730..1630d32d2f 100644 --- a/tests/chainverify.c +++ b/tests/chainverify.c @@ -34,14 +34,15 @@ #include "utils.h" #include "test-chains.h" +#define DEFAULT_THEN 1256803113 +static time_t then = DEFAULT_THEN; + /* GnuTLS internally calls time() to find out the current time when verifying certificates. To avoid a time bomb, we hard code the current time. This should work fine on systems where the library call to time is resolved at run-time. */ static time_t mytime(time_t * t) { - time_t then = 1256803113; - if (t) *t = then; @@ -156,6 +157,11 @@ void doit(void) if (debug) printf("\tVerifying..."); + if (chains[i].expected_time != 0) + then = chains[i].expected_time; + else + then = DEFAULT_THEN; + if (chains[i].purpose == NULL) { ret = gnutls_x509_crt_list_verify(certs, j, &ca, 1, NULL, 0, |