diff --git a/sm/encrypt.c b/sm/encrypt.c index f90a4449b..331bfa8ba 100644 --- a/sm/encrypt.c +++ b/sm/encrypt.c @@ -564,7 +564,8 @@ gpgsm_encrypt (ctrl_t ctrl, certlist_t recplist, int data_fd, estream_t out_fp) goto leave; } audit_log (ctrl->audit, AUDIT_ENCRYPTION_DONE); - log_info ("encrypted data created\n"); + if (!opt.quiet) + log_info ("encrypted data created\n"); leave: ksba_cms_release (cms); diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 55a92c629..0baf8de38 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -45,6 +45,7 @@ #include "../common/asshelp.h" #include "../common/init.h" #include "../common/compliance.h" +#include "minip12.h" #ifndef O_BINARY @@ -731,6 +732,10 @@ set_debug (void) if (opt.debug) parse_debug_flag (NULL, &opt.debug, debug_flags); + + /* minip12.c may be used outside of GnuPG, thus we don't have the + * opt structure over there. */ + p12_set_verbosity (opt.verbose); } diff --git a/sm/import.c b/sm/import.c index ca693824a..7ee1d7164 100644 --- a/sm/import.c +++ b/sm/import.c @@ -836,7 +836,8 @@ parse_p12 (ctrl_t ctrl, ksba_reader_t reader, struct stats_s *stats) log_error ("can't calculate keygrip\n"); goto leave; } - log_printhex (grip, 20, "keygrip="); + if (DBG_X509) + log_printhex (grip, 20, "keygrip="); /* Convert to canonical encoding using a function which pads it to a multiple of 64 bits. We need this padding for AESWRAP. */ diff --git a/sm/minip12.c b/sm/minip12.c index 7087e444c..e1e1bce08 100644 --- a/sm/minip12.c +++ b/sm/minip12.c @@ -176,6 +176,16 @@ struct tag_info }; +static int opt_verbose; + + +void +p12_set_verbosity (int verbose) +{ + opt_verbose = verbose; +} + + /* Parse the buffer at the address BUFFER which is of SIZE and return the tag and the length part from the TLV triplet. Update BUFFER and SIZE on success. Checks that the encoded length does not @@ -869,8 +879,9 @@ parse_bag_encrypted_data (const unsigned char *buffer, size_t length, else goto bailout; - log_info ("%lu bytes of %s encrypted text\n",ti.length, - is_pbes2?"AES128":is_3des?"3DES":"RC2"); + if (opt_verbose) + log_info ("%lu bytes of %s encrypted text\n",ti.length, + is_pbes2?"AES128":is_3des?"3DES":"RC2"); plain = gcry_malloc_secure (ti.length); if (!plain) @@ -967,7 +978,8 @@ parse_bag_encrypted_data (const unsigned char *buffer, size_t length, { int len; - log_info ("processing simple keyBag\n"); + if (opt_verbose) + log_info ("processing simple keyBag\n"); /* Fixme: This code is duplicated from parse_bag_data. */ if (parse_tag (&p, &n, &ti) || ti.class || ti.tag != TAG_SEQUENCE) @@ -1050,7 +1062,8 @@ parse_bag_encrypted_data (const unsigned char *buffer, size_t length, } else { - log_info ("processing certBag\n"); + if (opt_verbose) + log_info ("processing certBag\n"); if (parse_tag (&p, &n, &ti)) goto bailout; if (ti.class || ti.tag != TAG_SEQUENCE) diff --git a/sm/minip12.h b/sm/minip12.h index 39a81939d..343b733a6 100644 --- a/sm/minip12.h +++ b/sm/minip12.h @@ -22,6 +22,8 @@ #include +void p12_set_verbosity (int verbose); + gcry_mpi_t *p12_parse (const unsigned char *buffer, size_t length, const char *pw, void (*certcb)(void*, const unsigned char*, size_t),