[openssl-commits] [openssl] OpenSSL_1_0_2-stable update

Rich Salz rsalz at openssl.org
Thu Mar 9 14:55:25 UTC 2017


The branch OpenSSL_1_0_2-stable has been updated
       via  2566388c840a2cd2c242e9cf5793228f3bcd270b (commit)
      from  08330a1241379945d3d93c7205d0489f8ba2064c (commit)


- Log -----------------------------------------------------------------
commit 2566388c840a2cd2c242e9cf5793228f3bcd270b
Author: Pauli <paul.dale at oracle.com>
Date:   Thu Mar 9 09:42:25 2017 +1000

    Make the output of enc -ciphers identical
    
    even if run several times in a session.
    
    This amounts to moving the column counter so it isn't a function local
    static variable and reinitialising it each time.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/2884)
    (cherry picked from commit 2b305ab02e0977ed71c255cc386ff75c397d7820)

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

Summary of changes:
 apps/enc.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/apps/enc.c b/apps/enc.c
index 032db3d..66145b3 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -81,10 +81,14 @@ int set_hex(char *in, unsigned char *out, int size);
 #define BSIZE   (8*1024)
 #define PROG    enc_main
 
-static void show_ciphers(const OBJ_NAME *name, void *bio_)
+struct doall_enc_ciphers {
+    BIO *bio;
+    int n;
+};
+
+static void show_ciphers(const OBJ_NAME *name, void *arg)
 {
-    BIO *bio = bio_;
-    static int n;
+    struct doall_enc_ciphers *dec = (struct doall_enc_ciphers *)arg;
     const EVP_CIPHER *cipher;
 
     if (!islower((unsigned char)*name->name))
@@ -97,12 +101,12 @@ static void show_ciphers(const OBJ_NAME *name, void *bio_)
             EVP_CIPHER_mode(cipher) == EVP_CIPH_XTS_MODE)
         return;
 
-    BIO_printf(bio, "-%-25s", name->name);
-    if (++n == 3) {
-        BIO_printf(bio, "\n");
-        n = 0;
+    BIO_printf(dec->bio, "-%-25s", name->name);
+    if (++dec->n == 3) {
+        BIO_printf(dec->bio, "\n");
+        dec->n = 0;
     } else
-        BIO_printf(bio, " ");
+        BIO_printf(dec->bio, " ");
 }
 
 int MAIN(int, char **);
@@ -138,6 +142,7 @@ int MAIN(int argc, char **argv)
     ENGINE *e = NULL;
     const EVP_MD *dgst = NULL;
     int non_fips_allow = 0;
+    struct doall_enc_ciphers dec;
 
     apps_startup();
 
@@ -319,8 +324,10 @@ int MAIN(int argc, char **argv)
 #endif
 
             BIO_printf(bio_err, "Cipher Types\n");
+            dec.n = 0;
+            dec.bio = bio_err;
             OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH,
-                                   show_ciphers, bio_err);
+                                   show_ciphers, &dec);
             BIO_printf(bio_err, "\n");
 
             goto end;


More information about the openssl-commits mailing list