[openssl] master update

Dr. Paul Dale pauli at openssl.org
Fri Mar 29 10:53:56 UTC 2019


The branch master has been updated
       via  72962d025f875ac35114ac090b878ee18b246144 (commit)
       via  6fc1e6246f9b29334fd6dcb5b832e75cce7a2ecd (commit)
       via  79bc34185fdd63f2b1057d1d902697ac1852d245 (commit)
       via  80de174281f7bf5ae9799df26153efe476f41b92 (commit)
       via  2661d716d99fc1dd3240dcdbca6ab73d7b61a72b (commit)
       via  64a45882c70e29a725c57894e7f80a6161f457bc (commit)
      from  c75f80a468468b84843a6bc3f16ce84111e345ad (commit)


- Log -----------------------------------------------------------------
commit 72962d025f875ac35114ac090b878ee18b246144
Author: Pauli <paul.dale at oracle.com>
Date:   Fri Mar 29 18:42:37 2019 +1000

    Correctly initialise PACKET to zero in the tests to avoid possible problems
    with padding bytes.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8611)

commit 6fc1e6246f9b29334fd6dcb5b832e75cce7a2ecd
Author: Pauli <paul.dale at oracle.com>
Date:   Fri Mar 29 18:31:10 2019 +1000

    Propery initialise struct sslapitest_log_counts to zero using memset.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8611)

commit 79bc34185fdd63f2b1057d1d902697ac1852d245
Author: Pauli <paul.dale at oracle.com>
Date:   Fri Mar 29 18:27:28 2019 +1000

    Correctly zero the DISPLAY_COLUMNS structure.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8611)

commit 80de174281f7bf5ae9799df26153efe476f41b92
Author: Pauli <paul.dale at oracle.com>
Date:   Fri Mar 29 18:26:53 2019 +1000

    Make the array zeroing explicit using memset.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8611)

commit 2661d716d99fc1dd3240dcdbca6ab73d7b61a72b
Author: Pauli <paul.dale at oracle.com>
Date:   Fri Mar 29 18:19:19 2019 +1000

    It isn't necessary to initialise a struct stat before a stat(2) system call.
    The initialisation was also flawed, failing to account for padding and
    alignment bytes.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8611)

commit 64a45882c70e29a725c57894e7f80a6161f457bc
Author: Pauli <paul.dale at oracle.com>
Date:   Fri Mar 29 18:17:38 2019 +1000

    Ensure that the struct msghdr is properly zeroed.
    
    This is probably harmless but best to properly initialise things.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/8611)

-----------------------------------------------------------------------

Summary of changes:
 apps/openssl.c           |  3 ++-
 crypto/conf/conf_def.c   |  2 +-
 crypto/ec/ecp_nistp224.c |  4 +++-
 engines/e_afalg.c        |  3 ++-
 include/internal/ktls.h  |  3 ++-
 test/clienthellotest.c   |  6 +++++-
 test/packettest.c        | 15 ++++++++++-----
 test/servername_test.c   |  8 +++++++-
 test/sslapitest.c        | 12 +++++++++---
 9 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/apps/openssl.c b/apps/openssl.c
index 119d3e8..6bb2785 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -715,8 +715,9 @@ static void list_type(FUNC_TYPE ft, int one)
 {
     FUNCTION *fp;
     int i = 0;
-    DISPLAY_COLUMNS dc = {0};
+    DISPLAY_COLUMNS dc;
 
+    memset(&dc, 0, sizeof(dc));
     if (!one)
         calculate_columns(&dc);
 
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
index 594f7c5..277e4d6 100644
--- a/crypto/conf/conf_def.c
+++ b/crypto/conf/conf_def.c
@@ -669,7 +669,7 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
 static BIO *process_include(char *include, OPENSSL_DIR_CTX **dirctx,
                             char **dirpath)
 {
-    struct stat st = { 0 };
+    struct stat st;
     BIO *next;
 
     if (stat(include, &st) < 0) {
diff --git a/crypto/ec/ecp_nistp224.c b/crypto/ec/ecp_nistp224.c
index 6539659..e6f095e 100644
--- a/crypto/ec/ecp_nistp224.c
+++ b/crypto/ec/ecp_nistp224.c
@@ -676,7 +676,9 @@ static void felem_contract(felem out, const felem in)
  */
 static void felem_neg(felem out, const felem in)
 {
-    widefelem tmp = {0};
+    widefelem tmp;
+
+    memset(tmp, 0, sizeof(tmp));
     felem_diff_128_64(tmp, in);
     felem_reduce(out, tmp);
 }
diff --git a/engines/e_afalg.c b/engines/e_afalg.c
index 19d98d8..c3f622e 100644
--- a/engines/e_afalg.c
+++ b/engines/e_afalg.c
@@ -412,7 +412,7 @@ static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
                                  size_t inl, const unsigned char *iv,
                                  unsigned int enc)
 {
-    struct msghdr msg = { 0 };
+    struct msghdr msg;
     struct cmsghdr *cmsg;
     struct iovec iov;
     ssize_t sbytes;
@@ -421,6 +421,7 @@ static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
 # endif
     char cbuf[CMSG_SPACE(ALG_IV_LEN(ALG_AES_IV_LEN)) + CMSG_SPACE(ALG_OP_LEN)];
 
+    memset(&msg, 0, sizeof(msg));
     memset(cbuf, 0, sizeof(cbuf));
     msg.msg_control = cbuf;
     msg.msg_controllen = sizeof(cbuf);
diff --git a/include/internal/ktls.h b/include/internal/ktls.h
index 542acf3..23a0397 100644
--- a/include/internal/ktls.h
+++ b/include/internal/ktls.h
@@ -118,12 +118,13 @@ static ossl_inline int ktls_start(int fd,
 static ossl_inline int ktls_send_ctrl_message(int fd, unsigned char record_type,
                                               const void *data, size_t length)
 {
-    struct msghdr msg = { 0 };
+    struct msghdr msg;
     int cmsg_len = sizeof(record_type);
     struct cmsghdr *cmsg;
     char buf[CMSG_SPACE(cmsg_len)];
     struct iovec msg_iov;       /* Vector of data to send/receive into */
 
+    memset(&msg, 0, sizeof(msg));
     msg.msg_control = buf;
     msg.msg_controllen = sizeof(buf);
     cmsg = CMSG_FIRSTHDR(&msg);
diff --git a/test/clienthellotest.c b/test/clienthellotest.c
index 7fdb5bc..0afad6d 100644
--- a/test/clienthellotest.c
+++ b/test/clienthellotest.c
@@ -58,7 +58,7 @@ static int test_client_hello(int currtest)
     BIO *wbio;
     long len;
     unsigned char *data;
-    PACKET pkt = {0}, pkt2 = {0}, pkt3 = {0};
+    PACKET pkt, pkt2, pkt3;
     char *dummytick = "Hello World!";
     unsigned int type = 0;
     int testresult = 0;
@@ -71,6 +71,10 @@ static int test_client_hello(int currtest)
         return 1;
 #endif
 
+    memset(&pkt, 0, sizeof(pkt));
+    memset(&pkt2, 0, sizeof(pkt2));
+    memset(&pkt3, 0, sizeof(pkt3));
+
     /*
      * For each test set up an SSL_CTX and SSL and see what ClientHello gets
      * produced when we try to connect
diff --git a/test/packettest.c b/test/packettest.c
index 81e0449..41d938a 100644
--- a/test/packettest.c
+++ b/test/packettest.c
@@ -350,8 +350,9 @@ static int test_PACKET_get_length_prefixed_1(void)
     unsigned char buf1[BUF_LEN];
     const size_t len = 16;
     unsigned int i;
-    PACKET pkt, short_pkt, subpkt = {0};
+    PACKET pkt, short_pkt, subpkt;
 
+    memset(&subpkt, 0, sizeof(subpkt));
     buf1[0] = (unsigned char)len;
     for (i = 1; i < BUF_LEN; i++)
         buf1[i] = (i * 2) & 0xff;
@@ -374,8 +375,9 @@ static int test_PACKET_get_length_prefixed_2(void)
     unsigned char buf1[1024];
     const size_t len = 516;  /* 0x0204 */
     unsigned int i;
-    PACKET pkt, short_pkt, subpkt = {0};
+    PACKET pkt, short_pkt, subpkt;
 
+    memset(&subpkt, 0, sizeof(subpkt));
     for (i = 1; i <= 1024; i++)
         buf1[i - 1] = (i * 2) & 0xff;
 
@@ -397,8 +399,9 @@ static int test_PACKET_get_length_prefixed_3(void)
     unsigned char buf1[1024];
     const size_t len = 516;  /* 0x000204 */
     unsigned int i;
-    PACKET pkt, short_pkt, subpkt = {0};
+    PACKET pkt, short_pkt, subpkt;
 
+    memset(&subpkt, 0, sizeof(subpkt));
     for (i = 0; i < 1024; i++)
         buf1[i] = (i * 2) & 0xff;
 
@@ -420,8 +423,9 @@ static int test_PACKET_as_length_prefixed_1(void)
     unsigned char buf1[BUF_LEN];
     const size_t len = 16;
     unsigned int i;
-    PACKET pkt, exact_pkt, subpkt = {0};
+    PACKET pkt, exact_pkt, subpkt;
 
+    memset(&subpkt, 0, sizeof(subpkt));
     buf1[0] = (unsigned char)len;
     for (i = 1; i < BUF_LEN; i++)
         buf1[i] = (i * 2) & 0xff;
@@ -443,8 +447,9 @@ static int test_PACKET_as_length_prefixed_2(void)
     unsigned char buf[1024];
     const size_t len = 516;  /* 0x0204 */
     unsigned int i;
-    PACKET pkt, exact_pkt, subpkt = {0};
+    PACKET pkt, exact_pkt, subpkt;
 
+    memset(&subpkt, 0, sizeof(subpkt));
     for (i = 1; i <= 1024; i++)
         buf[i-1] = (i * 2) & 0xff;
 
diff --git a/test/servername_test.c b/test/servername_test.c
index f84c187..86d261f 100644
--- a/test/servername_test.c
+++ b/test/servername_test.c
@@ -35,10 +35,16 @@ static int get_sni_from_client_hello(BIO *bio, char **sni)
 {
     long len;
     unsigned char *data;
-    PACKET pkt = {0}, pkt2 = {0}, pkt3 = {0}, pkt4 = {0}, pkt5 = {0};
+    PACKET pkt, pkt2, pkt3, pkt4, pkt5;
     unsigned int servname_type = 0, type = 0;
     int ret = 0;
 
+    memset(&pkt, 0, sizeof(pkt));
+    memset(&pkt2, 0, sizeof(pkt2));
+    memset(&pkt3, 0, sizeof(pkt3));
+    memset(&pkt4, 0, sizeof(pkt4));
+    memset(&pkt5, 0, sizeof(pkt5));
+
     len = BIO_get_mem_data(bio, (char **)&data);
     if (!TEST_true(PACKET_buf_init(&pkt, data, len))
                /* Skip the record header */
diff --git a/test/sslapitest.c b/test/sslapitest.c
index 2a4596d..bccf055 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -306,9 +306,10 @@ static int test_keylog(void)
     SSL_CTX *cctx = NULL, *sctx = NULL;
     SSL *clientssl = NULL, *serverssl = NULL;
     int testresult = 0;
-    struct sslapitest_log_counts expected = {0};
+    struct sslapitest_log_counts expected;
 
     /* Clean up logging space */
+    memset(&expected, 0, sizeof(expected));
     memset(client_log_buffer, 0, sizeof(client_log_buffer));
     memset(server_log_buffer, 0, sizeof(server_log_buffer));
     client_log_buffer_index = 0;
@@ -387,11 +388,12 @@ static int test_keylog_no_master_key(void)
     SSL *clientssl = NULL, *serverssl = NULL;
     SSL_SESSION *sess = NULL;
     int testresult = 0;
-    struct sslapitest_log_counts expected = {0};
+    struct sslapitest_log_counts expected;
     unsigned char buf[1];
     size_t readbytes, written;
 
     /* Clean up logging space */
+    memset(&expected, 0, sizeof(expected));
     memset(client_log_buffer, 0, sizeof(client_log_buffer));
     memset(server_log_buffer, 0, sizeof(server_log_buffer));
     client_log_buffer_index = 0;
@@ -4593,12 +4595,16 @@ static int get_MFL_from_client_hello(BIO *bio, int *mfl_codemfl_code)
 {
     long len;
     unsigned char *data;
-    PACKET pkt = {0}, pkt2 = {0}, pkt3 = {0};
+    PACKET pkt, pkt2, pkt3;
     unsigned int MFL_code = 0, type = 0;
 
     if (!TEST_uint_gt( len = BIO_get_mem_data( bio, (char **) &data ), 0 ) )
         goto end;
 
+    memset(&pkt, 0, sizeof(pkt));
+    memset(&pkt2, 0, sizeof(pkt2));
+    memset(&pkt3, 0, sizeof(pkt3));
+
     if (!TEST_true( PACKET_buf_init( &pkt, data, len ) )
                /* Skip the record header */
             || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH)


More information about the openssl-commits mailing list