aboutsummaryrefslogtreecommitdiffstats
path: root/g10/gpgv.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2006-08-01 12:23:34 +0000
committerWerner Koch <[email protected]>2006-08-01 12:23:34 +0000
commit8c219602515ae1dba5bc0da31077852dab61809e (patch)
tree49d596d702cfec2b8cc42ccaf8c90c82d5200ac5 /g10/gpgv.c
parentForgot this one. (diff)
parent2006-07-29 Marcus Brinkmann <[email protected]> (diff)
downloadgnupg-8c219602515ae1dba5bc0da31077852dab61809e.tar.gz
gnupg-8c219602515ae1dba5bc0da31077852dab61809e.zip
Moved 1.9 branch to trunk
Diffstat (limited to '')
-rw-r--r--g10/gpgv.c77
1 files changed, 28 insertions, 49 deletions
diff --git a/g10/gpgv.c b/g10/gpgv.c
index 5192c26fc..f33c5fc63 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -36,22 +36,19 @@
#endif
#define INCLUDED_BY_MAIN_MODULE 1
+#include "gpg.h"
#include "packet.h"
#include "iobuf.h"
-#include "memory.h"
#include "util.h"
#include "main.h"
#include "options.h"
#include "keydb.h"
#include "trustdb.h"
-#include "mpi.h"
#include "cipher.h"
#include "filter.h"
#include "ttyio.h"
#include "i18n.h"
#include "status.h"
-#include "g10defs.h"
-#include "cardglue.h"
enum cmd_and_opt_values { aNull = 0,
@@ -85,8 +82,8 @@ static ARGPARSE_OPTS opts[] = {
int g10_errors_seen = 0;
-const char *
-strusage( int level )
+static const char *
+my_strusage( int level )
{
const char *p;
switch( level ) {
@@ -106,29 +103,28 @@ strusage( int level )
"Check signatures against known trusted keys\n");
break;
- default: p = default_strusage(level);
+ default: p = NULL;
}
return p;
}
-
-
static void
i18n_init(void)
{
#ifdef USE_SIMPLE_GETTEXT
- set_gettext_file (PACKAGE, "Software\\GNU\\GnuPG");
+ set_gettext_file (PACKAGE_GT, "Software\\GNU\\GnuPG");
#else
#ifdef ENABLE_NLS
- setlocale( LC_ALL, "" );
- bindtextdomain( PACKAGE, G10_LOCALEDIR );
- textdomain( PACKAGE );
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE_GT, LOCALEDIR);
+ textdomain (PACKAGE_GT);
#endif
#endif
}
+
int
main( int argc, char **argv )
{
@@ -138,8 +134,9 @@ main( int argc, char **argv )
STRLIST nrings=NULL;
unsigned configlineno;
- log_set_name("gpgv");
- init_signals();
+ set_strusage (my_strusage);
+ log_set_prefix ("gpgv", 1);
+ gnupg_init_signals (0, NULL);
i18n_init();
opt.command_fd = -1; /* no command fd */
opt.pgp2_workarounds = 1;
@@ -161,11 +158,16 @@ main( int argc, char **argv )
while( optfile_parse( NULL, NULL, &configlineno, &pargs, opts) ) {
switch( pargs.r_opt ) {
case oQuiet: opt.quiet = 1; break;
- case oVerbose: g10_opt_verbose++;
- opt.verbose++; opt.list_sigs=1; break;
+ case oVerbose:
+ opt.verbose++;
+ opt.list_sigs=1;
+ gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
+ break;
case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;
case oStatusFD: set_status_fd( pargs.r.ret_int ); break;
- case oLoggerFD: log_set_logfile( NULL, pargs.r.ret_int ); break;
+ case oLoggerFD:
+ log_set_fd (iobuf_translate_file_handle (pargs.r.ret_int, 1));
+ break;
case oHomedir: opt.homedir = pargs.r.ret_str; break;
case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break;
default : pargs.err = 2; break;
@@ -175,9 +177,7 @@ main( int argc, char **argv )
if( log_get_errorcount(0) )
g10_exit(2);
- g10_opt_homedir = opt.homedir;
-
- if( opt.verbose > 1 )
+ if( opt.verbose > 1 )
set_packet_list_mode(1);
if( !nrings ) /* no keyring given: use default one */
@@ -371,41 +371,20 @@ int agent_scd_getattr (const char *name, struct agent_card_info_s *info) {return
#endif /* ENABLE_CARD_SUPPORT */
/* Stubs to void linking to ../cipher/cipher.c */
-int string_to_cipher_algo( const char *string ) { return 0; }
const char *cipher_algo_to_string( int algo ) { return "?";}
void disable_cipher_algo( int algo ) {}
int check_cipher_algo( int algo ) { return -1;}
unsigned int cipher_get_keylen( int algo ) { return 0; }
unsigned int cipher_get_blocksize( int algo ) {return 0;}
-CIPHER_HANDLE cipher_open( int algo, int mode, int secure ) { return NULL;}
-void cipher_close( CIPHER_HANDLE c ) {}
-int cipher_setkey( CIPHER_HANDLE c, byte *key, unsigned keylen ) { return -1;}
-void cipher_setiv( CIPHER_HANDLE c, const byte *iv, unsigned ivlen ){}
-void cipher_encrypt( CIPHER_HANDLE c, byte *outbuf,
+gcry_cipher_hd_t cipher_open( int algo, int mode, int secure ) { return NULL;}
+void cipher_close( gcry_cipher_hd_t c ) {}
+int cipher_setkey( gcry_cipher_hd_t c, byte *key, unsigned keylen ) { return -1;}
+void cipher_setiv( gcry_cipher_hd_t c, const byte *iv, unsigned ivlen ){}
+void cipher_encrypt( gcry_cipher_hd_t c, byte *outbuf,
byte *inbuf, unsigned nbytes ) {}
-void cipher_decrypt( CIPHER_HANDLE c, byte *outbuf,
+void cipher_decrypt( gcry_cipher_hd_t c, byte *outbuf,
byte *inbuf, unsigned nbytes ) {}
-void cipher_sync( CIPHER_HANDLE c ) {}
-
-/* Stubs to avoid linking to ../cipher/random.c */
-void random_dump_stats(void) {}
-int quick_random_gen( int onoff ) { return -1;}
-void randomize_buffer( byte *buffer, size_t length, int level ) {}
-int random_is_faked() { return -1;}
-byte *get_random_bits( size_t nbits, int level, int secure ) { return NULL;}
-void set_random_seed_file( const char *name ) {}
-void update_random_seed_file() {}
-void fast_random_poll() {}
-
-/* Stubs to avoid linking of ../cipher/primegen.c */
-void register_primegen_progress ( void (*cb)( void *, int), void *cb_data ) {}
-MPI generate_secret_prime( unsigned nbits ) { return NULL;}
-MPI generate_public_prime( unsigned nbits ) { return NULL;}
-MPI generate_elg_prime( int mode, unsigned pbits, unsigned qbits,
- MPI g, MPI **ret_factors ) { return NULL;}
-
-/* Do not link to ../cipher/rndlinux.c */
-void rndlinux_constructor(void) {}
+void cipher_sync( gcry_cipher_hd_t c ) {}
/* Stubs to avoid linking to ../util/ttyio.c */