summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2024-10-07 09:59:26 +0200
committerWerner Koch <wk@gnupg.org>2024-10-07 09:59:26 +0200
commitb287fb577587655559fefb90f7ed90c9a15dc6a3 (patch)
tree774d9420bb52c659c230c283d474c1634ff1dcf7 /common
parentgpg: Emit status error for an invalid ADSK. (diff)
downloadgnupg2-b287fb577587655559fefb90f7ed90c9a15dc6a3.tar.xz
gnupg2-b287fb577587655559fefb90f7ed90c9a15dc6a3.zip
Implement GNUPG_ASSUME_COMPLIANCE envvar for testing
* common/compliance.c (assumed_de_vs_compliance): New. (get_compliance_cache): Check envvar and fake compliance. (gnupg_status_compliance_flag): Return 2023 for de-vs if in faked mode. * g10/gpg.c (gpgconf_list): For compliance_de_vs return 23 or 2023. -- The user visible changes are that GNUPG_ASSUME_COMPLIANCE=de-vs gpgconf --list-options gpg \ | awk -F: '$1=="compliance_de_vs" {print $8}' returns 2023 if "compliance de-vs" is found in gpg.conf. If eventually the software is arpproved the returned value will be 23 and not 1 as it was before. Consumers should check whether they see value of true (Kleopatra does this right now) and also check whether the value is > 2000 and in this case print a beta/non-approved warning. The envvar is currently used to assume that the underlying libgcrypt is compliant and approved. This is not yet the case but eventually libgcrypt will announce this itself and from then on the envvar is not anymore required for testing.
Diffstat (limited to 'common')
-rw-r--r--common/compliance.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/common/compliance.c b/common/compliance.c
index d421b0371..faea384d9 100644
--- a/common/compliance.c
+++ b/common/compliance.c
@@ -40,6 +40,11 @@
static int initialized;
static int module;
+
+/* The next variable and the code in get_compliance_cache should be
+ * removed after the software suite has been approved. */
+static int assumed_de_vs_compliance = -1;
+
/* This value is used by DSA and RSA checks in addition to the hard
* coded length checks. It allows one to increase the required key length
* using a config file. */
@@ -70,6 +75,19 @@ get_compliance_cache (enum gnupg_compliance_mode compliance, int for_rng)
case CO_DE_VS: ptr = for_rng? &r_de_vs : &s_de_vs ; break;
}
+ /* Remove this code after approval. */
+ if (ptr && compliance == CO_DE_VS)
+ {
+ if (assumed_de_vs_compliance == -1)
+ {
+ const char *s = getenv ("GNUPG_ASSUME_COMPLIANCE");
+ assumed_de_vs_compliance = (s && !strcmp (s, "de-vs"));
+ }
+ if (assumed_de_vs_compliance)
+ *ptr = 1;
+ }
+
+
return ptr;
}
@@ -667,7 +685,7 @@ gnupg_status_compliance_flag (enum gnupg_compliance_mode compliance)
case CO_PGP8:
log_assert (!"no status code assigned for this compliance mode");
case CO_DE_VS:
- return "23";
+ return assumed_de_vs_compliance ? "2023" : "23";
}
log_assert (!"invalid compliance mode");
}