Fixes problem with field values too long for one APDU

This commit is contained in:
Alexandre Paillier
2022-07-28 17:29:10 +02:00
parent fe13260140
commit 311c266084
3 changed files with 13 additions and 10 deletions

View File

@@ -383,5 +383,5 @@ def process_file(aclient: EthereumClient, input_file_path: str, filtering = Fals
return False
# sign
send_sign()
#send_sign()
return True

View File

@@ -113,8 +113,9 @@ class EthereumClientCmdBuilder:
data_w_length.append(len(data) & 0x00ff)
data_w_length += data
while len(data_w_length) > 0:
p1 = P1Type.PARTIAL_SEND if len(data_w_length) > 0xff else P1Type.COMPLETE_SEND
yield self._serialize(InsType.EIP712_SEND_STRUCT_IMPL,
P1Type.COMPLETE_SEND,
p1,
P2Type.STRUCT_FIELD,
data_w_length[:0xff])
data_w_length = data_w_length[0xff:]

View File

@@ -3,15 +3,16 @@ import fnmatch
from ethereum_client import EthereumClient
from eip712 import InputData
def test_eip712_legacy(app_client: EthereumClient):
bip32 = [
0x8000002c,
0x8000003c,
0x80000000,
0,
0
]
bip32 = [
0x8000002c,
0x8000003c,
0x80000000,
0,
0
]
def test_eip712_legacy(app_client: EthereumClient):
v, r, s = app_client.eip712_sign_legacy(
bip32,
bytes.fromhex('6137beb405d9ff777172aa879e33edb34a1460e701802746c5ef96e741710e59'),
@@ -32,4 +33,5 @@ def test_eip712_new(app_client: EthereumClient):
if fnmatch.fnmatch(file, "*-test.json"):
print(file.path)
InputData.process_file(app_client, file.path, False)
app_client.eip712_sign_new(bip32)
assert 1 == 1