/* Setup BIO socket to OCSP responder */
cbio = BIO_new_connect(host);
- bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ /*
+ * Only print debugging information if we're in debugging
+ * mode.
+ */
+ if (debug_flag) {
+ bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ } else {
+ bio_out = NULL;
+ }
BIO_set_conn_port(cbio, port);
#if OPENSSL_VERSION_NUMBER < 0x1000003f
}
if (!OCSP_check_validity(thisupd, nextupd, nsec, maxage)) {
- BIO_puts(bio_out, "WARNING: Status times invalid.\n");
- ERR_print_errors(bio_out);
+ if (bio_out) {
+ BIO_puts(bio_out, "WARNING: Status times invalid.\n");
+ ERR_print_errors(bio_out);
+ }
goto ocsp_end;
}
- BIO_puts(bio_out, "\tThis Update: ");
- ASN1_GENERALIZEDTIME_print(bio_out, thisupd);
- BIO_puts(bio_out, "\n");
- if (nextupd) {
- BIO_puts(bio_out, "\tNext Update: ");
- ASN1_GENERALIZEDTIME_print(bio_out, nextupd);
+
+ if (bio_out) {
+ BIO_puts(bio_out, "\tThis Update: ");
+ ASN1_GENERALIZEDTIME_print(bio_out, thisupd);
BIO_puts(bio_out, "\n");
+ if (nextupd) {
+ BIO_puts(bio_out, "\tNext Update: ");
+ ASN1_GENERALIZEDTIME_print(bio_out, nextupd);
+ BIO_puts(bio_out, "\n");
+ }
}
switch (status) {
DEBUG2("[ocsp] --> Cert status: %s",OCSP_cert_status_str(status));
if (reason != -1)
DEBUG2("[ocsp] --> Reason: %s", OCSP_crl_reason_str(reason));
- BIO_puts(bio_out, "\tRevocation Time: ");
- ASN1_GENERALIZEDTIME_print(bio_out, rev);
- BIO_puts(bio_out, "\n");
+
+ if (bio_out) {
+ BIO_puts(bio_out, "\tRevocation Time: ");
+ ASN1_GENERALIZEDTIME_print(bio_out, rev);
+ BIO_puts(bio_out, "\n");
+ }
break;
}