Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cond_unlock for keys that do not fit in a single unlock message #160

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.21.9
current_version = 0.21.10
commit = True
tag = False

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies = [
"traitlets>=5.9.0",
]
name = "pyxcp"
version = "0.21.9"
version = "0.21.10"
readme = "README.md"
description = "Universal Calibration Protocol for Python"
keywords = ["automotive", "ecu", "xcp", "asam", "autosar"]
Expand Down
2 changes: 1 addition & 1 deletion pyxcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
from .transport import Usb

# if you update this manually, do not forget to update .bumpversion.cfg and pyproject.toml
__version__ = "0.21.9"
__version__ = "0.21.10"
18 changes: 9 additions & 9 deletions pyxcp/master/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -1790,12 +1790,13 @@ def cond_unlock(self, resources=None):
length = result.length
if length == 0:
continue
if length > MAX_PAYLOAD:
remaining = length - len(seed)
while remaining > 0:
result = self.getSeed(types.XcpGetSeedMode.REMAINING, resource_value)
seed.extend(list(result.seed))
remaining = result.length

while length - len(seed) > 0:
result = self.getSeed(types.XcpGetSeedMode.REMAINING, resource_value)
seed.extend(list(result.seed))

seed = seed[: length] # maybe there are some padding bytes

result, key = getKey(
self.logger,
self.seedNKeyDLL,
Expand All @@ -1809,9 +1810,8 @@ def cond_unlock(self, resources=None):
offset = 0
while offset < total_length:
data = key[offset : offset + MAX_PAYLOAD]
key_length = len(data)
offset += key_length
self.unlock(key_length, data)
self.unlock(total_length-offset, data)
offset += len(data)
else:
raise SeedNKeyError("SeedAndKey DLL returned: {}".format(SeedNKeyResult(result).name))

Expand Down
Loading