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

[capture] Remove redundant key write #157

Merged
merged 1 commit into from
Sep 20, 2023
Merged

Conversation

vrozic
Copy link
Contributor

@vrozic vrozic commented Sep 18, 2023

Writing key at the begining of capture_kmac_random() is redundant because cw.capture_trace() will send the key on every run.

Writing key at the begining of `capture_kmac_random()` is
redundant because `cw.capture_trace()` will send the key on
every run.

Signed-off-by: Vladimir Rozic <[email protected]>
@vrozic vrozic requested review from wettermo and removed request for alphan September 18, 2023 15:32
@@ -892,7 +892,6 @@ def capture_kmac_random(ot, ktp):
"""
key, _ = ktp.next()
tqdm.write(f'Using key: {binascii.b2a_hex(bytes(key))}')
ot.target.simpleserial_write('k', key)
while True:
_, text = ktp.next()
ret = cw.capture_trace(ot.scope, ot.target, text, key, ack=False, as_int=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, makes sense and LGTM!
But how does cw.capture_trace actually send key/text to the device? Also via simpleserial_write()? And how is this handled in kmac_serial.c?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly how it works. capture_trace() uses method set_key() under the hood, which uses simpleserial_write('k', key).
On the kmac_serial.c side, I think that it was just executing the 'k' command twice writing the same key value.
It wasn't slowing down capture by much, but it was still unnecessary.

@vrozic vrozic merged commit e4e5bc8 into lowRISC:master Sep 20, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants