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

Could two sha256 calculations happen in parallel? #8

Closed
jans23 opened this issue Jul 6, 2018 · 3 comments
Closed

Could two sha256 calculations happen in parallel? #8

jans23 opened this issue Jul 6, 2018 · 3 comments

Comments

@jans23
Copy link
Member

jans23 commented Jul 6, 2018

No description provided.

@szszszsz
Copy link
Member

szszszsz commented Jul 7, 2018

The main concern is, why these two identical implementations are separately supplied to the firmware:

When one was removed and calls redirected to other, the device has stopped accepting attestation key during SETUP phase: dc83516. It had to be reverted to make it work again: 51350a4, and the symbols were hidden to compilation unit scope via static: e27038d.

Either local state (given via SHA_FLAGS and SHA_HMAC_KEY) is not cleaned after one of the operations, or SHA calculations are done concurrently, one during another.

  • Pack state variables into structure and store separate copies in both compilation units.
  • Make u2f_sha functions work on created structure in object-like manner.
  • Remove duplicated code.
  • Investigate, why the implementation was doubled in the first place.

@szszszsz
Copy link
Member

There is a guess (CC @adamglozik) that compute_key_hash may be causing the issue.
See:

static void compute_key_hash(uint8_t * key, uint8_t * mask)

@szszszsz
Copy link
Member

Refactoring tasks moved to a separate issue.
Cause lied in a missed hardcoded slot number within compute_key_hash function.
Fix merged to master already. Closing.

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

No branches or pull requests

2 participants