Skip to content

Commit

Permalink
SSL: EVP_MD_CTX was made opaque in OpenSSL 1.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
pluknet committed Mar 31, 2016
1 parent 8fc9040 commit 66feb8c
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/event/ngx_event_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx)
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];
Expand All @@ -2167,15 +2167,18 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx)
* the server certificate, and the client CA list.
*/

EVP_MD_CTX_init(&md);
md = EVP_MD_CTX_create();
if (md == NULL) {
return NGX_ERROR;
}

if (EVP_DigestInit_ex(&md, EVP_sha1(), NULL) == 0) {
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;
Expand All @@ -2189,7 +2192,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx)
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;
Expand All @@ -2209,21 +2212,21 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx)
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;
}
}
}

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,
Expand All @@ -2235,7 +2238,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx)

failed:

EVP_MD_CTX_cleanup(&md);
EVP_MD_CTX_destroy(md);

return NGX_ERROR;
}
Expand Down

0 comments on commit 66feb8c

Please sign in to comment.