2
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4
* This file is part of GnuPG.
6
* GnuPG is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* GnuPG is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
24
#include "../common/iobuf.h"
29
/* It could be argued that the default cipher should be 3DES rather
30
than CAST5, and the default compression should be 0
31
(i.e. uncompressed) rather than 1 (zip). */
32
#define DEFAULT_CIPHER_ALGO CIPHER_ALGO_CAST5
33
#define DEFAULT_DIGEST_ALGO DIGEST_ALGO_SHA1
34
#define DEFAULT_COMPRESS_ALGO 1
39
cipher_filter_context_t cfx;
40
} encrypt_filter_context_t;
46
struct groupitem *next;
50
extern int g10_errors_seen;
52
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
53
void g10_exit(int rc) __attribute__ ((noreturn));
55
void g10_exit(int rc);
57
void print_pubkey_algo_note( int algo );
58
void print_cipher_algo_note( int algo );
59
void print_digest_algo_note( int algo );
62
char *make_radix64_string( const byte *data, size_t len );
65
void trap_unaligned(void);
66
int disable_core_dumps(void);
67
u16 checksum_u16( unsigned n );
68
u16 checksum( byte *p, unsigned n );
69
u16 checksum_mpi( gcry_mpi_t a );
70
u32 buffer_to_u32( const byte *buffer );
71
const byte *get_session_marker( size_t *rlen );
72
int openpgp_cipher_test_algo( int algo );
73
int openpgp_pk_test_algo( int algo, unsigned int usage_flags );
74
int openpgp_pk_algo_usage ( int algo );
75
int openpgp_md_test_algo( int algo );
76
int openpgp_md_map_name (const char *string);
77
int openpgp_cipher_map_name (const char *string);
78
int openpgp_pk_map_name (const char *string);
81
void idea_cipher_warn( int show );
83
#define idea_cipher_warn(a)
93
char *pct_expando(const char *string,struct expando_args *args);
94
int hextobyte( const char *s );
95
void deprecated_warning(const char *configname,unsigned int configlineno,
96
const char *option,const char *repl1,const char *repl2);
97
const char *compress_algo_to_string(int algo);
98
int string_to_compress_algo(const char *string);
99
int check_compress_algo(int algo);
100
int default_cipher_algo(void);
101
int default_compress_algo(void);
102
const char *compliance_option_string(void);
103
void compliance_failure(void);
111
int parse_options(char *str,unsigned int *options,struct parse_options *opts);
114
/* Temporary helpers. */
115
int pubkey_get_npkey( int algo );
116
int pubkey_get_nskey( int algo );
117
int pubkey_get_nsig( int algo );
118
int pubkey_get_nenc( int algo );
119
unsigned int pubkey_nbits( int algo, gcry_mpi_t *pkey );
122
int mpi_write( iobuf_t out, gcry_mpi_t a );
123
int mpi_write_opaque( iobuf_t out, gcry_mpi_t a );
124
gcry_mpi_t mpi_read(iobuf_t inp, unsigned int *ret_nread, int secure );
125
gcry_mpi_t mpi_read_opaque(iobuf_t inp, unsigned int *ret_nread );
126
int mpi_print( FILE *fp, gcry_mpi_t a, int mode );
132
void display_online_help( const char *keyword );
135
int encode_symmetric( const char *filename );
136
int encode_store( const char *filename );
137
int encode_crypt( const char *filename, STRLIST remusr );
138
void encode_crypt_files(int nfiles, char **files, STRLIST remusr);
139
int encrypt_filter( void *opaque, int control,
140
iobuf_t a, byte *buf, size_t *ret_len);
144
int complete_sig( PKT_signature *sig, PKT_secret_key *sk, MD_HANDLE md );
145
int sign_file( STRLIST filenames, int detached, STRLIST locusr,
146
int do_encrypt, STRLIST remusr, const char *outfile );
147
int clearsign_file( const char *fname, STRLIST locusr, const char *outfile );
148
int sign_symencrypt_file (const char *fname, STRLIST locusr);
150
/*-- sig-check.c --*/
151
int check_revocation_keys (PKT_public_key *pk, PKT_signature *sig);
152
int check_key_signature( KBNODE root, KBNODE node, int *is_selfsig );
153
int check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *check_pk,
154
PKT_public_key *ret_pk, int *is_selfsig,
155
u32 *r_expiredate, int *r_expired );
158
int delete_keys( STRLIST names, int secret, int allow_both );
161
void keyedit_menu( const char *username, STRLIST locusr, STRLIST cmds,
163
void show_basic_key_info (KBNODE keyblock);
166
u32 ask_expire_interval(int object);
167
u32 ask_expiredate(void);
168
void generate_keypair( const char *fname, const char *card_serialno );
169
int keygen_set_std_prefs (const char *string,int personal);
170
PKT_user_id *keygen_get_std_prefs (void);
171
int keygen_add_key_expire( PKT_signature *sig, void *opaque );
172
int keygen_add_std_prefs( PKT_signature *sig, void *opaque );
173
int keygen_upd_std_prefs( PKT_signature *sig, void *opaque );
174
int keygen_add_keyserver_url(PKT_signature *sig, void *opaque);
175
int keygen_add_revkey(PKT_signature *sig, void *opaque);
176
int generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock );
179
int overwrite_filep( const char *fname );
180
char *make_outfile_name( const char *iname );
181
char *ask_outfile_name( const char *name, size_t namelen );
182
int open_outfile( const char *iname, int mode, iobuf_t *a );
183
iobuf_t open_sigfile( const char *iname, progress_filter_context_t *pfx );
184
void try_make_homedir( const char *fname );
187
void make_session_key( DEK *dek );
188
gcry_mpi_t encode_session_key( DEK *dek, unsigned int nbits);
189
gcry_mpi_t encode_md_value( int pubkey_algo, MD_HANDLE md,
190
int hash_algo, unsigned nbits, int v3compathack );
193
KBNODE make_comment_node_from_buffer (const char *s, size_t n);
194
KBNODE make_comment_node( const char *s );
195
KBNODE make_mpi_comment_node( const char *s, gcry_mpi_t a );
198
int parse_import_options(char *str,unsigned int *options);
199
void import_keys( char **fnames, int nnames,
200
void *stats_hd, unsigned int options );
201
int import_keys_stream( iobuf_t inp,
202
void *stats_hd, unsigned int options );
203
void *import_new_stats_handle (void);
204
void import_release_stats_handle (void *p);
205
void import_print_stats (void *hd);
207
int collapse_uids( KBNODE *keyblock );
210
int parse_export_options(char *str,unsigned int *options);
211
int export_pubkeys( STRLIST users, unsigned int options );
212
int export_pubkeys_stream( iobuf_t out, STRLIST users,
213
KBNODE *keyblock_out, unsigned int options );
214
int export_seckeys( STRLIST users );
215
int export_secsubkeys( STRLIST users );
218
int dearmor_file( const char *fname );
219
int enarmor_file( const char *fname );
222
struct revocation_reason_info;
223
int gen_revoke( const char *uname );
224
int gen_desig_revoke( const char *uname );
225
int revocation_reason_build_cb( PKT_signature *sig, void *opaque );
226
struct revocation_reason_info *
227
ask_revocation_reason( int key_rev, int cert_rev, int hint );
228
void release_revocation_reason_info( struct revocation_reason_info *reason );
231
void public_key_list( STRLIST list );
232
void secret_key_list( STRLIST list );
233
void reorder_keyblock (KBNODE keyblock);
234
void list_keyblock( KBNODE keyblock, int secret, int fpr, void *opaque );
235
void print_fingerprint (PKT_public_key *pk, PKT_secret_key *sk, int mode);
236
void show_policy_url(PKT_signature *sig,int indent,int mode);
237
void show_keyserver_url(PKT_signature *sig,int indent,int mode);
238
void show_notation(PKT_signature *sig,int indent,int mode);
239
void dump_attribs(const PKT_user_id *uid,
240
PKT_public_key *pk,PKT_secret_key *sk);
241
void set_attrib_fd(int fd);
242
void print_seckey_info (PKT_secret_key *sk);
243
void print_pubkey_info (FILE *fp, PKT_public_key *pk);
246
void print_file_status( int status, const char *name, int what );
247
int verify_signatures( int nfiles, char **files );
248
int verify_files( int nfiles, char **files );
251
int decrypt_message( const char *filename );
252
void decrypt_messages(int nfiles, char **files);
254
/*-- plaintext.c --*/
255
int hash_datafiles( MD_HANDLE md, MD_HANDLE md2,
256
STRLIST files, const char *sigfilename, int textmode );
259
void run_in_pipemode (void);
261
/*-- card-util.c --*/
262
void change_pin (int no, int allow_admin);
263
void card_status (FILE *fp, char *serialnobuf, size_t serialnobuflen);
264
void card_edit (STRLIST commands);
267
void init_signals(void);
268
void pause_on_sigusr( int which );
269
void block_all_signals(void);
270
void unblock_all_signals(void);
272
#endif /*G10_MAIN_H*/