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

Support bypassing secure pairing for test devices and apps #1

Closed
wants to merge 16 commits into from

Conversation

pan-apple
Copy link
Owner

Problem

Not all test apps and devices support Secure Pairing and Rendezvous. Since we remove hardcoded keys, these tests are not functional.

Summary of Changes

Add support for test shared secret based Pairing Session. Use it in cases where Rendezvous is not supported.

erjiaqing and others added 13 commits August 19, 2020 11:19
-- Implement CHIPBluezHelper based upon the Thread Bluez Gio code from
openthread.
-- Implement BLEManager and corresponding state machine and event
handling module.
-- Implement TestCHIPoBLEStackMgr test
-- Current code suport CHIPoBLE peripheral mode.
-- Validated via repeatedly creating BLE connection, CHIP BTP communication via characteristic C1
and C2

Fix project-chip#2025
…#2237)

* Integrity protect unencrypted portion of message header

* more descriptive function name and comment
* [nrf5-demo] Print QR code on boot

* Fix build

* Fix build
* [cirque] Add cirque test for Linux

- Adds a zcl server for posix mock devices.
- Adds the dockerfile for integration into cirque.

* [cirque] Initial support for Cirque test

* Restyled by shellharden

* Restyled by shfmt

* Switch to flask

* Set a timeout in chip-tool to avoid infinity wait

Co-authored-by: Jiacheng Guo <gjc@google.com>
Co-authored-by: Restyled.io <commits@restyled.io>
* Initiate swap

* Updating with issues

* Adding codecov reference

* Removing autotools build, looks like examples is where we should focus

* Removing duplicated build work
Adding an android toolchain for arm and x86_64 target
cpus.  Subsequent CLs may add target arch to select
armv6, armv7, arm64 and x86 targets if required.

Added a check to only attempt to run tests when
current_os == host_os, otherwise cross compiled tests
attempt to execute on the wrong architecture and fail.

Need to temporarily omit lib/messages from android build
due to RNG dependency on openssl.
* Initial add of exchange context implementation. Just chip renames and license updates done.

* Initial add of exchange context implementation. Just chip renames and license updates done.

* Initial add of exchange context implementation. Just chip renames and license updates done.

* Replace WRMP with RMP

* Added include, more RMP updates

* Add missing include
* nrf5: Enlarge stack to fix thread join overruns

As of b15c292 ("[nrf5-lock] start joiner role on boot (project-chip#1962)"),
we are using too much stack space in timer task. The timer task has a 1k
stack and logging along uses a 256 byte stack buffer.

The code in
GenericThreadStackManagerImpl_FreeRTOS<ImplClass>::OnJoinerTimer should
be moved off the timer task. In the meantime increase the stack size
to avoid overruns in the thread joiner.

Also enable the option configCHECK_FOR_STACK_OVERFLOW, and while we're
here also enable configUSE_MALLOC_FAILED_HOOK. These diagnostic options
are invaluable for saving debugging time.

Since logging uses significant stack space, try to catch stack overflows
in the platform LogV(). This fires reliably in OnJoinerTimer prior
to enlarging the stack.

Fixes project-chip#2187

* Reduce timer task memory to 2k

* Fix the stack size in EFR32 as well
* [K32W] Add original k32w-app.mk makefile

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Fix k32w061-app.mk makefile

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Add original k32w061-chip.mk makefile

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Fix k32w061-chip.mk makefile

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Add rules for building device layer files

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Rename k32w-weave-mbedtls-config.h -> k32w-chip-mbedtls-config.h

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Remove not needed code

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Add K32W demo lock app and Makefile system

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Fixes for app compilation

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Fixes for app compilation

ROund 2 - AppTAsk.{c.h}

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Fix app compilation issues

Round 3 - At this moment we have linker issues.

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Fix Linker issues

App compiles and links.

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Fix LEDWidget Animate

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] Fix Lock/Unlock LED

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* [K32W] App codying style fixes

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>

* Restyled by whitespace

* Restyled by clang-format

Co-authored-by: Restyled.io <commits@restyled.io>
)

* -Include the correct FreeRTOS Cortex files in the EFR32 makefiles correspoding to the defined MCU family (MG12 vs MG21)
-Init all IRQs priority to a lower priority valid for FreeRTOS API. An IRQ in the gecko radio libs
 with the default priority 0 (highest) was causing a assert failure in FreeRTOS

* Add the IRQ priority init for all EFR32 boards init
Restyle some file headers and copyright mentions

* Add BoltLockManager to manage the lock and unlock request and state
Add DataModelHandler to handle bolt actions from the cluster messages
Add Gen folder with the files for silicon lab cluster implementation
Strt a server session for UDP messages
Include some mbedtls sources  files from gsdk 2.7 in gni . TO BE FIX

* merge upstream

* Add BoltLockManager to manage the lock and unlock request and state
Add DataModelHandler to handle bolt actions from the cluster messages
Add Gen folder with the files for silicon lab cluster implementation
Start a server session for UDP messages
Include some mbedtls sources  files from gsdk 2.7 in gni . TO BE FIX

merge upstream

* Add support for Silabs dev board BRD4163A and BRD4164A

Merge Upstream into branch

Add BoltLockManager to manage the lock and unlock request and state
Add DataModelHandler to handle bolt actions from the cluster messages
Add Gen folder with the files for silicon lab cluster implementation
Strt a server session for UDP messages
Include some mbedtls sources  files from gsdk 2.7 in gni . TO BE FIX

merge upstream

Add the IRQ priority init for all EFR32 boards init
Restyle some file headers and copyright mentions

* Restyled by whitespace

* Fix submodules

* Clear up code and comment based on Andrei comments on PR

* Restyled by gn

Co-authored-by: Restyled.io <commits@restyled.io>
* -Include the correct FreeRTOS Cortex files in the EFR32 makefiles correspoding to the defined MCU family (MG12 vs MG21)
-Init all IRQs priority to a lower priority valid for FreeRTOS API. An IRQ in the gecko radio libs
 with the default priority 0 (highest) was causing a assert failure in FreeRTOS

* Add the IRQ priority init for all EFR32 boards init
Restyle some file headers and copyright mentions

* Fix build script

* Fix sources for EFR32 platform

* Set mbedtls to external source

* Fix compilation with ninja

* Add BoltLockManager to manage the lock and unlock request and state
Add DataModelHandler to handle bolt actions from the cluster messages
Add Gen folder with the files for silicon lab cluster implementation
Strt a server session for UDP messages
Include some mbedtls sources  files from gsdk 2.7 in gni . TO BE FIX

* merge upstream

* Added Openthread to the example

* nrf5: Enlarge stack to fix thread join overruns

As of b15c292 ("[nrf5-lock] start joiner role on boot (project-chip#1962)"),
we are using too much stack space in timer task. The timer task has a 1k
stack and logging along uses a 256 byte stack buffer.

The code in
GenericThreadStackManagerImpl_FreeRTOS<ImplClass>::OnJoinerTimer should
be moved off the timer task. In the meantime increase the stack size
to avoid overruns in the thread joiner.

Also enable the option configCHECK_FOR_STACK_OVERFLOW, and while we're
here also enable configUSE_MALLOC_FAILED_HOOK. These diagnostic options
are invaluable for saving debugging time.

Since logging uses significant stack space, try to catch stack overflows
in the platform LogV(). This fires reliably in OnJoinerTimer prior
to enlarging the stack.

Fixes project-chip#2187

* Reduce timer task memory to 2k

* Fix the stack size in EFR32 as well

* Add BoltLockManager to manage the lock and unlock request and state
Add DataModelHandler to handle bolt actions from the cluster messages
Add Gen folder with the files for silicon lab cluster implementation
Start a server session for UDP messages
Include some mbedtls sources  files from gsdk 2.7 in gni . TO BE FIX

merge upstream

* Add support for Silabs dev board BRD4163A and BRD4164A

Merge Upstream into branch

Add BoltLockManager to manage the lock and unlock request and state
Add DataModelHandler to handle bolt actions from the cluster messages
Add Gen folder with the files for silicon lab cluster implementation
Strt a server session for UDP messages
Include some mbedtls sources  files from gsdk 2.7 in gni . TO BE FIX

merge upstream

Add the IRQ priority init for all EFR32 boards init
Restyle some file headers and copyright mentions

* Restyled by whitespace

* Fix submodules

* Format GN files

* Clean up & enable Thread on EFR32

* Fix initial thread stack overrun

* Fix entropy provider

* Restyled by clang-format

* Fix openthread commit

* Reformat build files

  gn format $(git ls-files HEAD '*.gn' '*.gni')
  git add $(git ls-files HEAD '*.gn' '*.gni')

Hopefully the last time now that restyled is working.

* Format GN files

* Apply fixes from master

Co-authored-by: jmartinez-silabs <junior.martinez@silabs.com>
Co-authored-by: jfpenven <jean-francois.penven@silabs.com>
Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: jmartinez-silabs <67972863+jmartinez-silabs@users.noreply.github.com>
* add gn stuff for ios

* restyled

* rebase, use target_default config for cflags, cxxflags, defines, ldflags instead of getenv()

* chugga

* sheesh

* restyled

* re-restyled

* fixup where we expect to find encoder.h

* restyle

* move app stuff around more

* restyle

* use <app/chip-zcl...> everywhere

* restyle
pan-apple and others added 2 commits August 20, 2020 17:16
…ect-chip#2230)

* Fixes and cleanup in Secure Pairing class

* Integrate secure pairing with example app and device controller

* Fix override warning

* Remove manual keys from Android wrapper

* Remove pairing logs

* Restyled by clang-format

* Fix LGTM warning

* Fix controller logs

* const nodeID

Co-authored-by: Restyled.io <commits@restyled.io>
@pan-apple pan-apple closed this Aug 20, 2020
@pan-apple pan-apple deleted the chip-tool branch August 20, 2020 21:26
@pan-apple pan-apple restored the chip-tool branch August 20, 2020 21:26
pan-apple pushed a commit that referenced this pull request Oct 27, 2020
pan-apple pushed a commit that referenced this pull request Feb 17, 2021
* Fix unwinding on Android

Android isn't able to unwind the CHIP native stack, which interferes
with debugging. Turn on unwind tables to fix this.  Unclear if we want
this in optimized builds, but Android OS seems to be able to unwind all
of its frameworks and native libraries, so for now assume we do. There's
only a space cost, and we can revisit that later.

This is the difference between this:

backtrace:
02-16 20:49:34.628  3872  3872 F DEBUG   : backtrace:
02-16 20:49:34.628  3872  3872 F DEBUG   :       #00 pc 000000000008246c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456)
02-16 20:49:34.628  3872  3872 F DEBUG   :       #1 pc 00000000000a836c  /data/app/com.google.chip.chiptool-rPVLWEFRvE413khV9YptWg==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96)

and this:
02-16 20:56:04.323  5040  5040 F DEBUG   : backtrace:
02-16 20:56:04.323  5040  5040 F DEBUG   :       #00 pc 000000000008246c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #1 pc 00000000000a839c  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96)
02-16 20:56:04.323  5040  5040 F DEBUG   :       project-chip#2 pc 000000000009bb58  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44)
02-16 20:56:04.323  5040  5040 F DEBUG   :       project-chip#3 pc 000000000009bb94  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (non-virtual thunk to chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44)
02-16 20:56:04.323  5040  5040 F DEBUG   :       project-chip#4 pc 0000000000051488  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (AndroidDeviceControllerWrapper::SendNetworkCredentials(char const*, char const*)+128)
02-16 20:56:04.323  5040  5040 F DEBUG   :       project-chip#5 pc 0000000000054188  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (Java_chip_devicecontroller_ChipDeviceController_sendWiFiCredentials+188)
02-16 20:56:04.323  5040  5040 F DEBUG   :       project-chip#6 pc 000000000013f350  /apex/com.android.runtime/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: ccd73e8ae9b59d5596b3b8aeef234d43)
<snip>
02-16 20:56:04.327  5040  5040 F DEBUG   :       project-chip#75 pc 00000000000be560  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad)
02-16 20:56:04.327  5040  5040 F DEBUG   :       project-chip#76 pc 00000000000c13d0  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+776) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad)
02-16 20:56:04.327  5040  5040 F DEBUG   :       project-chip#77 pc 00000000000034e0  /system/bin/app_process64 (main+1168) (BuildId: ade4367f7cc82a88f668180d34ce79fe)
02-16 20:56:04.327  5040  5040 F DEBUG   :       project-chip#78 pc 000000000007dc24  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108) (BuildId: 5812256023147338b8a9538321d4c456)

* Make it an argument
pan-apple pushed a commit that referenced this pull request Mar 11, 2021
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.

10 participants