aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--common/compliance.c13
-rw-r--r--common/compliance.h1
-rw-r--r--sm/decrypt.c3
-rw-r--r--sm/sign.c4
-rw-r--r--sm/verify.c1
6 files changed, 19 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 7f6162cbb..889aff8e1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
Noteworthy changes in version 2.4.4 (unreleased)
------------------------------------------------
+ * gpgsm: Support ECDSA in de-vs compliance mode. [T6802]
+
* Fix garbled time output in non-English Windows. [T6741]
Release-info: https://dev.gnupg.org/T6578
diff --git a/common/compliance.c b/common/compliance.c
index 59d94038d..04978ed1b 100644
--- a/common/compliance.c
+++ b/common/compliance.c
@@ -256,6 +256,13 @@ gnupg_pk_is_allowed (enum gnupg_compliance_mode compliance,
if (! initialized)
return 1;
+ /* Map the the generic ECC algo to ECDSA if requested. */
+ if ((algo_flags & PK_ALGO_FLAG_ECC18)
+ && algo == GCRY_PK_ECC
+ && (use == PK_USE_VERIFICATION
+ || use == PK_USE_SIGNING))
+ algo = GCRY_PK_ECDSA;
+
switch (compliance)
{
case CO_DE_VS:
@@ -280,7 +287,6 @@ gnupg_pk_is_allowed (enum gnupg_compliance_mode compliance,
default:
log_assert (!"reached");
}
- (void)algo_flags;
break;
case PUBKEY_ALGO_DSA:
@@ -301,7 +307,7 @@ gnupg_pk_is_allowed (enum gnupg_compliance_mode compliance,
result = (use == PK_USE_DECRYPTION);
break;
- case PUBKEY_ALGO_ECDH:
+ case PUBKEY_ALGO_ECDH: /* Same value as GCRY_PK_ECC, i.e. 18 */
case GCRY_PK_ECDH:
if (use == PK_USE_DECRYPTION)
result = 1;
@@ -549,6 +555,9 @@ gnupg_rng_is_compliant (enum gnupg_compliance_mode compliance)
int *result;
int res;
+ /* #warning debug code ahead */
+ /* return 1; */
+
result = get_compliance_cache (compliance, 1);
if (result && *result != -1)
diff --git a/common/compliance.h b/common/compliance.h
index ead11472c..111fdc74b 100644
--- a/common/compliance.h
+++ b/common/compliance.h
@@ -50,6 +50,7 @@ enum pk_use_case
/* Flags to distinguish public key algorithm variants. */
#define PK_ALGO_FLAG_RSAPSS 1 /* Use rsaPSS padding. */
+#define PK_ALGO_FLAG_ECC18 256 /* GCRY_PK_ECC is used in a generic way. */
int gnupg_pk_is_compliant (enum gnupg_compliance_mode compliance, int algo,
diff --git a/sm/decrypt.c b/sm/decrypt.c
index 787e2f5e6..6d63189b8 100644
--- a/sm/decrypt.c
+++ b/sm/decrypt.c
@@ -1318,7 +1318,8 @@ gpgsm_decrypt (ctrl_t ctrl, int in_fd, estream_t out_fp)
/* Check compliance. */
if (!gnupg_pk_is_allowed (opt.compliance,
PK_USE_DECRYPTION,
- pk_algo, 0, NULL, nbits, curve))
+ pk_algo, PK_ALGO_FLAG_ECC18,
+ NULL, nbits, curve))
{
char kidstr[10+1];
diff --git a/sm/sign.c b/sm/sign.c
index cd0ddceb3..3e8f26cbd 100644
--- a/sm/sign.c
+++ b/sm/sign.c
@@ -835,8 +835,8 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
goto leave;
}
- if (!gnupg_pk_is_allowed (opt.compliance, PK_USE_SIGNING, pk_algo, 0,
- NULL, nbits, curve))
+ if (!gnupg_pk_is_allowed (opt.compliance, PK_USE_SIGNING, pk_algo,
+ PK_ALGO_FLAG_ECC18, NULL, nbits, curve))
{
char kidstr[10+1];
diff --git a/sm/verify.c b/sm/verify.c
index 1f5c1d378..e83a24f44 100644
--- a/sm/verify.c
+++ b/sm/verify.c
@@ -503,6 +503,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp)
audit_log_i (ctrl->audit, AUDIT_DATA_HASH_ALGO, algo);
/* Check compliance. */
+ pkalgoflags |= PK_ALGO_FLAG_ECC18;
if (! gnupg_pk_is_allowed (opt.compliance, PK_USE_VERIFICATION,
pkalgo, pkalgoflags, NULL, nbits, pkcurve))
{