[nginx] SSL: EVP_MD_CTX was made opaque in OpenSSL 1.1.0.

Maxim Dounin mdounin at mdounin.ru
Thu Mar 31 23:57:44 UTC 2016


details:   http://hg.nginx.org/nginx/rev/ddf761495ce6
branches:  
changeset: 6490:ddf761495ce6
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Thu Mar 31 23:38:36 2016 +0300
description:
SSL: EVP_MD_CTX was made opaque in OpenSSL 1.1.0.

diffstat:

 src/event/ngx_event_openssl.c |  23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diffs (78 lines):

diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -2157,7 +2157,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ss
     int                   n, i;
     X509                 *cert;
     X509_NAME            *name;
-    EVP_MD_CTX            md;
+    EVP_MD_CTX           *md;
     unsigned int          len;
     STACK_OF(X509_NAME)  *list;
     u_char                buf[EVP_MAX_MD_SIZE];
@@ -2167,15 +2167,18 @@ ngx_ssl_session_id_context(ngx_ssl_t *ss
      * the server certificate, and the client CA list.
      */
 
-    EVP_MD_CTX_init(&md);
-
-    if (EVP_DigestInit_ex(&md, EVP_sha1(), NULL) == 0) {
+    md = EVP_MD_CTX_create();
+    if (md == NULL) {
+        return NGX_ERROR;
+    }
+
+    if (EVP_DigestInit_ex(md, EVP_sha1(), NULL) == 0) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                       "EVP_DigestInit_ex() failed");
         goto failed;
     }
 
-    if (EVP_DigestUpdate(&md, sess_ctx->data, sess_ctx->len) == 0) {
+    if (EVP_DigestUpdate(md, sess_ctx->data, sess_ctx->len) == 0) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                       "EVP_DigestUpdate() failed");
         goto failed;
@@ -2189,7 +2192,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ss
         goto failed;
     }
 
-    if (EVP_DigestUpdate(&md, buf, len) == 0) {
+    if (EVP_DigestUpdate(md, buf, len) == 0) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                       "EVP_DigestUpdate() failed");
         goto failed;
@@ -2209,7 +2212,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ss
                 goto failed;
             }
 
-            if (EVP_DigestUpdate(&md, buf, len) == 0) {
+            if (EVP_DigestUpdate(md, buf, len) == 0) {
                 ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                               "EVP_DigestUpdate() failed");
                 goto failed;
@@ -2217,13 +2220,13 @@ ngx_ssl_session_id_context(ngx_ssl_t *ss
         }
     }
 
-    if (EVP_DigestFinal_ex(&md, buf, &len) == 0) {
+    if (EVP_DigestFinal_ex(md, buf, &len) == 0) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
                       "EVP_DigestUpdate() failed");
         goto failed;
     }
 
-    EVP_MD_CTX_cleanup(&md);
+    EVP_MD_CTX_destroy(md);
 
     if (SSL_CTX_set_session_id_context(ssl->ctx, buf, len) == 0) {
         ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
@@ -2235,7 +2238,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ss
 
 failed:
 
-    EVP_MD_CTX_cleanup(&md);
+    EVP_MD_CTX_destroy(md);
 
     return NGX_ERROR;
 }



More information about the nginx-devel mailing list