[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Richard Levitte levitte at openssl.org
Wed Jan 31 16:47:13 UTC 2018


The branch OpenSSL_1_1_0-stable has been updated
       via  d4577a1474cd67afbfa5a48729c979180144b9d6 (commit)
       via  cd1caea433d44e63af517a8149eee6ed9f45f681 (commit)
      from  96de98ba34a6c9aa3ccd5d2555cb16ce3e16a7cc (commit)


- Log -----------------------------------------------------------------
commit d4577a1474cd67afbfa5a48729c979180144b9d6
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Jan 31 15:24:24 2018 +0100

    Remove "dummy" BIO create and destroy functions
    
    They aren't needed if all they do is set bio->init = 1 and zero other
    fields that are already zeroed
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5223)
    
    (cherry picked from commit 94f1c9379c3ed4b088718b35d0dd807d619d50c5)

commit cd1caea433d44e63af517a8149eee6ed9f45f681
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Jan 31 11:17:32 2018 +0100

    BIO: at the end of BIO_new, declare the BIO inited if no create method present
    
    Without this, every BIO implementation is forced to have a create
    method, just to set bio->init = 1.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5223)
    
    (cherry picked from commit 7f55808fe723c146428415a470ed42331548007b)

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

Summary of changes:
 crypto/bio/bf_null.c  | 26 ++------------------------
 crypto/bio/bio_lib.c  |  2 ++
 crypto/bio/bss_null.c | 21 ++-------------------
 3 files changed, 6 insertions(+), 43 deletions(-)

diff --git a/crypto/bio/bf_null.c b/crypto/bio/bf_null.c
index c3920bb..8d78c94 100644
--- a/crypto/bio/bf_null.c
+++ b/crypto/bio/bf_null.c
@@ -21,8 +21,6 @@ static int nullf_read(BIO *h, char *buf, int size);
 static int nullf_puts(BIO *h, const char *str);
 static int nullf_gets(BIO *h, char *str, int size);
 static long nullf_ctrl(BIO *h, int cmd, long arg1, void *arg2);
-static int nullf_new(BIO *h);
-static int nullf_free(BIO *data);
 static long nullf_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);
 static const BIO_METHOD methods_nullf = {
     BIO_TYPE_NULL_FILTER,
@@ -32,8 +30,8 @@ static const BIO_METHOD methods_nullf = {
     nullf_puts,
     nullf_gets,
     nullf_ctrl,
-    nullf_new,
-    nullf_free,
+    NULL,
+    NULL,
     nullf_callback_ctrl,
 };
 
@@ -42,26 +40,6 @@ const BIO_METHOD *BIO_f_null(void)
     return (&methods_nullf);
 }
 
-static int nullf_new(BIO *bi)
-{
-    bi->init = 1;
-    bi->ptr = NULL;
-    bi->flags = 0;
-    return (1);
-}
-
-static int nullf_free(BIO *a)
-{
-    if (a == NULL)
-        return (0);
-    /*-
-    a->ptr=NULL;
-    a->init=0;
-    a->flags=0;
-    */
-    return (1);
-}
-
 static int nullf_read(BIO *b, char *out, int outl)
 {
     int ret = 0;
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index 9488839..9210a21 100644
--- a/crypto/bio/bio_lib.c
+++ b/crypto/bio/bio_lib.c
@@ -42,6 +42,8 @@ BIO *BIO_new(const BIO_METHOD *method)
         CRYPTO_THREAD_lock_free(bio->lock);
         goto err;
     }
+    if (method->create == NULL)
+        bio->init = 1;
 
     return bio;
 
diff --git a/crypto/bio/bss_null.c b/crypto/bio/bss_null.c
index 4dfa3f1..f63de74 100644
--- a/crypto/bio/bss_null.c
+++ b/crypto/bio/bss_null.c
@@ -17,8 +17,6 @@ static int null_read(BIO *h, char *buf, int size);
 static int null_puts(BIO *h, const char *str);
 static int null_gets(BIO *h, char *str, int size);
 static long null_ctrl(BIO *h, int cmd, long arg1, void *arg2);
-static int null_new(BIO *h);
-static int null_free(BIO *data);
 static const BIO_METHOD null_method = {
     BIO_TYPE_NULL,
     "NULL",
@@ -27,8 +25,8 @@ static const BIO_METHOD null_method = {
     null_puts,
     null_gets,
     null_ctrl,
-    null_new,
-    null_free,
+    NULL,
+    NULL,
     NULL,                     /* null_callback_ctrl */
 };
 
@@ -37,21 +35,6 @@ const BIO_METHOD *BIO_s_null(void)
     return (&null_method);
 }
 
-static int null_new(BIO *bi)
-{
-    bi->init = 1;
-    bi->num = 0;
-    bi->ptr = (NULL);
-    return (1);
-}
-
-static int null_free(BIO *a)
-{
-    if (a == NULL)
-        return (0);
-    return (1);
-}
-
 static int null_read(BIO *b, char *out, int outl)
 {
     return (0);


More information about the openssl-commits mailing list