1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

common,gpg,scd,sm: Use openpgp_oid_or_name_to_curve to get curve.

* common/sexputil.c (pubkey_algo_string): Use
openpgp_oid_or_name_to_curve.
* g10/card-util.c (current_card_status, ask_card_keyattr): Likewise.
* scd/app-piv.c (writekey_ecc): Likewise.
* sm/fingerprint.c (gpgsm_get_key_algo_info): Likewise.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2024-10-08 14:48:47 +09:00
parent b287fb5775
commit f5703994d4
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
4 changed files with 5 additions and 16 deletions

View File

@ -1104,8 +1104,7 @@ pubkey_algo_string (gcry_sexp_t s_pkey, enum gcry_pk_algos *r_algoid)
else if (prefix) else if (prefix)
{ {
const char *curve = gcry_pk_get_curve (s_pkey, 0, NULL); const char *curve = gcry_pk_get_curve (s_pkey, 0, NULL);
const char *name = openpgp_oid_to_curve const char *name = openpgp_oid_or_name_to_curve (curve, 0);
(openpgp_curve_to_oid (curve, NULL, NULL), 0);
if (name) if (name)
result = xtrystrdup (name); result = xtrystrdup (name);

View File

@ -631,13 +631,7 @@ current_card_status (ctrl_t ctrl, estream_t fp,
const char *curve_for_print = "?"; const char *curve_for_print = "?";
if (info.key_attr[i].curve) if (info.key_attr[i].curve)
{ curve_for_print = openpgp_oid_or_name_to_curve (info.key_attr[i].curve, 0);
const char *oid;
oid = openpgp_curve_to_oid (info.key_attr[i].curve,
NULL, NULL);
if (oid)
curve_for_print = openpgp_oid_to_curve (oid, 0);
}
tty_fprintf (fp, " %s", curve_for_print); tty_fprintf (fp, " %s", curve_for_print);
} }
tty_fprintf (fp, "\n"); tty_fprintf (fp, "\n");
@ -1524,7 +1518,6 @@ ask_card_keyattr (int keyno, const struct key_attr *current)
else else
{ {
const char *curve; const char *curve;
const char *oid_str;
if (current->algo == PUBKEY_ALGO_RSA) if (current->algo == PUBKEY_ALGO_RSA)
{ {
@ -1545,8 +1538,7 @@ ask_card_keyattr (int keyno, const struct key_attr *current)
if (curve) if (curve)
{ {
key_attr->algo = algo; key_attr->algo = algo;
oid_str = openpgp_curve_to_oid (curve, NULL, NULL); key_attr->curve = openpgp_oid_or_name_to_curve (curve, 0);
key_attr->curve = openpgp_oid_to_curve (oid_str, 0);
} }
else else
{ {

View File

@ -2882,8 +2882,7 @@ writekey_ecc (app_t app, data_object_t dobj, int keyref,
* functions here because Libgcrypt has no generic curve * functions here because Libgcrypt has no generic curve
* alias lookup feature and the PIV supported curves are * alias lookup feature and the PIV supported curves are
* also supported by OpenPGP. */ * also supported by OpenPGP. */
xname = openpgp_oid_to_curve (openpgp_curve_to_oid (name, NULL, NULL), xname = openpgp_oid_or_name_to_curve (name, 0);
0);
xfree (name); xfree (name);
if (xname && !strcmp (xname, "nistp256")) if (xname && !strcmp (xname, "nistp256"))

View File

@ -268,8 +268,7 @@ gpgsm_get_key_algo_info (ksba_cert_t cert, unsigned int *nbits, char **r_curve)
curve = gcry_pk_get_curve (l1, 0, NULL); curve = gcry_pk_get_curve (l1, 0, NULL);
if (curve) if (curve)
{ {
name = openpgp_oid_to_curve (openpgp_curve_to_oid (curve, name = openpgp_oid_or_name_to_curve (curve, 0);
NULL, NULL), 0);
*r_curve = xtrystrdup (name? name : curve); *r_curve = xtrystrdup (name? name : curve);
if (!*r_curve) if (!*r_curve)
{ {