- tmp_env = getenv("CT_DIR");
- ct_dir = OPENSSL_strdup(tmp_env != NULL ? tmp_env : "ct");
- tmp_env = getenv("CERTS_DIR");
- certs_dir = OPENSSL_strdup(tmp_env != NULL ? tmp_env : "certs");
+ if (!TEST_time_t_le(abs((int)difftime(time(NULL), default_time)),
+ time_tolerance))
+ goto end;
+
+ success = 1;
+end:
+ CT_POLICY_EVAL_CTX_free(ct_policy_ctx);
+ return success;
+}
+
+static int test_ctlog_from_base64(void)
+{
+ CTLOG *ctlogp = NULL;
+ const char notb64[] = "\01\02\03\04";
+ const char pad[] = "====";
+ const char name[] = "name";
+
+ /* We expect these to both fail! */
+ if (!TEST_true(!CTLOG_new_from_base64(&ctlogp, notb64, name))
+ || !TEST_true(!CTLOG_new_from_base64(&ctlogp, pad, name)))
+ return 0;
+ return 1;
+}
+#endif
+
+int setup_tests(void)
+{
+#ifndef OPENSSL_NO_CT
+ if ((ct_dir = getenv("CT_DIR")) == NULL)
+ ct_dir = "ct";
+ if ((certs_dir = getenv("CERTS_DIR")) == NULL)
+ certs_dir = "certs";