[openssl] master update

dev at ddvo.net dev at ddvo.net
Fri May 15 18:24:37 UTC 2020


The branch master has been updated
       via  538404d2186954d58c04c46232f985ddf9675b6f (commit)
       via  8c10e1b660be1286439e15c9a955461f25b53616 (commit)
      from  6d382c74b375f1f8c44f04ec3de95ff781598a3b (commit)


- Log -----------------------------------------------------------------
commit 538404d2186954d58c04c46232f985ddf9675b6f
Author: David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Mon Aug 28 19:14:47 2017 +0200

    Add 'methods' parameter to setup_engine() in apps.c for individual method defaults
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: David von Oheimb <david.von.oheimb at siemens.com>
    (Merged from https://github.com/openssl/openssl/pull/4277)

commit 8c10e1b660be1286439e15c9a955461f25b53616
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Tue Apr 21 14:08:49 2020 +0200

    Clean up macro definitions of openssl_fdset() in apps.h and sockets.h
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: David von Oheimb <david.von.oheimb at siemens.com>
    (Merged from https://github.com/openssl/openssl/pull/4277)

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

Summary of changes:
 apps/cmp.c                 |  9 +--------
 apps/include/apps.h        | 17 ++++++-----------
 apps/lib/apps.c            | 23 +++++++++++------------
 apps/s_server.c            |  4 +++-
 include/internal/sockets.h |  4 ++--
 5 files changed, 23 insertions(+), 34 deletions(-)

diff --git a/apps/cmp.c b/apps/cmp.c
index 7a2ce2963d..72ebe34d26 100644
--- a/apps/cmp.c
+++ b/apps/cmp.c
@@ -61,13 +61,6 @@ static int read_config(void);
 static CONF *conf = NULL; /* OpenSSL config file context structure */
 static OSSL_CMP_CTX *cmp_ctx = NULL; /* the client-side CMP context */
 
-/* TODO remove when new setup_engine_flags() is in apps/lib/apps.c (PR #4277) */
-static
-ENGINE *setup_engine_flags(const char *engine, unsigned int flags, int debug)
-{
-    return setup_engine(engine, debug);
-}
-
 /* the type of cmp command we want to send */
 typedef enum {
     CMP_IR,
@@ -2938,7 +2931,7 @@ int cmp_main(int argc, char **argv)
     }
 
     if (opt_engine != NULL)
-        e = setup_engine_flags(opt_engine, 0 /* not: ENGINE_METHOD_ALL */, 0);
+        e = setup_engine_methods(opt_engine, 0 /* not: ENGINE_METHOD_ALL */, 0);
 
     if (opt_port != NULL) {
         if (opt_use_mock_srv) {
diff --git a/apps/include/apps.h b/apps/include/apps.h
index 7789bd2b0a..b051222244 100644
--- a/apps/include/apps.h
+++ b/apps/include/apps.h
@@ -12,6 +12,7 @@
 
 # include "e_os.h" /* struct timeval for DTLS */
 # include "internal/nelem.h"
+# include "internal/sockets.h" /* for openssl_fdset() */
 # include <assert.h>
 
 # include <sys/types.h>
@@ -35,19 +36,12 @@
 # include "fmt.h"
 # include "platform.h"
 
-/* also in include/internal/sockets.h */
-# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)
-#  define openssl_fdset(a,b) FD_SET((unsigned int)a, b)
-# else
-#  define openssl_fdset(a,b) FD_SET(a, b)
-# endif
-
 /*
  * quick macro when you need to pass an unsigned char instead of a char.
  * this is true for some implementations of the is*() functions, for
  * example.
  */
-#define _UC(c) ((unsigned char)(c))
+# define _UC(c) ((unsigned char)(c))
 
 void app_RAND_load_conf(CONF *c, const char *section);
 void app_RAND_write(void);
@@ -132,7 +126,7 @@ __owur int ctx_set_verify_locations(SSL_CTX *ctx,
                                     const char *CApath, int noCApath,
                                     const char *CAstore, int noCAstore);
 
-#ifndef OPENSSL_NO_CT
+# ifndef OPENSSL_NO_CT
 
 /*
  * Sets the file to load the Certificate Transparency log list from.
@@ -141,9 +135,10 @@ __owur int ctx_set_verify_locations(SSL_CTX *ctx,
  */
 __owur int ctx_set_ctlog_list_file(SSL_CTX *ctx, const char *path);
 
-#endif
+# endif
 
-ENGINE *setup_engine(const char *engine, int debug);
+ENGINE *setup_engine_methods(const char *id, unsigned int methods, int debug);
+# define setup_engine(e, debug) setup_engine_methods(e, (unsigned int)-1, debug)
 void release_engine(ENGINE *e);
 
 # ifndef OPENSSL_NO_OCSP
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index 8063a0e272..4337cc6c87 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -1115,29 +1115,28 @@ static ENGINE *try_load_engine(const char *engine)
 }
 #endif
 
-ENGINE *setup_engine(const char *engine, int debug)
+ENGINE *setup_engine_methods(const char *id, unsigned int methods, int debug)
 {
     ENGINE *e = NULL;
 
 #ifndef OPENSSL_NO_ENGINE
-    if (engine != NULL) {
-        if (strcmp(engine, "auto") == 0) {
+    if (id != NULL) {
+        if (strcmp(id, "auto") == 0) {
             BIO_printf(bio_err, "Enabling auto ENGINE support\n");
             ENGINE_register_all_complete();
             return NULL;
         }
-        if ((e = ENGINE_by_id(engine)) == NULL
-            && (e = try_load_engine(engine)) == NULL) {
-            BIO_printf(bio_err, "Invalid engine \"%s\"\n", engine);
+        if ((e = ENGINE_by_id(id)) == NULL
+            && (e = try_load_engine(id)) == NULL) {
+            BIO_printf(bio_err, "Invalid engine \"%s\"\n", id);
             ERR_print_errors(bio_err);
             return NULL;
         }
-        if (debug) {
-            ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM, 0, bio_err, 0);
-        }
-        ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, (void *)get_ui_method(),
-                        0, 1);
-        if (!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
+        if (debug)
+            (void)ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM, 0, bio_err, 0);
+        if (!ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0,
+                             (void *)get_ui_method(), 0, 1)
+                || !ENGINE_set_default(e, methods)) {
             BIO_printf(bio_err, "Cannot use engine \"%s\"\n", ENGINE_get_id(e));
             ERR_print_errors(bio_err);
             ENGINE_free(e);
diff --git a/apps/s_server.c b/apps/s_server.c
index bbc311befd..09bcc0cfb8 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -1576,7 +1576,9 @@ int s_server_main(int argc, char *argv[])
             session_id_prefix = opt_arg();
             break;
         case OPT_ENGINE:
-            engine = setup_engine(opt_arg(), 1);
+#ifndef OPENSSL_NO_ENGINE
+            engine = setup_engine(opt_arg(), s_debug);
+#endif
             break;
         case OPT_R_CASES:
             if (!opt_rand(o))
diff --git a/include/internal/sockets.h b/include/internal/sockets.h
index e7708516d8..6d17363d9b 100644
--- a/include/internal/sockets.h
+++ b/include/internal/sockets.h
@@ -154,9 +154,9 @@ struct servent *PASCAL getservbyname(const char *, const char *);
 
 /* also in apps/include/apps.h */
 # if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)
-#  define openssl_fdset(a,b) FD_SET((unsigned int)a, b)
+#  define openssl_fdset(a, b) FD_SET((unsigned int)(a), b)
 # else
-#  define openssl_fdset(a,b) FD_SET(a, b)
+#  define openssl_fdset(a, b) FD_SET(a, b)
 # endif
 
 #endif


More information about the openssl-commits mailing list