aboutsummaryrefslogtreecommitdiffstats
path: root/common/openpgp-oid.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2015-08-06 07:44:03 +0000
committerNIIBE Yutaka <[email protected]>2015-08-06 07:51:14 +0000
commita6e40530898622fbc5d76557a7da5e69368ecaa4 (patch)
tree8af5b8614faee43779d970cb63a14734416953d7 /common/openpgp-oid.c
parentscd: Fix ecc_oid. (diff)
downloadgnupg-a6e40530898622fbc5d76557a7da5e69368ecaa4.tar.gz
gnupg-a6e40530898622fbc5d76557a7da5e69368ecaa4.zip
common: extend API of openpgp_oid_to_curve for canonical name.
* common/openpgp-oid.c (openpgp_oid_to_curve): Add CANON argument. * common/util.h: Update. * g10/import.c (transfer_secret_keys): Follow the change. * g10/keyid.c (pubkey_string): Likewise. * g10/keylist.c (list_keyblock_print, list_keyblock_colon): Likewise. * parse-packet.c (parse_key): Likewise. * scd/app-openpgp.c (send_key_attr, get_public_key): Likewise. -- Change the function so that caller can select canonical name of curve or name for printing. Suggested by wk.
Diffstat (limited to 'common/openpgp-oid.c')
-rw-r--r--common/openpgp-oid.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/openpgp-oid.c b/common/openpgp-oid.c
index 676079cde..af91bb1aa 100644
--- a/common/openpgp-oid.c
+++ b/common/openpgp-oid.c
@@ -333,10 +333,10 @@ openpgp_curve_to_oid (const char *name, unsigned int *r_nbits)
/* Map an OpenPGP OID to the Libgcrypt curve NAME. Returns NULL for
- unknown curve names. We prefer an alias name here which is more
- suitable for printing. */
+ unknown curve names. Unless CANON is set we prefer an alias name
+ here which is more suitable for printing. */
const char *
-openpgp_oid_to_curve (const char *oidstr)
+openpgp_oid_to_curve (const char *oidstr, int canon)
{
int i;
@@ -345,7 +345,7 @@ openpgp_oid_to_curve (const char *oidstr)
for (i=0; oidtable[i].name; i++)
if (!strcmp (oidtable[i].oidstr, oidstr))
- return oidtable[i].alias? oidtable[i].alias : oidtable[i].name;
+ return !canon && oidtable[i].alias? oidtable[i].alias : oidtable[i].name;
return NULL;
}