1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-08 23:37:47 +02:00

Add provisions to build with Libgcrypt 1.6.

Replace gcry_md_start_debug by gcry_md_debug in all files.

* agent/gpg-agent.c (fixed_gcry_pth_init): Use only if
GCRY_THREAD_OPTION_VERSION is 0
* scd/scdaemon.c (fixed_gcry_pth_init): Ditto.
--

Libgcrypt 1.6 will have some minor API changes.  In particular some
deprecated macros and functions will be removed.  PTH will also be
dropped in favor of a thread model neutral locking method.
This commit is contained in:
Werner Koch 2012-05-24 10:55:11 +02:00
parent a4b22d8edf
commit b8d7b33d69
11 changed files with 179 additions and 173 deletions

View File

@ -278,11 +278,12 @@ static int check_for_running_agent (int silent, int mode);
ASSUAN_SYSTEM_PTH_IMPL;
GCRY_THREAD_OPTION_PTH_IMPL;
#if GCRY_THREAD_OPTION_VERSION < 1
static int fixed_gcry_pth_init (void)
{
return pth_self ()? 0 : (pth_init () == FALSE) ? errno : 0;
}
#endif
#ifndef PTH_HAVE_PTH_THREAD_ID
static unsigned long pth_thread_id (void)
@ -594,7 +595,9 @@ main (int argc, char **argv )
/* Libgcrypt requires us to register the threading model first.
Note that this will also do the pth_init. */
#if GCRY_THREAD_OPTION_VERSION < 1
gcry_threads_pth.init = fixed_gcry_pth_init;
#endif
err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
if (err)
{

View File

@ -61,7 +61,7 @@ write_header( cipher_filter_context_t *cfx, IOBUF a )
ed.mdc_method = DIGEST_ALGO_SHA1;
gcry_md_open (&cfx->mdc_hash, DIGEST_ALGO_SHA1, 0);
if ( DBG_HASHING )
gcry_md_start_debug (cfx->mdc_hash, "creatmdc");
gcry_md_debug (cfx->mdc_hash, "creatmdc");
}
{

View File

@ -119,7 +119,7 @@ decrypt_data( void *procctx, PKT_encrypted *ed, DEK *dek )
if (gcry_md_open (&dfx->mdc_hash, ed->mdc_method, 0 ))
BUG ();
if ( DBG_HASHING )
gcry_md_start_debug (dfx->mdc_hash, "checkmdc");
gcry_md_debug (dfx->mdc_hash, "checkmdc");
}
rc = openpgp_cipher_open (&dfx->cipher_hd, dek->algo,

View File

@ -699,9 +699,9 @@ proc_plaintext( CTX c, PACKET *pkt )
BUG ();
}
if ( DBG_HASHING ) {
gcry_md_start_debug ( c->mfx.md, "verify" );
gcry_md_debug ( c->mfx.md, "verify" );
if ( c->mfx.md2 )
gcry_md_start_debug ( c->mfx.md2, "verify2" );
gcry_md_debug ( c->mfx.md2, "verify2" );
}
rc=0;
@ -2138,9 +2138,9 @@ proc_tree( CTX c, KBNODE node )
/* c->mfx.md2? 0 :(sig->sig_class == 0x01) */
#endif
if ( DBG_HASHING ) {
gcry_md_start_debug( c->mfx.md, "verify" );
gcry_md_debug( c->mfx.md, "verify" );
if ( c->mfx.md2 )
gcry_md_start_debug( c->mfx.md2, "verify2" );
gcry_md_debug( c->mfx.md2, "verify2" );
}
if( c->sigs_only ) {
if (c->signed_data.used && c->signed_data.data_fd != -1)

View File

@ -817,7 +817,7 @@ sign_file( strlist_t filenames, int detached, strlist_t locusr,
if ( gcry_md_open (&mfx.md, 0, 0) )
BUG ();
if (DBG_HASHING)
gcry_md_start_debug (mfx.md, "sign");
gcry_md_debug (mfx.md, "sign");
/* If we're encrypting and signing, it is reasonable to pick the
hash algorithm to use out of the recepient key prefs. This is
@ -1166,7 +1166,7 @@ clearsign_file( const char *fname, strlist_t locusr, const char *outfile )
gcry_md_enable (textmd, hash_for(sk));
}
if ( DBG_HASHING )
gcry_md_start_debug ( textmd, "clearsign" );
gcry_md_debug ( textmd, "clearsign" );
copy_clearsig_text( out, inp, textmd, !opt.not_dash_escaped,
opt.escape_from, (old_style && only_md5) );
@ -1288,7 +1288,7 @@ sign_symencrypt_file (const char *fname, strlist_t locusr)
if ( gcry_md_open (&mfx.md, 0, 0) )
BUG ();
if ( DBG_HASHING )
gcry_md_start_debug (mfx.md, "symc-sign");
gcry_md_debug (mfx.md, "symc-sign");
for (sk_rover = sk_list; sk_rover; sk_rover = sk_rover->next) {
PKT_secret_key *sk = sk_rover->sk;

View File

@ -206,11 +206,12 @@ static void handle_connections (int listen_fd);
ASSUAN_SYSTEM_PTH_IMPL;
GCRY_THREAD_OPTION_PTH_IMPL;
#if GCRY_THREAD_OPTION_VERSION < 1
static int fixed_gcry_pth_init (void)
{
return pth_self ()? 0 : (pth_init () == FALSE) ? errno : 0;
}
#endif
static char *
@ -409,7 +410,9 @@ main (int argc, char **argv )
/* Libgcrypt requires us to register the threading model first.
Note that this will also do the pth_init. */
#if GCRY_THREAD_OPTION_VERSION < 1
gcry_threads_pth.init = fixed_gcry_pth_init;
#endif
err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth);
if (err)
{

View File

@ -251,7 +251,7 @@ gpgsm_check_cert_sig (ksba_cert_t issuer_cert, ksba_cert_t cert)
return rc;
}
if (DBG_HASHING)
gcry_md_start_debug (md, "hash.cert");
gcry_md_debug (md, "hash.cert");
rc = ksba_cert_hash (cert, 1, HASH_FNC, md);
if (rc)

View File

@ -618,7 +618,7 @@ create_request (ctrl_t ctrl,
goto leave;
}
if (DBG_HASHING)
gcry_md_start_debug (md, "cr.cri");
gcry_md_debug (md, "cr.cri");
ksba_certreq_set_hash_function (cr, HASH_FNC, md);
ksba_certreq_set_writer (cr, outctrl->writer);

View File

@ -535,7 +535,7 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
goto leave;
}
if (DBG_HASHING)
gcry_md_start_debug (data_md, "sign.data");
gcry_md_debug (data_md, "sign.data");
for (i=0; (algoid=ksba_cms_get_digest_algo_list (cms, i)); i++)
{
@ -669,7 +669,7 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
goto leave;
}
if (DBG_HASHING)
gcry_md_start_debug (md, "sign.attr");
gcry_md_debug (md, "sign.attr");
ksba_cms_set_hash_function (cms, HASH_FNC, md);
for (cl=signerlist,signer=0; cl; cl = cl->next, signer++)
{

View File

@ -160,7 +160,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, FILE *out_fp)
goto leave;
}
if (DBG_HASHING)
gcry_md_start_debug (data_md, "vrfy.data");
gcry_md_debug (data_md, "vrfy.data");
audit_log (ctrl->audit, AUDIT_SETUP_READY);
@ -496,7 +496,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, FILE *out_fp)
goto next_signer;
}
if (DBG_HASHING)
gcry_md_start_debug (md, "vrfy.attr");
gcry_md_debug (md, "vrfy.attr");
ksba_cms_set_hash_function (cms, HASH_FNC, md);
rc = ksba_cms_hash_signed_attrs (cms, signer);