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

ktp.next() for keys #116

Open
m-temp opened this issue Jan 30, 2023 · 3 comments
Open

ktp.next() for keys #116

m-temp opened this issue Jan 30, 2023 · 3 comments
Labels

Comments

@m-temp
Copy link
Collaborator

m-temp commented Jan 30, 2023

As discussed in #115 and https://docs.google.com/document/d/1sZjASiUji_IT-t9jEFlK-kGc_Gw3mGfubNvpkM_IQT4/edit#heading=h.qd65x0y76b0e we should check the usage of key, text = ktp.next() in cw/capture.py

Default behavior is that ktp.next() returns const_key, random_plaintext. This default behavior can be changed with ctx.obj.ktp.fixed_key = False.

Afaik, we call ktp.next()[0] only once per function and use only the first call of the iterator to assign a constant key. For random keys we use ktp.next()[1]. Thus, I think we ware fine and can change the default behavior, but we should double check that and read the spec if the first call of the iterator still outputs a deterministic value. On the other hand, if we really rely on a constant non random value, we should use a constant and not a constant iterator.

m-temp added a commit to m-temp/ot-sca that referenced this issue Jan 30, 2023
m-temp added a commit to m-temp/ot-sca that referenced this issue Jan 30, 2023
m-temp added a commit to m-temp/ot-sca that referenced this issue Feb 10, 2023
@m-temp
Copy link
Collaborator Author

m-temp commented Feb 24, 2023

backlog: With ctx.obj.ktp.fixed_key = False the internal lfsr is iterated twice per ktp.next(). This must be taken into account when using the batch-mode and thus, the lfsr on device side.

Possible solutions:

  • perform a dummy iteration on the device
  • use ktp.next_key() and ktp.next_text() instead of ktp.next()[0] and ktp.next()[1]

m-temp added a commit to m-temp/ot-sca that referenced this issue Feb 27, 2023
m-temp added a commit to m-temp/ot-sca that referenced this issue Feb 28, 2023
m-temp added a commit to m-temp/ot-sca that referenced this issue Feb 28, 2023
m-temp added a commit to m-temp/ot-sca that referenced this issue Feb 28, 2023
m-temp added a commit that referenced this issue Feb 28, 2023
Signed-off-by: Michael Tempelmeier <[email protected]>
m-temp added a commit to m-temp/ot-sca that referenced this issue Mar 2, 2023
m-temp added a commit to m-temp/opentitan that referenced this issue Mar 2, 2023
For more details see lowRISC/ot-sca#116

Signed-off-by: Michael Tempelmeier <[email protected]>
@m-temp m-temp added the good first issue Good for newcomers label Mar 3, 2023
@m-temp
Copy link
Collaborator Author

m-temp commented Mar 3, 2023

For otbn we are using the second solution. See lowRISC/opentitan#17416 and #128 It's running smoothly, while the dummy iteration on the device creates a significant overhead.

@johannheyszl
Copy link
Collaborator

The behaviour/use of the host-side PRNG is hard to understand for reasons described here.

Latest host-side batch capture implementation: #197
Does not use ktp.next().

PRNG likely replaced in future, hence deprioritizing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants