work around GET DATA transmission over T=1

This commit is contained in:
Michele Balistreri 2022-08-04 11:16:03 +02:00
parent 4a832e606b
commit 5e261398ed
2 changed files with 3 additions and 14 deletions

View File

@ -18,7 +18,6 @@ type Command struct {
Data []byte
le uint8
requiresLe bool
requiresLc bool
}
// NewCommand returns a new apdu Command.
@ -30,7 +29,6 @@ func NewCommand(cla, ins, p1, p2 uint8, data []byte) *Command {
P2: p2,
Data: data,
requiresLe: false,
requiresLc: false,
}
}
@ -40,10 +38,6 @@ func (c *Command) SetLe(le uint8) {
c.le = le
}
func (c *Command) RequiresLc() {
c.requiresLc = true
}
// Le returns if Le is set and its value.
func (c *Command) Le() (bool, uint8) {
return c.requiresLe, c.le
@ -69,7 +63,7 @@ func (c *Command) Serialize() ([]byte, error) {
return nil, err
}
if (len(c.Data) > 0) || c.requiresLc {
if len(c.Data) > 0 {
if err := binary.Write(buf, binary.BigEndian, uint8(len(c.Data))); err != nil {
return nil, err
}

View File

@ -340,18 +340,13 @@ func NewCommandSign(data []byte, p1 uint8, pathStr string) (*apdu.Command, error
}
func NewCommandGetData(typ uint8) *apdu.Command {
cmd := apdu.NewCommand(
return apdu.NewCommand(
globalplatform.ClaGp,
InsGetData,
typ,
0,
[]byte{},
[]byte{0xCA},
)
cmd.SetLe(0)
cmd.RequiresLc()
return cmd
}
func NewCommandStoreData(typ uint8, data []byte) *apdu.Command {