Coverage Report

Created: 2026-07-16 06:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gnupg/g10/main.h
Line
Count
Source
1
/* main.h
2
 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
3
 *               2008, 2009, 2010 Free Software Foundation, Inc.
4
 *
5
 * This file is part of GnuPG.
6
 *
7
 * GnuPG is free software; you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation; either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * GnuPG is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, see <https://www.gnu.org/licenses/>.
19
 */
20
#ifndef G10_MAIN_H
21
#define G10_MAIN_H
22
23
#include "../common/types.h"
24
#include "../common/iobuf.h"
25
#include "../common/util.h"
26
#include "keydb.h"
27
#include "keyedit.h"
28
29
/* It could be argued that the default cipher should be 3DES rather
30
   than AES128, and the default compression should be 0
31
   (i.e. uncompressed) rather than 1 (zip).  However, the real world
32
   issues of speed and size come into play here. */
33
34
#if GPG_USE_AES256
35
# define DEFAULT_CIPHER_ALGO     CIPHER_ALGO_AES256
36
#elif GPG_USE_AES128
37
# define DEFAULT_CIPHER_ALGO     CIPHER_ALGO_AES
38
#elif GPG_USE_CAST5
39
# define DEFAULT_CIPHER_ALGO     CIPHER_ALGO_CAST5
40
#else
41
# define DEFAULT_CIPHER_ALGO     CIPHER_ALGO_3DES
42
#endif
43
44
0
#define DEFAULT_DIGEST_ALGO     ((GNUPG)? DIGEST_ALGO_SHA256:DIGEST_ALGO_SHA1)
45
0
#define DEFAULT_S2K_DIGEST_ALGO  DEFAULT_DIGEST_ALGO
46
#ifdef HAVE_ZIP
47
# define DEFAULT_COMPRESS_ALGO   COMPRESS_ALGO_ZIP
48
#else
49
0
# define DEFAULT_COMPRESS_ALGO   COMPRESS_ALGO_NONE
50
#endif
51
52
53
0
#define S2K_DIGEST_ALGO (opt.s2k_digest_algo?opt.s2k_digest_algo:DEFAULT_S2K_DIGEST_ALGO)
54
55
56
/* Various data objects.  */
57
58
typedef struct
59
{
60
  ctrl_t ctrl;
61
  int header_okay;
62
  PK_LIST pk_list;
63
  DEK *symkey_dek;
64
  STRING2KEY *symkey_s2k;
65
  cipher_filter_context_t cfx;
66
} encrypt_filter_context_t;
67
68
69
struct groupitem
70
{
71
  char *name;
72
  strlist_t values;
73
  struct groupitem *next;
74
};
75
76
struct weakhash
77
{
78
  enum gcry_md_algos algo;
79
  int rejection_shown;
80
  struct weakhash *next;
81
};
82
83
84
/*-- gpg.c --*/
85
extern int g10_errors_seen;
86
extern int assert_signer_true;
87
extern int assert_pubkey_algo_false;
88
89
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
90
  void g10_exit(int rc) __attribute__ ((__noreturn__));
91
#else
92
  void g10_exit(int rc);
93
#endif
94
void print_pubkey_algo_note (pubkey_algo_t algo);
95
void print_cipher_algo_note (cipher_algo_t algo);
96
void print_digest_algo_note (digest_algo_t algo);
97
void print_digest_rejected_note (enum gcry_md_algos algo);
98
void print_sha1_keysig_rejected_note (void);
99
void print_reported_error (gpg_error_t err, gpg_err_code_t skip_if_ec);
100
void print_further_info (const char *format, ...) GPGRT_ATTR_PRINTF(1,2);
101
void additional_weak_digest (const char* digestname);
102
int  is_weak_digest (digest_algo_t algo);
103
104
/*-- armor.c --*/
105
char *make_radix64_string( const byte *data, size_t len );
106
107
/*-- misc.c --*/
108
void trap_unaligned(void);
109
void register_secured_file (const char *fname);
110
void unregister_secured_file (const char *fname);
111
int  is_secured_file (gnupg_fd_t fd);
112
int  is_secured_filename (const char *fname);
113
u16 checksum_u16( unsigned n );
114
u16 checksum( const byte *p, unsigned n );
115
u16 checksum_mpi( gcry_mpi_t a );
116
u32 buffer_to_u32( const byte *buffer );
117
const byte *get_session_marker( size_t *rlen );
118
gpg_error_t gnupg_register_partial_file (const char *fname_part,
119
                                         const char *fname);
120
void gnupg_process_partial_file (int rc);
121
122
enum gcry_cipher_algos map_cipher_openpgp_to_gcry (cipher_algo_t algo);
123
#define openpgp_cipher_open(_a,_b,_c,_d) \
124
0
  gcry_cipher_open((_a),map_cipher_openpgp_to_gcry((_b)),(_c),(_d))
125
#define openpgp_cipher_get_algo_keylen(_a) \
126
0
  gcry_cipher_get_algo_keylen(map_cipher_openpgp_to_gcry((_a)))
127
#define openpgp_cipher_get_algo_blklen(_a) \
128
0
  gcry_cipher_get_algo_blklen(map_cipher_openpgp_to_gcry((_a)))
129
int openpgp_cipher_blocklen (cipher_algo_t algo);
130
int openpgp_cipher_test_algo(cipher_algo_t algo);
131
const char *openpgp_cipher_algo_name (cipher_algo_t algo);
132
const char *openpgp_cipher_algo_mode_name (cipher_algo_t algo,
133
                                           aead_algo_t aead);
134
135
gpg_error_t openpgp_aead_test_algo (aead_algo_t algo);
136
const char *openpgp_aead_algo_name (aead_algo_t algo);
137
gpg_error_t openpgp_aead_algo_info (aead_algo_t algo,
138
                                    enum gcry_cipher_modes *r_mode,
139
                                    unsigned int *r_noncelen);
140
141
int openpgp_pk_test_algo (pubkey_algo_t algo);
142
int openpgp_pk_test_algo2 (pubkey_algo_t algo, unsigned int use);
143
int openpgp_pk_algo_usage ( int algo );
144
const char *openpgp_pk_algo_name (pubkey_algo_t algo);
145
146
enum gcry_md_algos map_md_openpgp_to_gcry (digest_algo_t algo);
147
int openpgp_md_test_algo (digest_algo_t algo);
148
const char *openpgp_md_algo_name (int algo);
149
150
struct expando_args
151
{
152
  PKT_public_key *pk;
153
  PKT_public_key *pksk;
154
  byte imagetype;
155
  int validity_info;
156
  const char *validity_string;
157
  const byte *namehash;
158
};
159
160
char *pct_expando (ctrl_t ctrl, const char *string,struct expando_args *args);
161
void deprecated_warning(const char *configname,unsigned int configlineno,
162
      const char *option,const char *repl1,const char *repl2);
163
void deprecated_command (const char *name);
164
void obsolete_scdaemon_option (const char *configname,
165
                               unsigned int configlineno, const char *name);
166
167
int string_to_cipher_algo (const char *string);
168
aead_algo_t string_to_aead_algo (const char *string);
169
int string_to_digest_algo (const char *string);
170
171
const char *compress_algo_to_string(int algo);
172
int string_to_compress_algo(const char *string);
173
int check_compress_algo(int algo);
174
int default_cipher_algo(void);
175
int default_compress_algo(void);
176
void compliance_failure(void);
177
178
struct parse_options
179
{
180
  char *name;
181
  unsigned int bit;
182
  char **value;
183
  char *help;
184
};
185
186
char *optsep(char **stringp);
187
char *argsplit(char *string);
188
int parse_options(char *str,unsigned int *options,
189
      struct parse_options *opts,int noisy);
190
const char *get_libexecdir (void);
191
int path_access(const char *file,int mode);
192
193
int pubkey_get_npkey (pubkey_algo_t algo);
194
int pubkey_get_nskey (pubkey_algo_t algo);
195
int pubkey_get_nsig (pubkey_algo_t algo);
196
int pubkey_get_nenc (pubkey_algo_t algo);
197
198
/* Temporary helpers. */
199
unsigned int pubkey_nbits( int algo, gcry_mpi_t *pkey );
200
int mpi_print (estream_t stream, gcry_mpi_t a, int mode);
201
unsigned int ecdsa_qbits_from_Q (unsigned int qbits);
202
203
204
/*-- cpr.c --*/
205
void set_status_fd ( int fd );
206
int  is_status_enabled ( void );
207
void write_status ( int no );
208
void write_status_warning (const char *where, gpg_error_t err);
209
void write_status_error (const char *where, gpg_error_t err);
210
void write_status_errcode (const char *where, int errcode);
211
void write_status_failure (const char *where, gpg_error_t err);
212
void write_status_text ( int no, const char *text );
213
void write_status_printf (int no, const char *format,
214
                          ...) GPGRT_ATTR_PRINTF(2,3);
215
void write_status_strings (int no, const char *text,
216
                           ...) GPGRT_ATTR_SENTINEL(0);
217
gpg_error_t write_status_strings2 (ctrl_t dummy, int no,
218
                                   ...) GPGRT_ATTR_SENTINEL(0);
219
void write_status_buffer ( int no,
220
                           const char *buffer, size_t len, int wrap );
221
void write_status_text_and_buffer ( int no, const char *text,
222
                                    const char *buffer, size_t len, int wrap );
223
224
void write_status_begin_signing (gcry_md_hd_t md);
225
226
227
int cpr_enabled(void);
228
char *cpr_get( const char *keyword, const char *prompt );
229
char *cpr_get_no_help( const char *keyword, const char *prompt );
230
char *cpr_get_utf8( const char *keyword, const char *prompt );
231
char *cpr_get_hidden( const char *keyword, const char *prompt );
232
void cpr_kill_prompt(void);
233
int  cpr_get_answer_is_yes_def (const char *keyword, const char *prompt,
234
                                int def_yes);
235
int  cpr_get_answer_is_yes( const char *keyword, const char *prompt );
236
int  cpr_get_answer_yes_no_quit( const char *keyword, const char *prompt );
237
int  cpr_get_answer_okay_cancel (const char *keyword,
238
                                 const char *prompt,
239
                                 int def_answer);
240
241
/*-- helptext.c --*/
242
void display_online_help( const char *keyword );
243
244
/*-- encrypt.c --*/
245
gpg_error_t setup_symkey (STRING2KEY **symkey_s2k,DEK **symkey_dek);
246
aead_algo_t use_aead (pk_list_t pk_list, int algo);
247
int use_mdc (pk_list_t pk_list,int algo);
248
int encrypt_symmetric (const char *filename );
249
int encrypt_store (const char *filename );
250
int encrypt_crypt (ctrl_t ctrl, gnupg_fd_t filefd, const char *filename,
251
                   strlist_t remusr, int use_symkey, pk_list_t provided_keys,
252
                   gnupg_fd_t outputfd);
253
void encrypt_crypt_files (ctrl_t ctrl,
254
                          int nfiles, char **files, strlist_t remusr);
255
gpg_error_t reencrypt_to_new_recipients (ctrl_t ctrl, int armor,
256
                                         const char *filename, iobuf_t infp,
257
                                         strlist_t recipients,
258
                                         DEK *dek,
259
                                         struct seskey_enc_list *sesenc_list);
260
int encrypt_filter (void *opaque, int control,
261
        iobuf_t a, byte *buf, size_t *ret_len);
262
263
int write_pubkey_enc (ctrl_t ctrl, PKT_public_key *pk, int throw_keyid,
264
                      DEK *dek, iobuf_t out);
265
266
/*-- sign.c --*/
267
int sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
268
         int do_encrypt, strlist_t remusr, const char *outfile );
269
int clearsign_file (ctrl_t ctrl,
270
                    const char *fname, strlist_t locusr, const char *outfile);
271
int sign_symencrypt_file (ctrl_t ctrl, const char *fname, strlist_t locusr);
272
273
/*-- sig-check.c --*/
274
void sig_check_dump_stats (void);
275
276
/* SIG is a revocation signature.  Check if any of PK's designated
277
   revokers generated it.  If so, return 0.  Note: this function
278
   (correctly) doesn't care if the designated revoker is revoked.  */
279
gpg_error_t check_revocation_keys (ctrl_t ctrl,
280
                                   PKT_public_key *pk, PKT_signature *sig);
281
/* Check that the backsig BACKSIG from the subkey SUB_PK to its
282
   primary key MAIN_PK is valid.  */
283
int check_backsig(PKT_public_key *main_pk,PKT_public_key *sub_pk,
284
      PKT_signature *backsig);
285
/* Check that the signature SIG over a key (e.g., a key binding or a
286
   key revocation) is valid.  (To check signatures over data, use
287
   check_signature.)  */
288
int check_key_signature (ctrl_t ctrl, kbnode_t root, kbnode_t sig,
289
                         int *is_selfsig );
290
/* Like check_key_signature, but with the ability to specify some
291
   additional parameters and get back additional information.  See the
292
   documentation for the implementation for details.  */
293
int check_key_signature2 (ctrl_t ctrl, kbnode_t root, kbnode_t node,
294
                          PKT_public_key *check_pk, PKT_public_key *ret_pk,
295
                          int *is_selfsig, u32 *r_expiredate, int *r_expired);
296
297
/* Returns whether SIGNER generated the signature SIG over the packet
298
   PACKET, which is a key, subkey or uid, and comes from the key block
299
   KB.  If SIGNER is NULL, it is looked up based on the information in
300
   SIG.  If not NULL, sets *IS_SELFSIG to indicate whether the
301
   signature is a self-signature and *RET_PK to a copy of the signer's
302
   key.  */
303
gpg_error_t check_signature_over_key_or_uid (ctrl_t ctrl,
304
                                             PKT_public_key *signer,
305
                                             PKT_signature *sig,
306
                                             KBNODE kb, PACKET *packet,
307
                                             int *is_selfsig,
308
                                             PKT_public_key *ret_pk);
309
310
311
/*-- delkey.c --*/
312
gpg_error_t delete_keys (ctrl_t ctrl,
313
                         strlist_t names, int secret, int allow_both);
314
315
/*-- keygen.c --*/
316
const char *get_default_pubkey_algo (void);
317
u32 parse_expire_string(const char *string);
318
u32 ask_expire_interval(int object,const char *def_expire);
319
u32 ask_expiredate(void);
320
unsigned int ask_key_flags (int algo, int subkey, unsigned int current);
321
const char *ask_curve (int *algo, int *subkey_algo, const char *current);
322
void quick_generate_keypair (ctrl_t ctrl, const char *uid, const char *algostr,
323
                             const char *usagestr, const char *expirestr);
324
325
0
#define GENERATE_KEYPAIR_FULL        1  /* Full key generation dialog.  */
326
#define GENERATE_KEYPAIR_CARDBACKUP  2  /* Create card key with backup. */
327
#define GENERATE_KEYPAIR_CARDPRIMARY 4  /* Only the primary card key.   */
328
void generate_keypair (ctrl_t ctrl, const char *fname,
329
                       const char *card_serialno, unsigned int genflags);
330
331
int keygen_set_std_prefs (const char *string,int personal);
332
PKT_user_id *keygen_get_std_prefs (void);
333
int keygen_add_key_expire( PKT_signature *sig, void *opaque );
334
int keygen_add_key_flags (PKT_signature *sig, void *opaque);
335
int keygen_add_key_flags_and_expire (PKT_signature *sig, void *opaque);
336
int keygen_add_std_prefs( PKT_signature *sig, void *opaque );
337
int keygen_upd_std_prefs( PKT_signature *sig, void *opaque );
338
int keygen_add_keyserver_url(PKT_signature *sig, void *opaque);
339
int keygen_add_notations(PKT_signature *sig,void *opaque);
340
int keygen_add_revkey(PKT_signature *sig, void *opaque);
341
gpg_error_t make_backsig (ctrl_t ctrl,
342
                          PKT_signature *sig, PKT_public_key *pk,
343
                          PKT_public_key *sub_pk, PKT_public_key *sub_psk,
344
                          u32 timestamp, const char *cache_nonce);
345
void keygen_prepare_new_key_adsks (void);
346
gpg_error_t append_all_default_adsks (ctrl_t ctrl, kbnode_t pub_root);
347
gpg_error_t generate_subkeypair (ctrl_t ctrl, kbnode_t keyblock,
348
                                 const char *algostr,
349
                                 const char *usagestr,
350
                                 const char *expirestr);
351
gpg_error_t append_subkey_to_keyblock (ctrl_t ctrl, kbnode_t keyblock,
352
                                       PKT_public_key *sub_pk, int use);
353
#ifdef ENABLE_CARD_SUPPORT
354
gpg_error_t generate_card_subkeypair (ctrl_t ctrl, kbnode_t pub_keyblock,
355
                                      int keyno, const char *serialno);
356
#endif
357
358
359
/*-- openfile.c --*/
360
int overwrite_filep( const char *fname );
361
char *make_outfile_name( const char *iname );
362
char *ask_outfile_name( const char *name, size_t namelen );
363
int open_outfile (gnupg_fd_t out_fd, const char *iname, int mode,
364
                  int restrictedperm, iobuf_t *a);
365
char *get_matching_datafile (const char *sigfilename);
366
iobuf_t open_sigfile (const char *sigfilename, progress_filter_context_t *pfx);
367
void try_make_homedir( const char *fname );
368
char *get_openpgp_revocdir (const char *home);
369
370
/*-- seskey.c --*/
371
void make_session_key( DEK *dek );
372
gcry_mpi_t encode_session_key( int openpgp_pk_algo, DEK *dek, unsigned nbits );
373
gcry_mpi_t encode_md_value (PKT_public_key *pk,
374
                            gcry_md_hd_t md, int hash_algo );
375
376
/*-- import.c --*/
377
struct import_stats_s;
378
typedef struct import_stats_s *import_stats_t;
379
struct import_filter_s;
380
typedef struct import_filter_s *import_filter_t;
381
typedef gpg_error_t (*import_screener_t)(kbnode_t keyblock, void *arg);
382
383
int parse_import_options(char *str,unsigned int *options,int noisy);
384
385
gpg_error_t parse_and_set_import_filter (const char *string);
386
import_filter_t save_and_clear_import_filter (void);
387
void            restore_import_filter (import_filter_t filt);
388
389
gpg_error_t read_key_from_file_or_buffer (ctrl_t ctrl, const char *fname,
390
                                          const void *buffer, size_t buflen,
391
                                          kbnode_t *r_keyblock);
392
gpg_error_t import_included_key_block (ctrl_t ctrl, kbnode_t keyblock);
393
void import_keys (ctrl_t ctrl, char **fnames, int nnames,
394
      import_stats_t stats_hd, unsigned int options,
395
                  int origin, const char *url);
396
gpg_error_t import_keys_es_stream (ctrl_t ctrl, estream_t fp,
397
                           import_stats_t stats_handle,
398
                           unsigned char **fpr, size_t *fpr_len,
399
                           unsigned int options,
400
                           import_screener_t screener, void *screener_arg,
401
                           int origin, const char *url);
402
gpg_error_t import_old_secring (ctrl_t ctrl, const char *fname);
403
import_stats_t import_new_stats_handle (void);
404
void import_release_stats_handle (import_stats_t hd);
405
void import_print_stats (import_stats_t hd);
406
/* Communication for impex_filter_getval */
407
struct impex_filter_parm_s
408
{
409
  ctrl_t ctrl;
410
  kbnode_t node;
411
  char hexfpr[2*MAX_FINGERPRINT_LEN + 1];
412
};
413
414
const char *impex_filter_getval (void *cookie, const char *propname);
415
gpg_error_t transfer_secret_keys (ctrl_t ctrl, struct import_stats_s *stats,
416
                                  kbnode_t sec_keyblock, int batch, int force,
417
                                  int only_marked);
418
419
int collapse_uids (kbnode_t *keyblock);
420
int collapse_subkeys (kbnode_t *keyblock);
421
422
const char *revocation_reason_code_to_str (int code, char **r_freeme);
423
int get_revocation_reason (PKT_signature *sig, char **r_reason,
424
                           char **r_comment, size_t *r_commentlen);
425
426
427
/*-- export.c --*/
428
struct export_stats_s;
429
typedef struct export_stats_s *export_stats_t;
430
431
export_stats_t export_new_stats (void);
432
void export_release_stats (export_stats_t stats);
433
void export_print_stats (export_stats_t stats);
434
void print_status_exported (PKT_public_key *pk);
435
436
int parse_export_options(char *str,unsigned int *options,int noisy);
437
gpg_error_t parse_and_set_export_filter (const char *string);
438
void push_export_filters (void);
439
void pop_export_filters (void);
440
441
int exact_subkey_match_p (KEYDB_SEARCH_DESC *desc, kbnode_t node);
442
443
int export_pubkeys (ctrl_t ctrl, strlist_t users, unsigned int options,
444
                    export_stats_t stats);
445
int export_seckeys (ctrl_t ctrl, strlist_t users, unsigned int options,
446
                    export_stats_t stats);
447
int export_secsubkeys (ctrl_t ctrl, strlist_t users, unsigned int options,
448
                       export_stats_t stats);
449
450
gpg_error_t export_pubkey_buffer (ctrl_t ctrl, const char *keyspec,
451
                                  unsigned int options,
452
                                  const void *prefix, size_t prefixlen,
453
                                  export_stats_t stats,
454
                                  kbnode_t *r_keyblock,
455
                                  void **r_data, size_t *r_datalen);
456
457
gpg_error_t receive_seckey_from_agent (ctrl_t ctrl, gcry_cipher_hd_t cipherhd,
458
                                       int cleartext,
459
                                       int mode1003, int is_part2,
460
                                       char **cache_nonce_addr,
461
                                       const char *hexgrip,
462
                                       PKT_public_key *pk, gcry_sexp_t *r_key);
463
464
gpg_error_t write_keyblock_to_output (kbnode_t keyblock,
465
                                      int with_armor, unsigned int options);
466
467
gpg_error_t export_ssh_key (ctrl_t ctrl, const char *userid);
468
gpg_error_t export_secret_ssh_key (ctrl_t ctrl, const char *userid);
469
470
/*-- dearmor.c --*/
471
int dearmor_file( const char *fname );
472
int enarmor_file( const char *fname );
473
474
/*-- revoke.c --*/
475
struct revocation_reason_info;
476
477
int gen_standard_revoke (ctrl_t ctrl,
478
                         PKT_public_key *psk, const char *cache_nonce);
479
int gen_revoke (ctrl_t ctrl, const char *uname);
480
int gen_desig_revoke (ctrl_t ctrl, const char *uname, strlist_t locusr);
481
int revocation_reason_build_cb( PKT_signature *sig, void *opaque );
482
struct revocation_reason_info *
483
    ask_revocation_reason( int key_rev, int cert_rev, int hint );
484
struct revocation_reason_info * get_default_uid_revocation_reason (void);
485
struct revocation_reason_info * get_default_sig_revocation_reason (void);
486
void release_revocation_reason_info (struct revocation_reason_info *reason);
487
488
/*-- keylist.c --*/
489
void public_key_list (ctrl_t ctrl, strlist_t list,
490
                      int locate_mode, int no_local);
491
void secret_key_list (ctrl_t ctrl, strlist_t list );
492
gpg_error_t parse_and_set_list_filter (const char *string);
493
void print_subpackets_colon(PKT_signature *sig);
494
void reorder_keyblock (KBNODE keyblock);
495
gpg_error_t list_keyblock_direct (ctrl_t ctrl, kbnode_t keyblock, int secret,
496
                                  int has_secret, int fpr, int no_validity);
497
int  cmp_signodes (const void *av, const void *bv);
498
void print_fingerprint (ctrl_t ctrl, estream_t fp,
499
                        PKT_public_key *pk, int mode);
500
void print_revokers (estream_t fp, int colon_mode, PKT_public_key *pk);
501
void show_preferences (PKT_user_id *uid, int indent, int mode, int verbose);
502
void show_policy_url(PKT_signature *sig,int indent,int mode);
503
void show_keyserver_url(PKT_signature *sig,int indent,int mode);
504
void show_notation(PKT_signature *sig,int indent,int mode,int which);
505
void print_matching_notations (PKT_signature *sig);
506
void dump_attribs (const PKT_user_id *uid, PKT_public_key *pk);
507
void set_attrib_fd(int fd);
508
void print_key_info (ctrl_t ctrl, estream_t fp, int indent,
509
                     PKT_public_key *pk, int secret);
510
void print_key_info_log (ctrl_t ctrl, int loglevel, int indent,
511
                     PKT_public_key *pk, int secret);
512
void print_card_key_info (estream_t fp, KBNODE keyblock);
513
void print_key_line (ctrl_t ctrl, estream_t fp, PKT_public_key *pk, int secret);
514
void print_revocation_reason_comment (const char *comment, size_t comment_len);
515
516
/*-- verify.c --*/
517
void print_file_status( int status, const char *name, int what );
518
int verify_signatures (ctrl_t ctrl, int nfiles, char **files );
519
int verify_files (ctrl_t ctrl, int nfiles, char **files );
520
int gpg_verify (ctrl_t ctrl, gnupg_fd_t sig_fd, gnupg_fd_t data_fd,
521
                estream_t out_fp);
522
void check_assert_signer_list (const char *mainpkhex, const char *pkhex);
523
void check_assert_pubkey_algo (const char *algostr, const char *pkhex);
524
525
/*-- decrypt.c --*/
526
gpg_error_t decrypt_message (ctrl_t ctrl, const char *filename,
527
                             strlist_t remusr);
528
gpg_error_t decrypt_message_fd (ctrl_t ctrl, gnupg_fd_t input_fd,
529
                                gnupg_fd_t output_fd);
530
void decrypt_messages (ctrl_t ctrl, int nfiles, char *files[]);
531
532
/*-- plaintext.c --*/
533
int hash_datafiles( gcry_md_hd_t md, gcry_md_hd_t md2,
534
        strlist_t files, const char *sigfilename, int textmode);
535
int hash_datafile_by_fd (gcry_md_hd_t md, gcry_md_hd_t md2,
536
                         gnupg_fd_t data_fd, int textmode);
537
PKT_plaintext *setup_plaintext_name(const char *filename,IOBUF iobuf);
538
539
/*-- server.c --*/
540
int gpg_server (ctrl_t);
541
gpg_error_t gpg_proxy_pinentry_notify (ctrl_t ctrl,
542
                                       const unsigned char *line);
543
544
#ifdef ENABLE_CARD_SUPPORT
545
/*-- card-util.c --*/
546
void change_pin (int no, int allow_admin);
547
void card_status (ctrl_t ctrl, estream_t fp, const char *serialno);
548
void card_edit (ctrl_t ctrl, strlist_t commands);
549
gpg_error_t  card_generate_subkey (ctrl_t ctrl, kbnode_t pub_keyblock);
550
int  card_store_subkey (kbnode_t node, int use, strlist_t *processed_keys,
551
                        int *r_selected_use);
552
#endif
553
554
/*-- migrate.c --*/
555
void migrate_secring (ctrl_t ctrl);
556
557
558
#endif /*G10_MAIN_H*/