diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index d8dd3d3..034b6ed 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -8,7 +8,7 @@
 #include <ngx_config.h>
 #include <ngx_core.h>
 #include <ngx_event.h>
-
+#include <openssl/rand.h>
 
 typedef struct {
     ngx_uint_t  engine;   /* unsigned  engine:1; */
@@ -96,7 +96,7 @@ int  ngx_ssl_stapling_index;
 ngx_int_t
 ngx_ssl_init(ngx_log_t *log)
 {
-    OPENSSL_config(NULL);
+    //OPENSSL_config(NULL);
 
     SSL_library_init();
     SSL_load_error_strings();
@@ -581,15 +581,7 @@ RSA *
 ngx_ssl_rsa512_key_callback(ngx_ssl_conn_t *ssl_conn, int is_export,
     int key_length)
 {
-    static RSA  *key;
-
-    if (key_length == 512) {
-        if (key == NULL) {
-            key = RSA_generate_key(512, RSA_F4, NULL, NULL);
-        }
-    }
-
-    return key;
+    return NULL;
 }
 
 
@@ -1707,7 +1699,7 @@ ngx_ssl_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, char *fmt, ...)
             p++;
         }
 
-        if (p < last && *data && (flags & ERR_TXT_STRING)) {
+        if (p < last && *data && (flags & ERR_FLAG_STRING)) {
             *p++ = ':';
             p = ngx_cpystrn(p, (u_char *) data, last - p);
         }
@@ -2809,39 +2801,6 @@ ngx_openssl_create_conf(ngx_cycle_t *cycle)
 static char *
 ngx_openssl_engine(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 {
-    ngx_openssl_conf_t *oscf = conf;
-
-    ENGINE     *engine;
-    ngx_str_t  *value;
-
-    if (oscf->engine) {
-        return "is duplicate";
-    }
-
-    oscf->engine = 1;
-
-    value = cf->args->elts;
-
-    engine = ENGINE_by_id((const char *) value[1].data);
-
-    if (engine == NULL) {
-        ngx_ssl_error(NGX_LOG_WARN, cf->log, 0,
-                      "ENGINE_by_id(\"%V\") failed", &value[1]);
-        return NGX_CONF_ERROR;
-    }
-
-    if (ENGINE_set_default(engine, ENGINE_METHOD_ALL) == 0) {
-        ngx_ssl_error(NGX_LOG_WARN, cf->log, 0,
-                      "ENGINE_set_default(\"%V\", ENGINE_METHOD_ALL) failed",
-                      &value[1]);
-
-        ENGINE_free(engine);
-
-        return NGX_CONF_ERROR;
-    }
-
-    ENGINE_free(engine);
-
     return NGX_CONF_OK;
 }
 
@@ -2850,5 +2809,4 @@ static void
 ngx_openssl_exit(ngx_cycle_t *cycle)
 {
     EVP_cleanup();
-    ENGINE_cleanup();
 }
diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h
index b7f8500..123cdc4 100644
--- a/src/event/ngx_event_openssl.h
+++ b/src/event/ngx_event_openssl.h
@@ -17,7 +17,9 @@
 #include <openssl/conf.h>
 #include <openssl/engine.h>
 #include <openssl/evp.h>
+#ifdef BORINGSSL_OCSP
 #include <openssl/ocsp.h>
+#endif
 
 #define NGX_SSL_NAME     "OpenSSL"
 
diff --git a/src/event/ngx_event_openssl_stapling.c b/src/event/ngx_event_openssl_stapling.c
index 3a3cc7f..86164dd 100644
--- a/src/event/ngx_event_openssl_stapling.c
+++ b/src/event/ngx_event_openssl_stapling.c
@@ -11,8 +11,8 @@
 #include <ngx_event_connect.h>
 
 
-#ifdef SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB
-
+//#ifdef SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB
+#ifdef BORINGSSL_OCSP
 
 typedef struct {
     ngx_str_t                    staple;
