mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpg: Let --debug clock time sign and verify.
* configure.ac (ENABLE_LOG_CLOCK): New ac_define and option. * common/logging.c (log_clock): Use ENABLE_LOG_CLOCK to enable timestamp printing. * g10/call-agent.c (agent_pksign): Time signing. * g10/sig-check.c (check_signature_end_simple): Time verification. -- Timing for verification is limited to data signatures because this is the most common thing to evaluate. We should consider to change log_clock to printf style so that we could print the signature class and other info. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
cd2d758f3f
commit
6aa4478c78
@ -1039,11 +1039,11 @@ log_printsexp () {}
|
||||
is found in sexputils.c
|
||||
*/
|
||||
|
||||
|
||||
/* Print a microsecond timestamp followed by STRING. */
|
||||
void
|
||||
log_clock (const char *string)
|
||||
{
|
||||
#if 0
|
||||
#if ENABLE_LOG_CLOCK
|
||||
static unsigned long long initial;
|
||||
struct timespec tv;
|
||||
unsigned long long now;
|
||||
@ -1060,10 +1060,10 @@ log_clock (const char *string)
|
||||
initial = now;
|
||||
|
||||
log_debug ("[%6llu] %s", (now - initial)/1000, string);
|
||||
#else
|
||||
/* You need to link with -ltr to enable the above code. */
|
||||
log_debug ("[not enabled in the source] %s", string);
|
||||
#endif
|
||||
#else /*!ENABLE_LOG_CLOCK*/
|
||||
/* You may need to link with -ltr to use the above code. */
|
||||
log_debug ("[not enabled by configure] %s", string);
|
||||
#endif /*!ENABLE_LOG_CLOCK*/
|
||||
}
|
||||
|
||||
|
||||
|
15
configure.ac
15
configure.ac
@ -1679,6 +1679,21 @@ AC_ARG_ENABLE(optimization,
|
||||
CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
|
||||
fi])
|
||||
|
||||
#
|
||||
# log_debug has certain requirements which might hamper portability.
|
||||
# Thus we use an option to enable it.
|
||||
#
|
||||
AC_MSG_CHECKING([whether to enable log_clock])
|
||||
AC_ARG_ENABLE(log_clock,
|
||||
AC_HELP_STRING([--enable-log-clock],
|
||||
[enable log_clock timestamps]),
|
||||
enable_log_clock=$enableval, enable_log_clock=no)
|
||||
AC_MSG_RESULT($enable_log_clock)
|
||||
if test "$enable_log_clock" = yes ; then
|
||||
AC_DEFINE(ENABLE_LOG_CLOCK,1,[Defined to use log_clock timestamps])
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Configure option --enable-all-tests
|
||||
#
|
||||
|
@ -1854,10 +1854,16 @@ agent_pksign (ctrl_t ctrl, const char *cache_nonce,
|
||||
snprintf (line, sizeof line, "PKSIGN%s%s",
|
||||
cache_nonce? " -- ":"",
|
||||
cache_nonce? cache_nonce:"");
|
||||
|
||||
if (DBG_CLOCK)
|
||||
log_clock ("enter signing");
|
||||
err = assuan_transact (agent_ctx, line,
|
||||
put_membuf_cb, &data,
|
||||
default_inq_cb, &dfltparm,
|
||||
NULL, NULL);
|
||||
if (DBG_CLOCK)
|
||||
log_clock ("leave signing");
|
||||
|
||||
if (err)
|
||||
xfree (get_membuf (&data, NULL));
|
||||
else
|
||||
|
@ -510,7 +510,11 @@ check_signature_end_simple (PKT_public_key *pk, PKT_signature *sig,
|
||||
return GPG_ERR_GENERAL;
|
||||
|
||||
/* Verify the signature. */
|
||||
if (DBG_CLOCK && sig->sig_class <= 0x01)
|
||||
log_clock ("enter pk_verify");
|
||||
rc = pk_verify( pk->pubkey_algo, result, sig->data, pk->pkey );
|
||||
if (DBG_CLOCK && sig->sig_class <= 0x01)
|
||||
log_clock ("leave pk_verify");
|
||||
gcry_mpi_release (result);
|
||||
|
||||
if( !rc && sig->flags.unknown_critical )
|
||||
|
Loading…
x
Reference in New Issue
Block a user