scd: Fix for EdDSA

NIIBE Yutaka gniibe at fsij.org
Fri Dec 5 09:50:39 CET 2014


Fix for NIST P-256 curve has been pushed.

On 12/05/2014 04:46 PM, Werner Koch wrote:
> Sure, your gnuk is the only ECC implementation anyway and thus you
> should know best.

Thank you.  I should, yes.  But I am keeping up changes of GnuPG
2.1.0, now.  I need to fix ECC related code of scdaemon.

Well, here is another change needed to support EdDSA.

It works with experimental version of Gnuk.  It takes about 0.29
second to sign.  It's a bit slower than NIST P-256, but I guess that
people want to use this than NIST P-256.

diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index e27a2cb..663b7d3 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -752,7 +752,7 @@ get_algo_byte (key_type_t key_type)
   else if (key_type == KEY_TYPE_ECDH)
     return 18;
   else if (key_type == KEY_TYPE_EDDSA)
-    return 105;                 /* (experimental) */
+    return 22;
   else
     return 1;  /* RSA */
 }
@@ -790,8 +790,10 @@ store_fpr (app_t app, int keynumber, u32 timestamp,
     {
       m[i] = va_arg (ap, const unsigned char *);
       mlen[i] = va_arg (ap, size_t);
-      for (; mlen[i] && !*m[i]; mlen[i]--, m[i]++) /* strip leading zeroes */
-        ;
+      if (key_type != KEY_TYPE_EDDSA)
+        /* strip off leading zeroes */
+        for (; mlen[i] && !*m[i]; mlen[i]--, m[i]++)
+          ;
       if (key_type == KEY_TYPE_RSA || i == 1)
         n += 2;
       n += mlen[i];
-- 



More information about the Gnupg-devel mailing list