[TESTING] Curve25519 encryption support (update-2)

Werner Koch wk at gnupg.org
Wed Aug 5 08:40:41 CEST 2015


On Wed,  5 Aug 2015 02:13, gniibe at fsij.org said:

> Note that I need to remove an alias of "Ed25519" in
> common/openpgp-oid.c, since it's not compatible to libgcrypt.
[...]
> --- a/common/openpgp-oid.c
> +++ b/common/openpgp-oid.c
> @@ -45,7 +45,8 @@ static struct {
>    const char *alias;  /* NULL or alternative name of the curve.  */
>  } oidtable[] = {
>
> -  { "Ed25519",         "1.3.6.1.4.1.11591.15.1", 255, "ed25519" },
> +  { "Curve25519",      "1.3.6.1.4.1.3029.1.5.1", 255 },
> +  { "Ed25519",         "1.3.6.1.4.1.11591.15.1", 255 },

Without the alias we change how we print such a key: Now it is

  sec   ed25519/E3FDFF218E45B72B 2015-02-18 [expires: 2025-02-15]

but with the change this will be

  sec   Ed25519/E3FDFF218E45B72B 2015-02-18 [expires: 2025-02-15]

(see g10/keyid.c:pubkey_string) I'd very much like to have the
algo/curve in lowercase.  And while we are at it

  sec   Curve25519/...

is quite long.  What about having an alias

  sec   crv25519/...

to shorten this.  I expect that this will eventully be the standard key
and thus a shorter description for the common case would be nicer.

What about 

 /* 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;
 }

and changing all callers which pass the name to Libgcrypt to set CANON?
(Or maybe FOR_PRINT instead of CANON and revert the logic)


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-devel mailing list