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

Remainders of NXP HSM operation must be cleaned-up #20036

Closed
tcarmelveilleux opened this issue Jun 28, 2022 · 1 comment · Fixed by #21667
Closed

Remainders of NXP HSM operation must be cleaned-up #20036

tcarmelveilleux opened this issue Jun 28, 2022 · 1 comment · Fixed by #21667

Comments

@tcarmelveilleux
Copy link
Contributor

Problem

NXP's HSM implementation never worked in a way that properly handled AddNOC/UpdateNOC and that assumed a single pending CASE session establishment is a forever constraint.

Since the appearance of the OperationalKeystore interface, it should be feasible to properly support the lifecycle of keys.

However, there are still code paths that enshrine direct steering of HSM logic for CASE ephemeral keypair, which is what keeps the CASE establishment constraint.

Proposed Solution

  • Add a mechanism to OperationalKeystore to allocate ephemeral keypairs
  • Remove HSM-specific code paths
  • Integrate the HSM-based keypair management in an implementation of OperationalKeystore
@tcarmelveilleux tcarmelveilleux self-assigned this Jun 28, 2022
tcarmelveilleux added a commit to tcarmelveilleux/connectedhomeip that referenced this issue Jun 28, 2022
- CASE requires P256 ephemeral keys
- CASE had a hack whereby "single slots" ephemeral keys
  for NXP HSM were used, which cannot work for multiple CASE
  session establishments
- Using raw P256Keypair prevents being able to use OS-backed
  or HW-backed keys, like can be done for operational keys

Issue project-chip#20036

This PR:

- Adds a way to get CASE ephemeral keys from the OperationalKeystore
  abstraction
- Funnels their access via the FabricTable
- Removes some HSM hacks (cannot remove all HSM usage just yet)
  in a way that now OperationalKeystore targeting NXP HSM could
  do the right thing

Testing done:

- Unit tests still pass
- Integration tests still passa
- Added unit tests to validate usage of new APIs
- Ran valgrind on the unit tests, found no leaks
tcarmelveilleux added a commit that referenced this issue Jun 29, 2022
* Add ephemeral key allocator to FabricTable

- CASE requires P256 ephemeral keys
- CASE had a hack whereby "single slots" ephemeral keys
  for NXP HSM were used, which cannot work for multiple CASE
  session establishments
- Using raw P256Keypair prevents being able to use OS-backed
  or HW-backed keys, like can be done for operational keys

Issue #20036

This PR:

- Adds a way to get CASE ephemeral keys from the OperationalKeystore
  abstraction
- Funnels their access via the FabricTable
- Removes some HSM hacks (cannot remove all HSM usage just yet)
  in a way that now OperationalKeystore targeting NXP HSM could
  do the right thing

Testing done:

- Unit tests still pass
- Integration tests still passa
- Added unit tests to validate usage of new APIs
- Ran valgrind on the unit tests, found no leaks

* Restyled by clang-format

* Apply review comments

* Apply review comment from @bzbarsky-apple

* Better document usage

* Remove a test member that was added during debug of a prior CI run

Co-authored-by: Restyled.io <commits@restyled.io>
@tcarmelveilleux tcarmelveilleux removed their assignment Jul 20, 2022
@tcarmelveilleux
Copy link
Contributor Author

Assigned to @sujaygkulkarni-nxp

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

Successfully merging a pull request may close this issue.

1 participant