[openssl] master update

Dr. Paul Dale pauli at openssl.org
Wed Feb 26 05:32:00 UTC 2020


The branch master has been updated
       via  d27fd991107d668b3f5b96be48f5b4ccd5a6760e (commit)
      from  2c702ef27dd632de08d56456f7f6af11e3e05b5f (commit)


- Log -----------------------------------------------------------------
commit d27fd991107d668b3f5b96be48f5b4ccd5a6760e
Author: Davide Galassi <davxy at datawok.net>
Date:   Wed Feb 26 15:31:17 2020 +1000

    Mem-sec small code adjustment
    
    Conditional code readability improvement.
    
    Remove unused macro
    
    Commit #11042 has introduced a new, unused, CRYPTO_EX_INDEX macro.
    Remove before version release.
    
    Reviewed-by: Paul Yang <kaishen.yy at antfin.com>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/11103)

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

Summary of changes:
 crypto/mem_sec.c         | 18 ++++++++----------
 include/openssl/crypto.h |  3 +--
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/crypto/mem_sec.c b/crypto/mem_sec.c
index 00546166dd..79362c5826 100644
--- a/crypto/mem_sec.c
+++ b/crypto/mem_sec.c
@@ -227,9 +227,6 @@ size_t CRYPTO_secure_actual_size(void *ptr)
     return 0;
 #endif
 }
-/* END OF PAGE ...
-
-   ... START OF PAGE */
 
 /*
  * SECURE HEAP IMPLEMENTATION
@@ -385,12 +382,12 @@ static int sh_init(size_t size, size_t minsize)
     OPENSSL_assert(size > 0);
     OPENSSL_assert((size & (size - 1)) == 0);
     OPENSSL_assert((minsize & (minsize - 1)) == 0);
-    if (size <= 0 || (size & (size - 1)) != 0)
+    if (size == 0 || (size & (size - 1)) != 0)
         goto err;
     if (minsize == 0 || (minsize & (minsize - 1)) != 0)
         goto err;
 
-    while (minsize < (int)sizeof(SH_LIST))
+    while (minsize < sizeof(SH_LIST))
         minsize *= 2;
 
     sh.arena_size = size;
@@ -437,12 +434,12 @@ static int sh_init(size_t size, size_t minsize)
     pgsize = PAGE_SIZE;
 #endif
     sh.map_size = pgsize + sh.arena_size + pgsize;
-    if (1) {
+
 #ifdef MAP_ANON
-        sh.map_result = mmap(NULL, sh.map_size,
-                             PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
-    } else {
-#endif
+    sh.map_result = mmap(NULL, sh.map_size,
+                         PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
+#else
+    {
         int fd;
 
         sh.map_result = MAP_FAILED;
@@ -452,6 +449,7 @@ static int sh_init(size_t size, size_t minsize)
             close(fd);
         }
     }
+#endif
     if (sh.map_result == MAP_FAILED)
         goto err;
     sh.arena = (char *)(sh.map_result + pgsize);
diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h
index 0cbed9e78e..a157558a51 100644
--- a/include/openssl/crypto.h
+++ b/include/openssl/crypto.h
@@ -192,8 +192,7 @@ DEFINE_STACK_OF(void)
 # define CRYPTO_EX_INDEX_RAND_DRBG       15
 # define CRYPTO_EX_INDEX_DRBG            CRYPTO_EX_INDEX_RAND_DRBG
 # define CRYPTO_EX_INDEX_OPENSSL_CTX     16
-# define CRYPTO_EX_INDEX_COUNT           17
-# define CRYPTO_EX_INDEX__COUNT          CRYPTO_EX_INDEX_COUNT
+# define CRYPTO_EX_INDEX__COUNT          17
 
 typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
                            int idx, long argl, void *argp);


More information about the openssl-commits mailing list