692b48
diff --git a/modules/ssl/ssl_engine_init.c b/modules/ssl/ssl_engine_init.c
692b48
index 70d151e..e4f5fc8 100644
692b48
--- a/modules/ssl/ssl_engine_init.c
692b48
+++ b/modules/ssl/ssl_engine_init.c
692b48
@@ -1095,7 +1095,9 @@ static apr_status_t ssl_init_ctx_crl(server_rec *s,
692b48
 /*
692b48
  * Read a file that optionally contains the server certificate in PEM
692b48
  * format, possibly followed by a sequence of CA certificates that
692b48
- * should be sent to the peer in the SSL Certificate message.
692b48
+ * should be sent to the peer in the SSL Certificate message.  Returns
692b48
+ * 0 on success, otherwise the OpenSSL error stack contents should be
692b48
+ * reported.
692b48
  */
692b48
 static int use_certificate_chain(
692b48
     SSL_CTX *ctx, char *file, int skipfirst, pem_password_cb *cb)
692b48
@@ -1128,8 +1130,10 @@ static int use_certificate_chain(
692b48
         ctx->extra_certs = NULL;
692b48
     }
692b48
 #endif
692b48
+
692b48
     /* create new extra chain by loading the certs */
692b48
     n = 0;
692b48
+    ERR_clear_error();
692b48
     while ((x509 = PEM_read_bio_X509(bio, NULL, cb, NULL)) != NULL) {
692b48
         if (!SSL_CTX_add_extra_chain_cert(ctx, x509)) {
692b48
             X509_free(x509);
692b48
@@ -1190,6 +1194,7 @@ static apr_status_t ssl_init_ctx_cert_chain(server_rec *s,
692b48
     if (n < 0) {
692b48
         ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, APLOGNO(01903)
692b48
                 "Failed to configure CA certificate chain!");
692b48
+        ssl_log_ssl_error(SSLLOG_MARK, APLOG_EMERG, s);
692b48
         return ssl_die(s);
692b48
     }
692b48
 
692b48
diff --git a/modules/ssl/ssl_util_ocsp.c b/modules/ssl/ssl_util_ocsp.c
692b48
index b11a6e9..b66e151 100644
692b48
--- a/modules/ssl/ssl_util_ocsp.c
692b48
+++ b/modules/ssl/ssl_util_ocsp.c
692b48
@@ -363,7 +363,9 @@ static STACK_OF(X509) *modssl_read_ocsp_certificates(const char *file)
692b48
         BIO_free(bio);
692b48
         return NULL;
692b48
     }
692b48
+
692b48
     /* create new extra chain by loading the certs */
692b48
+    ERR_clear_error();
692b48
     while ((x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL)) != NULL) {
692b48
         if (!other_certs) {
692b48
                 other_certs = sk_X509_new_null();