ref: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237757#c5
--- a/src/event/ngx_event_openssl_stapling.c.org  2019-05-12 23:56:58.526833000 +0200
+++ b/src/event/ngx_event_openssl_stapling.c      2019-05-13 01:31:53.737800000 +0200
@@ -298,7 +298,10 @@
     SSL_CTX_select_current_cert(ssl->ctx, cert);
 #endif

-#ifdef SSL_CTRL_GET_EXTRA_CHAIN_CERTS
+#ifdef SSL_CTX_get0_chain_certs
+    /* OpenSSL 1.0.2+ */
+    SSL_CTX_get0_chain_certs(ssl->ctx, &chain);
+#elif SSL_CTRL_GET_EXTRA_CHAIN_CERTS
     /* OpenSSL 1.0.1+ */
     SSL_CTX_get_extra_chain_certs(ssl->ctx, &chain);
 #else
@@ -655,7 +658,10 @@
     SSL_CTX_select_current_cert(staple->ssl_ctx, ctx->cert);
 #endif

-#ifdef SSL_CTRL_GET_EXTRA_CHAIN_CERTS
+#ifdef SSL_CTX_get0_chain_certs
+    /* OpenSSL 1.0.2+ */
+    SSL_CTX_get0_chain_certs(staple->ssl_ctx, &chain);
+#elif SSL_CTRL_GET_EXTRA_CHAIN_CERTS
     /* OpenSSL 1.0.1+ */
     SSL_CTX_get_extra_chain_certs(staple->ssl_ctx, &chain);
 #else
