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@ssi.gouv.fr>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2016-10-17 12:02:28 +09:00
parent 70a8584ec4
commit 25428be521
1 changed files with 2 additions and 0 deletions

View File

@ -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 ();