mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-23 15:07:03 +01:00
scd: Support GET DATA response with no header for DO 0x00FA.
* scd/app-openpgp.c (do_getattr): Support Gnuk, as well. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
eba2563dab
commit
43bbc25b0f
@ -1256,36 +1256,39 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
|||||||
if (valuelen < 2)
|
if (valuelen < 2)
|
||||||
return gpg_error (GPG_ERR_INV_OBJ);
|
return gpg_error (GPG_ERR_INV_OBJ);
|
||||||
|
|
||||||
tag = *p++;
|
tag = p[0];
|
||||||
len = *p++;
|
len = p[1];
|
||||||
|
|
||||||
if (tag != 0x00FA)
|
/* Does it comes tag+len at the head? */
|
||||||
return gpg_error (GPG_ERR_INV_OBJ);
|
if (tag == 0x00FA)
|
||||||
|
|
||||||
if (len == 0x81)
|
|
||||||
{
|
{
|
||||||
if (valuelen < 3)
|
p += 2;
|
||||||
return gpg_error (GPG_ERR_INV_OBJ);
|
|
||||||
len = *p++;
|
|
||||||
}
|
|
||||||
else if (len == 0x82)
|
|
||||||
{
|
|
||||||
if (valuelen < 4)
|
|
||||||
return gpg_error (GPG_ERR_INV_OBJ);
|
|
||||||
len = *p++;
|
|
||||||
len = (len << 8) | *p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
valuelen -= (p - value);
|
if (len == 0x81)
|
||||||
value = p;
|
{
|
||||||
|
if (valuelen < 3)
|
||||||
|
return gpg_error (GPG_ERR_INV_OBJ);
|
||||||
|
len = *p++;
|
||||||
|
}
|
||||||
|
else if (len == 0x82)
|
||||||
|
{
|
||||||
|
if (valuelen < 4)
|
||||||
|
return gpg_error (GPG_ERR_INV_OBJ);
|
||||||
|
len = *p++;
|
||||||
|
len = (len << 8) | *p++;
|
||||||
|
}
|
||||||
|
|
||||||
if (valuelen != len)
|
valuelen -= (p - value);
|
||||||
{
|
value = (unsigned char *)p;
|
||||||
if (opt.verbose)
|
|
||||||
log_info ("Yubikey bug: length %zu != %zu", valuelen, len);
|
|
||||||
|
|
||||||
if (app->card->cardtype != CARDTYPE_YUBIKEY)
|
if (valuelen != len)
|
||||||
return gpg_error (GPG_ERR_INV_OBJ);
|
{
|
||||||
|
if (opt.verbose)
|
||||||
|
log_info ("Yubikey bug: length %zu != %zu", valuelen, len);
|
||||||
|
|
||||||
|
if (app->card->cardtype != CARDTYPE_YUBIKEY)
|
||||||
|
return gpg_error (GPG_ERR_INV_OBJ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; p < value + valuelen; p += len)
|
for (; p < value + valuelen; p += len)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user