[PATCH] scd: Increase ECC private key template size

NIIBE Yutaka gniibe at fsij.org
Mon Oct 17 05:16:27 CEST 2016


Hello,

On 10/14/2016 06:26 PM, Arnaud Fontaine wrote:
> * scd/app-openpgp.c: The encoded template size is two bytes long when
> both private and public keys are included and the curve has large
> coordinates.

Thanks for your patch.  Please send us Developer's Certificate of
Origin (DCO).  It is needed so that everyone can check the origin of
code.  It is explained in gnupg/doc/HACKING at the section of "License
policy".

Meanwhile, I reviewed.  And the commit is the following.

========================================
scd: Fix keytocard for ECC.

* scd/app-openpgp.c (build_ecc_privkey_template): Size can be greater
than 128 when it comes with public key for curve of larger field.

--

Reported-by: Arnaud Fontaine <arnaud.fontaine at ssi.gouv.fr>
Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

1 file changed, 2 insertions(+)
scd/app-openpgp.c | 2 ++

modified   scd/app-openpgp.c
@@ -2689,6 +2689,8 @@ build_ecc_privkey_template (app_t app, int keyno,
                    + privkey_len
                    + suffix_len
                    + datalen);
+  if (exthdr_len + privkey_len + suffix_len + datalen >= 128)
+    template_size++;
   tp = template = xtrymalloc_secure (template_size);
   if (!template)
     return gpg_error_from_syserror ();

-- 



More information about the Gnupg-devel mailing list