mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Rename a debug macro.
* g10/options.h (DBG_CIPHER_VALUE): Rename to DBG_CRYPTO_VALUE. (DBG_CIPHER): Rename to DBG_CRYPTO.
This commit is contained in:
parent
d901efceba
commit
4de8a58e44
24
g10/ecdh.c
24
g10/ecdh.c
@ -76,7 +76,7 @@ pk_ecdh_default_params (unsigned int qbits)
|
||||
}
|
||||
}
|
||||
assert (i < DIM (kek_params_table));
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("ECDH KEK params are", kek_params, sizeof(kek_params) );
|
||||
|
||||
return gcry_mpi_set_opaque (NULL, kek_params, 4 * 8);
|
||||
@ -138,7 +138,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||
memmove (secret_x, secret_x+1, secret_x_size);
|
||||
memset (secret_x+secret_x_size, 0, nbytes-secret_x_size);
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("ECDH shared secret X is:", secret_x, secret_x_size );
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||
kek_params = gcry_mpi_get_opaque (pkey[2], &nbits);
|
||||
kek_params_size = (nbits+7)/8;
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("ecdh KDF params:", kek_params, kek_params_size);
|
||||
|
||||
/* Expect 4 bytes 03 01 hash_alg symm_alg. */
|
||||
@ -171,7 +171,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||
kdf_hash_algo = kek_params[2];
|
||||
kdf_encr_algo = kek_params[3];
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_debug ("ecdh KDF algorithms %s+%s with aeswrap\n",
|
||||
openpgp_md_algo_name (kdf_hash_algo),
|
||||
openpgp_cipher_algo_name (kdf_encr_algo));
|
||||
@ -215,7 +215,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||
return err;
|
||||
}
|
||||
|
||||
if(DBG_CIPHER)
|
||||
if(DBG_CRYPTO)
|
||||
log_printhex ("ecdh KDF message params are:", message, message_size);
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||
|
||||
/* We could have allocated more, so clean the tail before returning. */
|
||||
memset (secret_x+secret_x_size, 0, old_size - secret_x_size);
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("ecdh KEK is:", secret_x, secret_x_size );
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||
return err;
|
||||
}
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("ecdh encrypting :", in, data_buf_size );
|
||||
|
||||
err = gcry_cipher_encrypt (hd, data_buf+1, data_buf_size+8,
|
||||
@ -333,7 +333,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||
}
|
||||
data_buf[0] = data_buf_size+8;
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("ecdh encrypted to:", data_buf+1, data_buf[0] );
|
||||
|
||||
result = gcry_mpi_set_opaque (NULL, data_buf, 8 * (1+data_buf[0]));
|
||||
@ -370,7 +370,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||
in = data_buf+data_buf_size;
|
||||
data_buf_size = data_buf[0];
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("ecdh decrypting :", data_buf+1, data_buf_size);
|
||||
|
||||
err = gcry_cipher_decrypt (hd, in, data_buf_size, data_buf+1,
|
||||
@ -386,7 +386,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||
|
||||
data_buf_size -= 8;
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("ecdh decrypted to :", in, data_buf_size);
|
||||
|
||||
/* Padding is removed later. */
|
||||
@ -420,12 +420,12 @@ gen_k (unsigned nbits)
|
||||
gcry_mpi_t k;
|
||||
|
||||
k = gcry_mpi_snew (nbits);
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_debug ("choosing a random k of %u bits\n", nbits);
|
||||
|
||||
gcry_mpi_randomize (k, nbits-1, GCRY_STRONG_RANDOM);
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
{
|
||||
unsigned char *buffer;
|
||||
if (gcry_mpi_aprint (GCRYMPI_FMT_HEX, &buffer, NULL, k))
|
||||
|
@ -621,7 +621,7 @@ encrypt_crypt (ctrl_t ctrl, int filefd, const char *filename,
|
||||
}
|
||||
|
||||
make_session_key (cfx.dek);
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("DEK is: ", cfx.dek->key, cfx.dek->keylen );
|
||||
|
||||
rc = write_pubkey_enc_from_list (pk_list, cfx.dek, out);
|
||||
@ -815,7 +815,7 @@ encrypt_filter (void *opaque, int control,
|
||||
efx->cfx.dek->use_mdc = use_mdc (efx->pk_list,efx->cfx.dek->algo);
|
||||
|
||||
make_session_key ( efx->cfx.dek );
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("DEK is: ", efx->cfx.dek->key, efx->cfx.dek->keylen);
|
||||
|
||||
rc = write_pubkey_enc_from_list (efx->pk_list, efx->cfx.dek, a);
|
||||
|
@ -1116,7 +1116,7 @@ set_debug (const char *level)
|
||||
memory_stat_debug_mode = 1;
|
||||
if (opt.debug & DBG_MPI_VALUE)
|
||||
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 2);
|
||||
if (opt.debug & DBG_CIPHER_VALUE )
|
||||
if (opt.debug & DBG_CRYPTO_VALUE )
|
||||
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1);
|
||||
if (opt.debug & DBG_IOBUF_VALUE )
|
||||
iobuf_debug_mode = 1;
|
||||
@ -1126,7 +1126,7 @@ set_debug (const char *level)
|
||||
log_info ("enabled debug flags:%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
(opt.debug & DBG_PACKET_VALUE )? " packet":"",
|
||||
(opt.debug & DBG_MPI_VALUE )? " mpi":"",
|
||||
(opt.debug & DBG_CIPHER_VALUE )? " cipher":"",
|
||||
(opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
|
||||
(opt.debug & DBG_FILTER_VALUE )? " filter":"",
|
||||
(opt.debug & DBG_IOBUF_VALUE )? " iobuf":"",
|
||||
(opt.debug & DBG_MEMORY_VALUE )? " memory":"",
|
||||
|
@ -268,7 +268,7 @@ struct {
|
||||
|
||||
#define DBG_PACKET_VALUE 1 /* debug packet reading/writing */
|
||||
#define DBG_MPI_VALUE 2 /* debug mpi details */
|
||||
#define DBG_CIPHER_VALUE 4 /* debug cipher handling */
|
||||
#define DBG_CRYPTO_VALUE 4 /* debug crypto handling */
|
||||
/* (may reveal sensitive data) */
|
||||
#define DBG_FILTER_VALUE 8 /* debug internal filter handling */
|
||||
#define DBG_IOBUF_VALUE 16 /* debug iobuf stuff */
|
||||
@ -287,7 +287,7 @@ struct {
|
||||
|
||||
/* Tests for the debugging flags. */
|
||||
#define DBG_PACKET (opt.debug & DBG_PACKET_VALUE)
|
||||
#define DBG_CIPHER (opt.debug & DBG_CIPHER_VALUE)
|
||||
#define DBG_CRYPTO (opt.debug & DBG_CRYPTO_VALUE)
|
||||
#define DBG_FILTER (opt.debug & DBG_FILTER_VALUE)
|
||||
#define DBG_CACHE (opt.debug & DBG_CACHE_VALUE)
|
||||
#define DBG_TRUST (opt.debug & DBG_TRUST_VALUE)
|
||||
|
@ -263,7 +263,7 @@ pk_encrypt (pubkey_algo_t algo, gcry_mpi_t *resarr, gcry_mpi_t data,
|
||||
public = get_mpi_from_sexp (s_ciph, "e", GCRYMPI_FMT_USG);
|
||||
gcry_sexp_release (s_ciph);
|
||||
s_ciph = NULL;
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
{
|
||||
log_debug ("ECDH ephemeral key:");
|
||||
gcry_mpi_dump (public);
|
||||
|
@ -227,7 +227,7 @@ get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
|
||||
* DEK is the encryption key (session key) with length k
|
||||
* CSUM
|
||||
*/
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("DEK frame:", frame, nframe);
|
||||
n = 0;
|
||||
|
||||
@ -333,7 +333,7 @@ get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
|
||||
}
|
||||
if (DBG_CLOCK)
|
||||
log_clock ("decryption ready");
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_printhex ("DEK is:", dek->key, dek->keylen);
|
||||
|
||||
/* Check that the algo is in the preferences and whether it has expired. */
|
||||
|
@ -82,7 +82,7 @@ encode_session_key (int openpgp_pk_algo, DEK *dek, unsigned int nbits)
|
||||
u16 csum;
|
||||
gcry_mpi_t a;
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_debug ("encode_session_key: encoding %d byte DEK", dek->keylen);
|
||||
|
||||
csum = 0;
|
||||
@ -116,7 +116,7 @@ encode_session_key (int openpgp_pk_algo, DEK *dek, unsigned int nbits)
|
||||
memset (frame+n, i, i); /* Use it as the value of each padded byte. */
|
||||
assert (n+i == nframe);
|
||||
|
||||
if (DBG_CIPHER)
|
||||
if (DBG_CRYPTO)
|
||||
log_debug ("encode_session_key: "
|
||||
"[%d] %02x %02x %02x ... %02x %02x %02x\n",
|
||||
(int) nframe, frame[0], frame[1], frame[2],
|
||||
|
Loading…
x
Reference in New Issue
Block a user