[openssl] master update

dev at ddvo.net dev at ddvo.net
Thu Sep 10 05:13:15 UTC 2020


The branch master has been updated
       via  a877d2629b8a512aae550be68b9afd91eae22f19 (commit)
       via  87495d56a959b0c3a3f6d8305d84d1b21e9222a6 (commit)
      from  aad086e2ae5f8d1b3b0934b1e67f7a426352727d (commit)


- Log -----------------------------------------------------------------
commit a877d2629b8a512aae550be68b9afd91eae22f19
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Sep 3 16:51:06 2020 +0200

    apps/cmp.c: clear leftover errors on loading libengines.so etc.
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/12824)

commit 87495d56a959b0c3a3f6d8305d84d1b21e9222a6
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Fri Aug 28 11:57:18 2020 +0200

    apps.c: Fix diagnostics and return value of load_key_certs_crls() on error
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/12824)

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

Summary of changes:
 apps/cmp.c      |  1 +
 apps/lib/apps.c | 29 ++++++++++++++++-------------
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/apps/cmp.c b/apps/cmp.c
index 7524930b8f..3e7b010fcb 100644
--- a/apps/cmp.c
+++ b/apps/cmp.c
@@ -2620,6 +2620,7 @@ int cmp_main(int argc, char **argv)
     char mock_server[] = "mock server:1";
     int ret = 0; /* default: failure */
 
+    ERR_clear_error(); /* clear leftover errors on loading libengines.so etc. */
     if (argc <= 1) {
         opt_help(cmp_options);
         goto err;
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index 342c364aa4..b631a2670a 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -702,7 +702,7 @@ int load_key_certs_crls(const char *uri, int maybe_stdin,
     const char *propq = app_get0_propq();
     int ncerts = 0;
     int ncrls = 0;
-    const char *failed = NULL;
+    const char *failed = "any";
     /* TODO make use of the engine reference 'eng' when loading pkeys */
 
     if (ppkey != NULL)
@@ -714,14 +714,14 @@ int load_key_certs_crls(const char *uri, int maybe_stdin,
     if (pcerts != NULL && *pcerts == NULL
             && (*pcerts = sk_X509_new_null()) == NULL) {
         BIO_printf(bio_err, "Out of memory");
-        return 0;
+        goto end;
     }
     if (pcrl != NULL)
         *pcrl = NULL;
     if (pcrls != NULL && *pcrls == NULL
             && (*pcrls = sk_X509_CRL_new_null()) == NULL) {
         BIO_printf(bio_err, "Out of memory");
-        return 0;
+        goto end;
     }
 
     if (desc == NULL)
@@ -753,6 +753,7 @@ int load_key_certs_crls(const char *uri, int maybe_stdin,
         goto end;
     }
 
+    failed = NULL;
     while (!OSSL_STORE_eof(ctx)) {
         OSSL_STORE_INFO *info = OSSL_STORE_load(ctx);
         int type = info == NULL ? 0 : OSSL_STORE_INFO_get_type(info);
@@ -806,17 +807,19 @@ int load_key_certs_crls(const char *uri, int maybe_stdin,
 
  end:
     OSSL_STORE_close(ctx);
-    if (ppkey != NULL && *ppkey == NULL)
-        failed = "key";
-    else if ((pcert != NULL || pcerts != NULL) && ncerts == 0)
-        failed = "cert";
-    else if ((pcrl != NULL || pcrls != NULL) && ncrls == 0)
-        failed = "CRL";
-    if (failed != NULL) {
-        BIO_printf(bio_err, "Could not read any %s of %s from %s\n",
-                   failed, desc, uri);
-        ERR_print_errors(bio_err);
+    if (failed == NULL) {
+        if (ppkey != NULL && *ppkey == NULL)
+            failed = "key";
+        else if ((pcert != NULL || pcerts != NULL) && ncerts == 0)
+            failed = "cert";
+        else if ((pcrl != NULL || pcrls != NULL) && ncrls == 0)
+            failed = "CRL";
+        if (failed != NULL)
+            BIO_printf(bio_err, "Could not read any %s of %s from %s\n",
+                       failed, desc, uri);
     }
+    if (failed != NULL)
+        ERR_print_errors(bio_err);
     return failed == NULL;
 }
 


More information about the openssl-commits mailing list