From e35ed615acc624a8b6c07576ea0650aac2bdb0db Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sat, 7 Sep 2013 10:06:46 +0200 Subject: Streamline the use of the internal mpi and hex debug functions. * mpi/mpicoder.c (gcry_mpi_dump): Remove. (_gcry_log_mpidump): Remove. * src/misc.c (_gcry_log_printhex): Factor all code out to ... (do_printhex): new. Add line wrapping a and compact printing. (_gcry_log_printmpi): New. * src/mpi.h (log_mpidump): Remove macro. * src/g10lib.h (log_mpidump): Add compatibility macro. (log_printmpi): New macro * src/visibility.c (gcry_mpi_dump): Call _gcry_log_printmpi. * cipher/primegen.c (prime_generate_internal): Replace gcry_mpi_dump by log_printmpi. (gcry_prime_group_generator): Ditto. * cipher/pubkey.c: Remove extra colons from log_mpidump call. * cipher/rsa.c (stronger_key_check): Use log_printmpi. -- The values to debug get longer and longer and the different debug functions made it hard to check them out. Now MPIs and hex buffers are printed very similar. Lines may now wrap with an backslash as indicator. MPIs are distinguished from plain buffers in the output by always using a sign. Signed-off-by: Werner Koch --- cipher/rsa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cipher/rsa.c') diff --git a/cipher/rsa.c b/cipher/rsa.c index 8d17129c..e7c880da 100644 --- a/cipher/rsa.c +++ b/cipher/rsa.c @@ -662,7 +662,7 @@ stronger_key_check ( RSA_secret_key *skey ) { log_info ( "RSA Oops: d is wrong - fixed\n"); mpi_set (skey->d, t); - _gcry_log_mpidump (" fixed d", skey->d); + log_printmpi (" fixed d", skey->d); } /* check for correctness of u */ @@ -671,7 +671,7 @@ stronger_key_check ( RSA_secret_key *skey ) { log_info ( "RSA Oops: u is wrong - fixed\n"); mpi_set (skey->u, t); - _gcry_log_mpidump (" fixed u", skey->u); + log_printmpi (" fixed u", skey->u); } log_info ( "RSA secret key check finished\n"); @@ -1043,8 +1043,8 @@ rsa_verify (int algo, gcry_mpi_t hash, gcry_mpi_t *data, gcry_mpi_t *pkey, #ifdef IS_DEVELOPMENT_VERSION if (DBG_CIPHER) { - log_mpidump ("rsa verify result:", result ); - log_mpidump (" hash:", hash ); + log_mpidump ("rsa verify result", result ); + log_mpidump (" hash", hash ); } #endif /*IS_DEVELOPMENT_VERSION*/ if (cmp) -- cgit v1.2.1