[nginx] SSL: backed out changeset e7cb5deb951d, reimplemented properly.

Maxim Dounin mdounin at mdounin.ru
Thu Dec 15 17:06:28 UTC 2016


details:   http://hg.nginx.org/nginx/rev/25d0d6dabe00
branches:  
changeset: 6842:25d0d6dabe00
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Thu Dec 15 19:00:23 2016 +0300
description:
SSL: backed out changeset e7cb5deb951d, reimplemented properly.

Changeset e7cb5deb951d breaks build on CentOS 5 with "dereferencing
type-punned pointer will break strict-aliasing rules" warning.  It is
backed out.

Instead, to keep builds with BoringSSL happy, type of the "value"
variable changed to "char *", and an explicit cast added before calling
ngx_parse_http_time().

diffstat:

 src/event/ngx_event_openssl.c          |  8 ++++----
 src/event/ngx_event_openssl_stapling.c |  6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (49 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
@@ -4049,7 +4049,7 @@ ngx_ssl_parse_time(
     ASN1_TIME *asn1time)
 {
     BIO     *bio;
-    u_char  *value;
+    char    *value;
     size_t   len;
     time_t   time;
 
@@ -4069,9 +4069,9 @@ ngx_ssl_parse_time(
 
     BIO_write(bio, "Tue ", sizeof("Tue ") - 1);
     ASN1_TIME_print(bio, asn1time);
-    len = BIO_get_mem_data(bio, (char **) &value);
-
-    time = ngx_parse_http_time(value, len);
+    len = BIO_get_mem_data(bio, &value);
+
+    time = ngx_parse_http_time((u_char *) value, len);
 
     BIO_free(bio);
 
diff --git a/src/event/ngx_event_openssl_stapling.c b/src/event/ngx_event_openssl_stapling.c
--- a/src/event/ngx_event_openssl_stapling.c
+++ b/src/event/ngx_event_openssl_stapling.c
@@ -773,7 +773,7 @@ static time_t
 ngx_ssl_stapling_time(ASN1_GENERALIZEDTIME *asn1time)
 {
     BIO     *bio;
-    u_char  *value;
+    char    *value;
     size_t   len;
     time_t   time;
 
@@ -793,9 +793,9 @@ ngx_ssl_stapling_time(ASN1_GENERALIZEDTI
 
     BIO_write(bio, "Tue ", sizeof("Tue ") - 1);
     ASN1_GENERALIZEDTIME_print(bio, asn1time);
-    len = BIO_get_mem_data(bio, (char **) &value);
+    len = BIO_get_mem_data(bio, &value);
 
-    time = ngx_parse_http_time(value, len);
+    time = ngx_parse_http_time((u_char *) value, len);
 
     BIO_free(bio);
 


More information about the nginx-devel mailing list