aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2024-10-08 06:25:41 +0000
committerNIIBE Yutaka <[email protected]>2024-10-08 06:25:41 +0000
commit57dce1ee62c2b900b852877c1c9754126b87ed0f (patch)
tree59e06ebe2703c30d6026dea4f4bb6fa9f6e96e4b /g10
parentcommon,gpg,scd,sm: Use openpgp_oid_or_name_to_curve to get curve. (diff)
downloadgnupg-57dce1ee62c2b900b852877c1c9754126b87ed0f.tar.gz
gnupg-57dce1ee62c2b900b852877c1c9754126b87ed0f.zip
common,gpg,scd,sm: Fix for Curve25519 OID supporting new and old.
* common/util.h (openpgp_curve_to_oid): Add new argument to select OID by OpenPGP version. * common/openpgp-oid.c (openpgp_curve_to_oid): Implement returning selected OID for Curve25519. * common/openpgp-fpr.c (compute_openpgp_fpr_ecc): Follow the change, selecting by the version. * g10/export.c (match_curve_skey_pk): Likewise. (transfer_format_to_openpgp): Likewise. * g10/gpg.c (list_config): Likewise, print new OID. * g10/keygen.c (ecckey_from_sexp): Likewise, selecting by the version. * sm/encrypt.c (ecdh_encrypt): Likewise, don't care. * sm/minip12.c (build_ecc_key_sequence): Likewise, new OID. * scd/app-openpgp.c (ecdh_params, gen_challenge): Likewise, don't care. (ecc_read_pubkey, change_keyattr_from_string, ecc_writekey): Likewise, old OID. -- GnuPG-bug-id: 7316 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'g10')
-rw-r--r--g10/export.c4
-rw-r--r--g10/gpg.c2
-rw-r--r--g10/keygen.c5
3 files changed, 4 insertions, 7 deletions
diff --git a/g10/export.c b/g10/export.c
index 5d3ffffa4..2aafe8ee7 100644
--- a/g10/export.c
+++ b/g10/export.c
@@ -585,7 +585,7 @@ match_curve_skey_pk (gcry_sexp_t s_key, PKT_public_key *pk)
}
if (!strcmp (curve_str, "Ed448"))
is_eddsa = 1;
- oidstr = openpgp_curve_to_oid (curve_str, NULL, NULL);
+ oidstr = openpgp_curve_to_oid (curve_str, NULL, NULL, (pk->version > 4));
if (!oidstr)
{
log_error ("no OID known for curve '%s'\n", curve_str);
@@ -1280,7 +1280,7 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk)
goto leave;
}
- oidstr = openpgp_curve_to_oid (curve, NULL, NULL);
+ oidstr = openpgp_curve_to_oid (curve, NULL, NULL, (pk->version > 4));
if (!oidstr)
{
log_error ("no OID known for curve '%s'\n", curve);
diff --git a/g10/gpg.c b/g10/gpg.c
index d8b1051d5..694364b3d 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -1983,7 +1983,7 @@ list_config(char *items)
es_printf ("cfg:curveoid:");
for (iter=0, first=1; (s = openpgp_enum_curves (&iter)); first = 0)
{
- s = openpgp_curve_to_oid (s, NULL, NULL);
+ s = openpgp_curve_to_oid (s, NULL, NULL, 1);
es_printf ("%s%s", first?"":";", s? s:"[?]");
}
es_printf ("\n");
diff --git a/g10/keygen.c b/g10/keygen.c
index dafac87b6..81f03fdfb 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -1503,7 +1503,7 @@ ecckey_from_sexp (gcry_mpi_t *array, gcry_sexp_t sexp,
goto leave;
}
gcry_sexp_release (l2);
- oidstr = openpgp_curve_to_oid (curve, &nbits, NULL);
+ oidstr = openpgp_curve_to_oid (curve, &nbits, NULL, pkversion > 4);
if (!oidstr)
{
/* That can't happen because we used one of the curves
@@ -1511,9 +1511,6 @@ ecckey_from_sexp (gcry_mpi_t *array, gcry_sexp_t sexp,
err = gpg_error (GPG_ERR_INV_OBJ);
goto leave;
}
- /* For v5 keys we prefer the modern OID for cv25519. */
- if (pkversion > 4 && !strcmp (oidstr, "1.3.6.1.4.1.3029.1.5.1"))
- oidstr = "1.3.101.110";
err = openpgp_oid_from_str (oidstr, &array[0]);
if (err)