2 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
3 * 2007, 2010, 2011 Free Software Foundation, Inc.
4 * Copyright (C) 2015 g10 Code GmbH
6 * This file is part of GnuPG.
8 * GnuPG is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * GnuPG is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
24 #include <sys/types.h>
29 #include "../common/session-env.h"
31 #ifndef EXTERN_UNLESS_MAIN_MODULE
32 /* Norcraft can't cope with common symbols */
33 #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
34 #define EXTERN_UNLESS_MAIN_MODULE extern
36 #define EXTERN_UNLESS_MAIN_MODULE
40 /* Declaration of a keyserver spec type. The definition is found in
41 ../common/keyserver.h. */
42 struct keyserver_spec;
43 typedef struct keyserver_spec *keyserver_spec_t;
46 /* Global options for GPG. */
47 EXTERN_UNLESS_MAIN_MODULE
55 estream_t outfp; /* Hack, sometimes used in place of outfile. */
62 const char *def_sig_expire;
64 const char *def_cert_expire;
66 int batch; /* run in batch mode */
67 int answer_yes; /* answer yes on most questions */
68 int answer_no; /* answer no on most questions */
69 int check_sigs; /* check key signatures */
72 int with_icao_spelling; /* Print ICAO spelling with fingerprints. */
73 int with_fingerprint; /* Option --with-fingerprint active. */
74 int with_keygrip; /* Option --with-keygrip active. */
75 int with_secret; /* Option --with-secret active. */
76 int with_wkd_hash; /* Option --with-wkd-hash. */
77 int fingerprint; /* list fingerprints */
78 int list_sigs; /* list signatures */
79 int print_pka_records;
80 int print_dane_records;
82 int list_packets; /* list-packets mode: 1=normal, 2=invoked by command*/
90 int bz2_compress_level;
91 int bz2_decompress_lowmem;
92 strlist_t def_secret_key;
94 int def_recipient_self;
95 strlist_t secret_keys_to_try;
100 int emit_version; /* 0 = none,
104 4 = full version plus OS string. */
105 int marginals_needed;
106 int completes_needed;
109 const char *agent_program;
110 const char *dirmngr_program;
112 /* Options to be passed to the gpg-agent */
113 session_env_t session_env;
118 int skip_hidden_recipients;
120 /* TM_CLASSIC must be zero to accommodate trustdbs generated before
121 we started storing the trust model inside the trustdb. */
124 TM_CLASSIC=0, TM_PGP=1, TM_EXTERNAL=2,
125 TM_ALWAYS, TM_DIRECT, TM_AUTO, TM_TOFU, TM_TOFU_PGP
129 TOFU_DB_AUTO=0, TOFU_DB_SPLIT, TOFU_DB_FLAT
131 enum tofu_policy tofu_default_policy;
132 int force_ownertrust;
135 CO_GNUPG, CO_RFC4880, CO_RFC2440,
136 CO_PGP6, CO_PGP7, CO_PGP8
140 KF_DEFAULT, KF_SHORT, KF_LONG, KF_0xSHORT, KF_0xLONG
143 const char *set_filename;
146 const char *photo_viewer;
150 unsigned char s2k_count; /* This is the encoded form, not the raw
152 int not_dash_escaped;
155 keyserver_spec_t keyserver; /* The list of configured keyservers. */
158 unsigned int options;
159 unsigned int import_options;
160 unsigned int export_options;
165 unsigned int import_options;
166 unsigned int export_options;
167 unsigned int list_options;
168 unsigned int verify_options;
169 const char *def_preference_list;
170 const char *def_keyserver_url;
171 prefitem_t *personal_cipher_prefs;
172 prefitem_t *personal_digest_prefs;
173 prefitem_t *personal_compress_prefs;
174 struct weakhash *weak_digests;
179 int encrypt_to_default_key;
181 struct notation *sig_notations;
182 struct notation *cert_notations;
183 strlist_t sig_policy_url;
184 strlist_t cert_policy_url;
185 strlist_t sig_keyserver_url;
186 strlist_t cert_subpackets;
187 strlist_t sig_subpackets;
188 int allow_non_selfsigned_uid;
189 int allow_freeform_uid;
193 int legacy_list_mode;
194 int ignore_time_conflict;
195 int ignore_valid_from;
196 int ignore_crc_error;
197 int ignore_mdc_error;
199 const char *override_session_key;
200 int show_session_key;
202 const char *gpg_agent_info;
204 int no_expensive_trust_checks;
206 int no_auto_check_trustdb;
207 int preserve_permissions;
208 int no_homedir_creation;
209 struct groupitem *grouplist;
210 int mangle_dos_filenames;
211 int enable_progress_filter;
212 unsigned int screen_columns;
213 unsigned int screen_lines;
214 byte *show_subpackets;
217 /* If true, let write failures on the status-fd exit the process. */
218 int exit_on_status_write_error;
220 /* If > 0, limit the number of card insertion prompts to this
222 int limit_card_insert_tries;
226 /* If set, require an 0x19 backsig to be present on signatures
227 made by signing subkeys. If not set, a missing backsig is not
228 an error (but an invalid backsig still is). */
229 unsigned int require_cross_cert:1;
231 unsigned int use_embedded_filename:1;
232 unsigned int utf8_filename:1;
234 unsigned int allow_multiple_messages:1;
235 unsigned int allow_weak_digest_algos:1;
236 unsigned int large_rsa:1;
239 /* Linked list of ways to find a key if the key isn't on the local
254 keyserver_spec_t spec;
258 int passphrase_repeat;
261 int unwrap_encryption;
262 int only_sign_text_ids;
265 /* CTRL is used to keep some global variables we currently can't
266 avoid. Future concurrent versions of gpg will put it into a per
267 request structure CTRL. */
268 EXTERN_UNLESS_MAIN_MODULE
270 int in_auto_key_retrieve; /* True if we are doing an
271 auto_key_retrieve. */
272 /* Hack to store the last error. We currently need it because the
273 proc_packet machinery is not able to reliabale return error
274 codes. Thus for the --server purposes we store some of the error
275 codes here. FIXME! */
279 #define DBG_PACKET_VALUE 1 /* debug packet reading/writing */
280 #define DBG_MPI_VALUE 2 /* debug mpi details */
281 #define DBG_CRYPTO_VALUE 4 /* debug crypto handling */
282 /* (may reveal sensitive data) */
283 #define DBG_FILTER_VALUE 8 /* debug internal filter handling */
284 #define DBG_IOBUF_VALUE 16 /* debug iobuf stuff */
285 #define DBG_MEMORY_VALUE 32 /* debug memory allocation stuff */
286 #define DBG_CACHE_VALUE 64 /* debug the caching */
287 #define DBG_MEMSTAT_VALUE 128 /* show memory statistics */
288 #define DBG_TRUST_VALUE 256 /* debug the trustdb */
289 #define DBG_HASHING_VALUE 512 /* debug hashing operations */
290 #define DBG_IPC_VALUE 1024 /* debug assuan communication */
291 #define DBG_CARD_IO_VALUE 2048 /* debug smart card I/O. */
292 #define DBG_CLOCK_VALUE 4096
293 #define DBG_LOOKUP_VALUE 8192 /* debug the kety lookup */
294 #define DBG_EXTPROG_VALUE 16384 /* debug external program calls */
296 /* Tests for the debugging flags. */
297 #define DBG_PACKET (opt.debug & DBG_PACKET_VALUE)
298 #define DBG_CRYPTO (opt.debug & DBG_CRYPTO_VALUE)
299 #define DBG_FILTER (opt.debug & DBG_FILTER_VALUE)
300 #define DBG_CACHE (opt.debug & DBG_CACHE_VALUE)
301 #define DBG_TRUST (opt.debug & DBG_TRUST_VALUE)
302 #define DBG_HASHING (opt.debug & DBG_HASHING_VALUE)
303 #define DBG_IPC (opt.debug & DBG_IPC_VALUE)
304 #define DBG_CARD_IO (opt.debug & DBG_CARD_IO_VALUE)
305 #define DBG_IPC (opt.debug & DBG_IPC_VALUE)
306 #define DBG_CLOCK (opt.debug & DBG_CLOCK_VALUE)
307 #define DBG_LOOKUP (opt.debug & DBG_LOOKUP_VALUE)
308 #define DBG_EXTPROG (opt.debug & DBG_EXTPROG_VALUE)
310 /* FIXME: We need to check whey we did not put this into opt. */
311 #define DBG_MEMORY memory_debug_mode
312 #define DBG_MEMSTAT memory_stat_debug_mode
314 EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode;
315 EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
318 /* Compatibility flags. */
319 #define GNUPG (opt.compliance==CO_GNUPG)
320 #define RFC2440 (opt.compliance==CO_RFC2440)
321 #define RFC4880 (opt.compliance==CO_RFC4880)
322 #define PGP6 (opt.compliance==CO_PGP6)
323 #define PGP7 (opt.compliance==CO_PGP7)
324 #define PGP8 (opt.compliance==CO_PGP8)
325 #define PGPX (PGP6 || PGP7 || PGP8)
327 /* Various option flags. Note that there should be no common string
328 names between the IMPORT_ and EXPORT_ flags as they can be mixed in
329 the keyserver-options option. */
331 #define IMPORT_LOCAL_SIGS (1<<0)
332 #define IMPORT_REPAIR_PKS_SUBKEY_BUG (1<<1)
333 #define IMPORT_FAST (1<<2)
334 #define IMPORT_MERGE_ONLY (1<<4)
335 #define IMPORT_MINIMAL (1<<5)
336 #define IMPORT_CLEAN (1<<6)
337 #define IMPORT_NO_SECKEY (1<<7)
338 #define IMPORT_KEEP_OWNERTTRUST (1<<8)
340 #define EXPORT_LOCAL_SIGS (1<<0)
341 #define EXPORT_ATTRIBUTES (1<<1)
342 #define EXPORT_SENSITIVE_REVKEYS (1<<2)
343 #define EXPORT_RESET_SUBKEY_PASSWD (1<<3)
344 #define EXPORT_MINIMAL (1<<4)
345 #define EXPORT_CLEAN (1<<5)
346 #define EXPORT_DANE_FORMAT (1<<6)
348 #define LIST_SHOW_PHOTOS (1<<0)
349 #define LIST_SHOW_POLICY_URLS (1<<1)
350 #define LIST_SHOW_STD_NOTATIONS (1<<2)
351 #define LIST_SHOW_USER_NOTATIONS (1<<3)
352 #define LIST_SHOW_NOTATIONS (LIST_SHOW_STD_NOTATIONS|LIST_SHOW_USER_NOTATIONS)
353 #define LIST_SHOW_KEYSERVER_URLS (1<<4)
354 #define LIST_SHOW_UID_VALIDITY (1<<5)
355 #define LIST_SHOW_UNUSABLE_UIDS (1<<6)
356 #define LIST_SHOW_UNUSABLE_SUBKEYS (1<<7)
357 #define LIST_SHOW_KEYRING (1<<8)
358 #define LIST_SHOW_SIG_EXPIRE (1<<9)
359 #define LIST_SHOW_SIG_SUBPACKETS (1<<10)
360 #define LIST_SHOW_USAGE (1<<11)
362 #define VERIFY_SHOW_PHOTOS (1<<0)
363 #define VERIFY_SHOW_POLICY_URLS (1<<1)
364 #define VERIFY_SHOW_STD_NOTATIONS (1<<2)
365 #define VERIFY_SHOW_USER_NOTATIONS (1<<3)
366 #define VERIFY_SHOW_NOTATIONS (VERIFY_SHOW_STD_NOTATIONS|VERIFY_SHOW_USER_NOTATIONS)
367 #define VERIFY_SHOW_KEYSERVER_URLS (1<<4)
368 #define VERIFY_SHOW_UID_VALIDITY (1<<5)
369 #define VERIFY_SHOW_UNUSABLE_UIDS (1<<6)
370 #define VERIFY_PKA_LOOKUPS (1<<7)
371 #define VERIFY_PKA_TRUST_INCREASE (1<<8)
372 #define VERIFY_SHOW_PRIMARY_UID_ONLY (1<<9)
374 #define KEYSERVER_HTTP_PROXY (1<<0)
375 #define KEYSERVER_TIMEOUT (1<<1)
376 #define KEYSERVER_ADD_FAKE_V3 (1<<2)
377 #define KEYSERVER_AUTO_KEY_RETRIEVE (1<<3)
378 #define KEYSERVER_HONOR_KEYSERVER_URL (1<<4)
379 #define KEYSERVER_HONOR_PKA_RECORD (1<<5)
382 #endif /*G10_OPTIONS_H*/