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

Add HAP Crypto to src/crypto #243

Merged
merged 5 commits into from
Apr 6, 2020
Merged

Add HAP Crypto to src/crypto #243

merged 5 commits into from
Apr 6, 2020

Conversation

bhaskar-apple
Copy link
Contributor

Problem

No APIs to support symmetric key based payload encryption available in CHIP

Summary of Changes

Adds new files from HAP ADK. These have been scrubbed to replace occurrences of HAP with ADK

src/crypto/CHIPBase+CompilerAbstraction.h
src/crypto/CHIPBase+Crypto.c
src/crypto/CHIPCrypto.h
src/crypto/CHIPOpenSSL.c
src/crypto/Makefile.am
src/crypto/tests/CHIPCryptoTest.c
src/crypto/tests/Makefile.am

fixes #147

This pulls in openssl based crypto methods from HAP
@bhaskar-apple
Copy link
Contributor Author

Here is the same branch in my fork to track that it builds
https://github.com/bhaskar-apple/connectedhomeip/pull/6

Copy link

@hawk248 hawk248 left a comment

Choose a reason for hiding this comment

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

nice

@woody-apple
Copy link
Contributor

@balducci-apple ?

@gerickson
Copy link
Contributor

Any unit tests you can point to from the HAP open source that fill fast follow or that can be landed concurrently?

@bhaskar-apple
Copy link
Contributor Author

bhaskar-apple commented Apr 3, 2020

Any unit tests you can point to from the HAP open source that fill fast follow or that can be landed concurrently?

@gerickson
Yes this patch also includes existing HAP tests under src/crypto/tests/CHIPCryptoTest.c

make[5]: Nothing to be done for 'check-am'.
Making check in crypto
Making check in tests
make  TestCrypto
  CC       CHIPCryptoTest.o
  CCLD     TestCrypto
make  check-TESTS
PASS: TestCrypto
============================================================================
Testsuite summary for Chip g1d0901d
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

@gerickson
Copy link
Contributor

Any unit tests you can point to from the HAP open source that fill fast follow or that can be landed concurrently?

Any unit tests you can point to from the HAP open source that fill fast follow or that can be landed concurrently?

Yes this patch has tests that run and pass under src/crypto/tests/CHIPCryptoTest.c

make[5]: Nothing to be done for 'check-am'.
Making check in crypto
Making check in tests
make  TestCrypto
  CC       CHIPCryptoTest.o
  CCLD     TestCrypto
make  check-TESTS
PASS: TestCrypto
============================================================================
Testsuite summary for Chip g1d0901d
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

Awesome; sorry I missed those on first glance.

Copy link
Contributor

@turon turon left a comment

Choose a reason for hiding this comment

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

I'm confused by submission of crypto algorithms that the Security group does not plan to use.

#ifndef HAVE_CUSTOM_SINGLE_SHOT_CHACHA20_POLY1305

// CHIP : cha cha poly encryption
void CHIP_chacha20_poly1305_encrypt_aad(uint8_t tag[CHACHA20_POLY1305_TAG_BYTES], uint8_t * c, const uint8_t * m, size_t m_len,
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought chacha and poly1305 where not part of the plan.

Copy link
Contributor

Choose a reason for hiding this comment

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

They are the current HAP Security baseline, but we'll be updating these with the new approved items as we have implementations.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought from the last readout from Evgeni and Alex on the cryptographic primitives that there was good consensus and alignment on those primitives (SPAKE2+, AES-128, AEAD, etc.). If there is, can we drive ahead with that consensus? Crypto suites seem like a good next layer of the pyramid to lay down that should be non-contentious if my understanding of where that team is at is accurate and up-to-date.

#define X25519_SCALAR_BYTES 32
#define X25519_BYTES 32

void CHIP_X25519_scalarmult_base(uint8_t r[X25519_BYTES], const uint8_t n[X25519_SCALAR_BYTES]);
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought curve 25519 was not plan-of-record.

Copy link
Contributor

Choose a reason for hiding this comment

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

They are the current HAP Security baseline, but we'll be updating these with the new approved items as we have implementations.

return B;
}

void CHIP_srp_public_key(uint8_t pub_b[SRP_PUBLIC_KEY_BYTES], const uint8_t priv_b[SRP_SECRET_KEY_BYTES],
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought SRP was not plan-of-record.

Copy link
Contributor

Choose a reason for hiding this comment

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

They are the current HAP Security baseline, but we'll be updating these with the new approved items as we have implementations.

Copy link
Contributor

@woody-apple woody-apple left a comment

Choose a reason for hiding this comment

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

Thanks @bhaskar-apple @balducci-apple Looks like a great start for our baseline

@woody-apple
Copy link
Contributor

@BroderickCarlin ?

@woody-apple woody-apple merged commit 30e3b04 into project-chip:master Apr 6, 2020
Copy link
Contributor

@gerickson gerickson left a comment

Choose a reason for hiding this comment

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

How do we resolve the questions about the cryptographic primitives consensus questions here?

@woody-apple
Copy link
Contributor

Those will be handled with in follow up PRS to add the the baseline as agreed on in the secure transport team. I assume @balducci-apple and @bhaskar-apple will have some follow ons (and issues please!)

@balducci-apple
Copy link
Contributor

@bhaskar-apple will be providing some issues soon to align with output from the crypto primitives team.

@bhaskar-apple
Copy link
Contributor Author

Those will be handled with in follow up PRS to add the the baseline as agreed on in the secure transport team. I assume @balducci-apple and @bhaskar-apple will have some follow ons (and issues please!)

@woody-apple Yes working on filing issues now

@bhaskar-apple bhaskar-apple deleted the BS-HAPCrypto branch April 7, 2020 20:32
mkardous-silabs referenced this pull request in mkardous-silabs/connectedhomeip Nov 2, 2022
…labs_1.0

Merge in WMN_TOOLS/matter from cherry-pick/doc_updates_v1.0.0 to silabs_1.0

Squashed commit of the following:

commit 78067c25ba6423ccc81b612b3aa0b49755039bf7
Author: Ezra Hale <[email protected]>
Date:   Fri Oct 28 20:01:49 2022 +0000

    Pull request #215: Doc updates v1.0.0

    Merge in WMN_TOOLS/matter from doc_updates_v1.0.0 to silabs

    Squashed commit of the following:

    commit 46f15d6f949cab44c10262869b2d94448d430f72
    Author: Ezra Hale <[email protected]>
    Date:   Fri Oct 28 14:10:14 2022 -0400

        fixed typos on board names

    commit 55c9e89b5f006bab627120b2e5b466ba06e9792f
    Author: Ezra Hale <[email protected]>
    Date:   Fri Oct 28 13:58:31 2022 -0400

        updates to boards supported in script and vscode tasks, also few updates to matter bridge readmes

    commit 49683bfb98730654f592187f373d1b20b6eada2a
    Author: Ezra Hale <[email protected]>
    Date:   Fri Oct 28 12:13:03 2022 -0400

        review of silabs_examples documentation

    ... and 14 more commits

     Conflicts:
    	.vscode/tasks.json (resolved by overwriting with our changes as we maintain this file now)
rerasool added a commit to SiliconLabs/matter that referenced this pull request Nov 2, 2022
…silabs to silabs_1.0

Merge in WMN_TOOLS/matter from cherry-pick/doc_updates_v1.0.0 to silabs_1.0

Squashed commit of the following:

commit 78067c25ba6423ccc81b612b3aa0b49755039bf7
Author: Ezra Hale <[email protected]>
Date:   Fri Oct 28 20:01:49 2022 +0000

    Pull request project-chip#215: Doc updates v1.0.0

    Merge in WMN_TOOLS/matter from doc_updates_v1.0.0 to silabs

    Squashed commit of the following:

    commit 46f15d6f949cab44c10262869b2d94448d430f72
    Author: Ezra Hale <[email protected]>
    Date:   Fri Oct 28 14:10:14 2022 -0400

        fixed typos on board names

    commit 55c9e89b5f006bab627120b2e5b466ba06e9792f
    Author: Ezra Hale <[email protected]>
    Date:   Fri Oct 28 13:58:31 2022 -0400

        updates to boards supported in script and vscode tasks, also few updates to matter bridge readmes

    commit 49683bfb98730654f592187f373d1b20b6eada2a
    Author: Ezra Hale <[email protected]>
    Date:   Fri Oct 28 12:13:03 2022 -0400

        review of silabs_examples documentation

    ... and 14 more commits

     Conflicts:
    	.vscode/tasks.json (resolved by overwriting with our changes as we maintain this file now)
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.

No APIs to support symmetric key based payload encryption available in CHIP
9 participants