APPS: Fix result type of dump_cert_text() and behavior of print_name() on out==NULL
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Tue, 17 Aug 2021 17:57:08 +0000 (19:57 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Wed, 25 Aug 2021 05:07:21 +0000 (07:07 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16344)

apps/include/apps.h
apps/lib/apps.c

index bc8c6359f32d1d96ffc7a9e66dc213c87fd3b210..9d5db16600ec4b67c88539d106c5f1357d1f0792 100644 (file)
@@ -94,7 +94,7 @@ typedef struct args_st {
 int wrap_password_callback(char *buf, int bufsiz, int verify, void *cb_data);
 
 int chopup_args(ARGS *arg, char *buf);
-int dump_cert_text(BIO *out, X509 *x);
+void dump_cert_text(BIO *out, X509 *x);
 void print_name(BIO *out, const char *title, const X509_NAME *nm);
 void print_bignum_var(BIO *, const BIGNUM *, const char*,
                       int, unsigned char *);
index 9762001b6a7db329a57c5245cdb7d13859c345e0..43c01401e8d75763a3197c98dae328b99b8b24f8 100644 (file)
@@ -200,14 +200,10 @@ unsigned long get_nameopt(void)
     return (nmflag_set) ? nmflag : XN_FLAG_ONELINE;
 }
 
-int dump_cert_text(BIO *out, X509 *x)
+void dump_cert_text(BIO *out, X509 *x)
 {
     print_name(out, "subject=", X509_get_subject_name(x));
-    BIO_puts(out, "\n");
     print_name(out, "issuer=", X509_get_issuer_name(x));
-    BIO_puts(out, "\n");
-
-    return 0;
 }
 
 int wrap_password_callback(char *buf, int bufsiz, int verify, void *userdata)
@@ -1289,6 +1285,8 @@ void print_name(BIO *out, const char *title, const X509_NAME *nm)
     int indent = 0;
     unsigned long lflags = get_nameopt();
 
+    if (out == NULL)
+        return;
     if (title != NULL)
         BIO_puts(out, title);
     if ((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {