aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-10-31 14:01:24 +0000
committerWerner Koch <[email protected]>2022-10-31 15:20:22 +0000
commit4a9f3f94c6d10928ec3bb4b7a013c3b37c5e00d7 (patch)
tree9b1f33df7d7a706b38e5eac4a2763ddd9bf156fb
parentgpg: Support OCB encryption. (diff)
downloadgnupg-4a9f3f94c6d10928ec3bb4b7a013c3b37c5e00d7.tar.gz
gnupg-4a9f3f94c6d10928ec3bb4b7a013c3b37c5e00d7.zip
gpg: New option --compatibility-flags
* g10/gpg.c (oCompatibilityFlags): New. (opts): Add option. (compatibility_flags): New list. (main): Set flags and print help. * g10/options.h (opt): Add field compatibility_flags. -- No flags are yet defined but it is good to have the framework.
-rw-r--r--doc/gpg.texi8
-rw-r--r--g10/gpg.c20
-rw-r--r--g10/options.h8
3 files changed, 35 insertions, 1 deletions
diff --git a/doc/gpg.texi b/doc/gpg.texi
index 6446f31bd..1969496a8 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -2936,6 +2936,14 @@ therefore enables a fast listing of the encryption keys.
@opindex interactive
Prompt before overwriting any files.
+@item --compatibility-flags @var{flags}
+@opindex compatibility-flags
+Set compatibility flags to work around problems due to non-compliant
+keys or data. The @var{flags} are given as a comma separated
+list of flag names and are OR-ed together. The special flag "none"
+clears the list and allows to start over with an empty list. To get a
+list of available flags the sole word "help" can be used.
+
@item --debug-level @var{level}
@opindex debug-level
Select the debug level for investigating problems. @var{level} may be
diff --git a/g10/gpg.c b/g10/gpg.c
index cd40cf376..12770987c 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -432,6 +432,7 @@ enum cmd_and_opt_values
oForceSignKey,
oForbidGenKey,
oRequireCompliance,
+ oCompatibilityFlags,
oNoop
};
@@ -896,6 +897,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_n (oNoAutostart, "no-autostart", "@"),
ARGPARSE_s_n (oForbidGenKey, "forbid-gen-key", "@"),
ARGPARSE_s_n (oRequireCompliance, "require-compliance", "@"),
+ ARGPARSE_s_s (oCompatibilityFlags, "compatibility-flags", "@"),
/* Options which can be used in special circumstances. They are not
* published and we hope they are never required. */
ARGPARSE_s_n (oUseOnlyOpenPGPCard, "use-only-openpgp-card", "@"),
@@ -988,6 +990,13 @@ static struct debug_flags_s debug_flags [] =
};
+/* The list of compatibility flags. */
+static struct compatibility_flags_s compatibility_flags [] =
+ {
+ { 0, NULL }
+ };
+
+
#ifdef ENABLE_SELINUX_HACKS
#define ALWAYS_ADD_KEYRINGS 1
#else
@@ -2738,6 +2747,15 @@ main (int argc, char **argv)
case oDebugIOLBF: break; /* Already set in pre-parse step. */
+ case oCompatibilityFlags:
+ if (parse_compatibility_flags (pargs.r.ret_str, &opt.compat_flags,
+ compatibility_flags))
+ {
+ pargs.r_opt = ARGPARSE_INVALID_ARG;
+ pargs.err = ARGPARSE_PRINT_ERROR;
+ }
+ break;
+
case oStatusFD:
set_status_fd ( translate_sys2libc_fd_int (pargs.r.ret_int, 1) );
break;
@@ -3776,6 +3794,8 @@ main (int argc, char **argv)
}
set_debug (debug_level);
+ if (opt.verbose) /* Print the compatibility flags. */
+ parse_compatibility_flags (NULL, &opt.compat_flags, compatibility_flags);
gnupg_set_compliance_extra_info (opt.min_rsa_length);
if (DBG_CLOCK)
log_clock ("start");
diff --git a/g10/options.h b/g10/options.h
index e631b83c1..351e18b0b 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -291,6 +291,9 @@ struct
int only_sign_text_ids;
int no_symkey_cache; /* Disable the cache used for --symmetric. */
+
+ /* Compatibility flags (COMPAT_FLAG_xxxx). */
+ unsigned int compat_flags;
} opt;
/* CTRL is used to keep some global variables we currently can't
@@ -347,8 +350,11 @@ struct {
EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode;
EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
+/* Compatibility flags */
+/* #define COMPAT_FOO 1 */
+
-/* Compatibility flags. */
+/* Compliance test macors. */
#define GNUPG (opt.compliance==CO_GNUPG || opt.compliance==CO_DE_VS)
#define RFC2440 (opt.compliance==CO_RFC2440)
#define RFC4880 (opt.compliance==CO_RFC4880)