mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-20 14:37:08 +01:00
scd: Fix for large ECC keys.
* scd/app-openpgp.c (do_decipher): Support larger length. -- Reported-by: Achim Pietig <achim@pietig.com> Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
7089dcc540
commit
827abe01a7
@ -4575,19 +4575,43 @@ do_decipher (app_t app, const char *keyidstr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fixuplen = 7;
|
n = 0;
|
||||||
|
if (indatalen < 128)
|
||||||
|
fixuplen = 7;
|
||||||
|
else
|
||||||
|
fixuplen = 10;
|
||||||
|
|
||||||
fixbuf = xtrymalloc (fixuplen + indatalen);
|
fixbuf = xtrymalloc (fixuplen + indatalen);
|
||||||
if (!fixbuf)
|
if (!fixbuf)
|
||||||
return gpg_error_from_syserror ();
|
return gpg_error_from_syserror ();
|
||||||
|
|
||||||
/* Build 'Cipher DO' */
|
/* Build 'Cipher DO' */
|
||||||
fixbuf[0] = '\xa6';
|
fixbuf[n++] = '\xa6';
|
||||||
fixbuf[1] = (char)(indatalen+5);
|
if (indatalen < 128)
|
||||||
fixbuf[2] = '\x7f';
|
fixbuf[n++] = (char)(indatalen+5);
|
||||||
fixbuf[3] = '\x49';
|
else
|
||||||
fixbuf[4] = (char)(indatalen+2);
|
{
|
||||||
fixbuf[5] = '\x86';
|
fixbuf[n++] = 0x81;
|
||||||
fixbuf[6] = (char)indatalen;
|
fixbuf[n++] = (char)(indatalen+7);
|
||||||
|
}
|
||||||
|
fixbuf[n++] = '\x7f';
|
||||||
|
fixbuf[n++] = '\x49';
|
||||||
|
if (indatalen < 128)
|
||||||
|
fixbuf[n++] = (char)(indatalen+2);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fixbuf[n++] = 0x81;
|
||||||
|
fixbuf[n++] = (char)(indatalen+3);
|
||||||
|
}
|
||||||
|
fixbuf[n++] = '\x86';
|
||||||
|
if (indatalen < 128)
|
||||||
|
fixbuf[n++] = (char)indatalen;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fixbuf[n++] = 0x81;
|
||||||
|
fixbuf[n++] = (char)indatalen;
|
||||||
|
}
|
||||||
|
|
||||||
if (old_format_len)
|
if (old_format_len)
|
||||||
{
|
{
|
||||||
memset (fixbuf+fixuplen, 0, 32 - old_format_len);
|
memset (fixbuf+fixuplen, 0, 32 - old_format_len);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user