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

Feature/secure element ci #7816

Merged
merged 37 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6cb0be4
Merge pull request #1 from project-chip/master
Jagadish-NXP Jan 31, 2021
d9bc02d
Merge pull request #2 from project-chip/master
Jagadish-NXP Feb 25, 2021
cb188fd
Merge pull request #4 from project-chip/master
Jagadish-NXP Apr 16, 2021
3eeae9d
Merge pull request #5 from project-chip/master
Jagadish-NXP May 3, 2021
f6c0643
Merge pull request #6 from project-chip/master
Jagadish-NXP May 5, 2021
a5b1d58
Merge branch 'project-chip:master' into master
Jagadish-NXP May 11, 2021
057cea2
Merge branch 'project-chip:master' into master
Jagadish-NXP May 13, 2021
7540d7c
script for building with Secure Element
Jagadish-NXP May 13, 2021
3dd6106
debug ==> release as it is actually built in release mode
Jagadish-NXP May 13, 2021
6dd9ee8
added secure element build
Jagadish-NXP May 13, 2021
2279514
Added with secure element build
Jagadish-NXP May 13, 2021
826193f
added build instrctions
Jagadish-NXP May 13, 2021
d894136
added lf
Jagadish-NXP May 13, 2021
51bfaa9
spacing
Jagadish-NXP May 13, 2021
4a5f52b
spacing
Jagadish-NXP May 13, 2021
96fe91f
Merge branch 'feature/secureElement-ci' of github.com:Jagadish-NXP/co…
Jagadish-NXP May 13, 2021
ea76cfe
added se
Jagadish-NXP May 13, 2021
c19abf6
image of se
Jagadish-NXP May 13, 2021
bf1d5cf
Merge branch 'project-chip:master' into feature/secureElement-ci
Jagadish-NXP May 13, 2021
fcbf352
Updated Readme
Jagadish-NXP May 17, 2021
8947ae9
default host is host_k32w
Jagadish-NXP May 17, 2021
9ca274b
restyled
Jagadish-NXP May 17, 2021
140a0cb
spell corrected
Jagadish-NXP May 17, 2021
c72a761
Merge branch 'project-chip:master' into master
Jagadish-NXP May 17, 2021
5bd7db4
Merge branch 'master' into feature/secureElement-ci
Jagadish-NXP May 17, 2021
ff18c1f
Only One binary for code size analysis
Jagadish-NXP May 18, 2021
2e6d0cf
Merge branch 'feature/secureElement-ci' of github.com:Jagadish-NXP/co…
Jagadish-NXP May 18, 2021
5c61344
Merge branch 'project-chip:master' into master
Jagadish-NXP Jun 22, 2021
5d00d7b
Merge remote-tracking branch 'origin' into feature/secureElement-ci
Jagadish-NXP Jun 22, 2021
bfd59b6
extended for se
Jagadish-NXP Jun 22, 2021
945ddc4
Removed the extra copy paste line
Jagadish-NXP Jun 22, 2021
d7bea68
build fixes. Motivation fo this PR
Jagadish-NXP Jun 22, 2021
627eb1b
restyled
Jagadish-NXP Jun 22, 2021
d3e9662
Review comment updates
Jagadish-NXP Jun 22, 2021
20281a7
made it simpler
Jagadish-NXP Jun 22, 2021
914e49b
made const
Jagadish-NXP Jun 22, 2021
ca69fb2
labelling it correctly
Jagadish-NXP Jun 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/examples-k32w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build example - K32W
name: Build example - K32W with SE051

on:
push:
Expand Down Expand Up @@ -65,14 +65,14 @@ jobs:
timeout-minutes: 5
run: scripts/examples/k32w_example.sh
examples/lock-app/k32w out/lock_app_debug
- name: Build example K32W Lighting App
timeout-minutes: 5
run: scripts/examples/k32w_example.sh
examples/lighting-app/k32w out/lighting_app_debug
- name: Build example K32W Shell App
timeout-minutes: 5
run: scripts/examples/k32w_example.sh
examples/shell/k32w out/shell_app_debug
- name: Build example K32W Lighting App with Secure Element
timeout-minutes: 5
run: scripts/examples/k32w_se_example.sh
examples/lighting-app/k32w out/lighting_app_se_release
- name: Binary artifact suffix
id: outsuffix
uses: haya14busa/action-cond@v1.0.0
Expand Down
24 changes: 22 additions & 2 deletions examples/lighting-app/k32w/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ default settings by pressing a button. However, this mode does not guarantee
that the device will be able to communicate with the CHIP controller and other
devices.

### SE051H Secure Element

Deployment of this firmware configuration requires the K32W061 board setups
using the K32W0/JN5189 module board, SE051 Expansion board and Generic Expansion
board as shown below:

![SE051H + K32W061 DK6](../../platform/k32w/doc/images/k32w-se.jpg)

The SE051H Secure Element extension may be used for best in class security and
offloading some of the Project CHIP cryptographic operations. Depending on your
hardware configuration, choose one of the options below (building with or
without Secure Element). NOTE: the SE051H is a derivative of the SE051 product
family (see http://www.nxp.com/SE051) including dedicated CHIP support in
addition to the SE051 feature set. See the material provided separately by NXP
for more details on SE051H.

### Bluetooth LE Advertising

In this example, to commission the device onto a Project CHIP network, it must
Expand Down Expand Up @@ -153,18 +169,22 @@ distribution (the demo-application was compiled on Ubuntu 20.04).
the one from the image below.
![MCUXpresso SDK Download](../../platform/k32w/doc/images/mcux-sdk-download.JPG)

- Start building the application
- Start building the application either with Secure Element or without
- with Secure Element

```
user@ubuntu:~/Desktop/git/connectedhomeip$ export K32W061_SDK_ROOT=/home/user/Desktop/SDK_2.6.3_K32W061DK6/
user@ubuntu:~/Desktop/git/connectedhomeip$ ./third_party/k32w_sdk/sdk_fixes/patch_k32w_sdk.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lighting-app/k32w/
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/k32w$ gn gen out/debug --args="k32w_sdk_root=\"${K32W061_SDK_ROOT}\" chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false"
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/k32w$ gn gen out/debug --args="k32w_sdk_root=\"${K32W061_SDK_ROOT}\" chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"mbedtls\" chip_with_se05x=1"
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lightin-app/k32w$ ninja -C out/debug
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/k32w$ $K32W061_SDK_ROOT/tools/imagetool/sign_images.sh out/debug/
```

- without Secure element
Exactly the same steps as above but set chip_with_se05x=0 in the gn command

Note that "patch_k32w_sdk.sh" script must be run for patching the K32W061 SDK
2.6.3.

Expand Down
25 changes: 23 additions & 2 deletions examples/lock-app/k32w/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ default settings by pressing a button. However, this mode does not guarantee
that the device will be able to communicate with the CHIP controller and other
devices.

### SE051H Secure Element

Deployment of this firmware configuration requires the K32W061 board setups
using the K32W0/JN5189 module board, SE051 Expansion board and Generic Expansion
board as shown below:

![SE051H + K32W061 DK6](../../platform/k32w/doc/images/k32w-se.jpg)

The SE051H Secure Element extension may be used for best in class security and
offloading some of the Project CHIP cryptographic operations. Depending on your
hardware configuration, choose one of the options below (building with or
without Secure Element). NOTE: the SE051H is a derivative of the SE051 product
family (see http://www.nxp.com/SE051) including dedicated CHIP support in
addition to the SE051 feature set. See the material provided separately by NXP
for more details on SE051H.

### Bluetooth LE Advertising

In this example, to commission the device onto a Project CHIP network, it must
Expand Down Expand Up @@ -156,18 +172,23 @@ distribution (the demo-application was compiled on Ubuntu 20.04).
the one from the image below.
![MCUXpresso SDK Download](../../platform/k32w/doc/images/mcux-sdk-download.JPG)

- Start building the application
- Start building the application either with Secure Element or without

- with Secure Element

```
user@ubuntu:~/Desktop/git/connectedhomeip$ export K32W061_SDK_ROOT=/home/user/Desktop/SDK_2.6.3_K32W061DK6/
user@ubuntu:~/Desktop/git/connectedhomeip$ ./third_party/k32w_sdk/sdk_fixes/patch_k32w_sdk.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh
user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lock-app/k32w/
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ gn gen out/debug --args="k32w_sdk_root=\"${K32W061_SDK_ROOT}\" chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false"
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ gn gen out/debug --args="k32w_sdk_root=\"${K32W061_SDK_ROOT}\" chip_with_OM15082=1 chip_with_ot_cli=0 is_debug=false chip_crypto=\"mbedtls\" chip_with_se05x=1"
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ ninja -C out/debug
user@ubuntu:~/Desktop/git/connectedhomeip/examples/lock-app/k32w$ $K32W061_SDK_ROOT/tools/imagetool/sign_images.sh out/debug/
```

- without Secure element
Exactly the same steps as above but set chip_with_se05x=0 in the gn command

Note that "patch_k32w_sdk.sh" script must be run for patching the K32W061 SDK
2.6.3.

Expand Down
Binary file added examples/platform/k32w/doc/images/k32w-se.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions scripts/examples/k32w_se_example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

#
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -e

# Build script for K32W examples GitHub workflow.

source "$(dirname "$0")/../../scripts/activate.sh"

set -x
env

"$(dirname "$0")"/../../third_party/k32w_sdk/sdk_fixes/patch_k32w_sdk.sh

gn gen --check --fail-on-unused-args --root="$1" "$2" --args="k32w_sdk_root=\"$K32W061_SDK_ROOT\" is_debug=false chip_crypto=\"mbedtls\" chip_with_se05x=1"
ninja -C "$2"
11 changes: 3 additions & 8 deletions src/crypto/hsm/nxp/CHIPCryptoPALHsm_SE05X_Spake2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,7 @@ CHIP_ERROR Spake2p_ComputeRoundOne_HSM(hsm_pake_context_t * phsm_pake_context, c

if (role == chip::Crypto::CHIP_SPAKE2P_ROLE::VERIFIER)
{
if (pab == NULL)
{
/* Need X/Y value to verify abort condition */
goto exit;
}
VerifyOrReturnError(pab != NULL, CHIP_ERROR_INVALID_ARGUMENT);
}

#if SSS_HAVE_SE05X_VER_GTE_16_03
Expand Down Expand Up @@ -487,7 +483,7 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::ComputeRoundTwo(const uint8_t * in,
uint8_t pKeyKe[16] = {
0,
};
constexpr size_t pkeyKeLen = sizeof(pKeyKe);
size_t pkeyKeLen = sizeof(pKeyKe);
woody-apple marked this conversation as resolved.
Show resolved Hide resolved

const CHIP_ERROR error = Spake2p_ComputeRoundTwo_HSM(&hsm_pake_context, role, in, in_len, out, out_len, pKeyKe, &pkeyKeLen);
if (CHIP_NO_ERROR == error)
Expand All @@ -500,7 +496,7 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::ComputeRoundTwo(const uint8_t * in,

CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::KeyConfirm(const uint8_t * in, size_t in_len)
{
VerifyOrExit(state == CHIP_SPAKE2P_STATE::R2, error = CHIP_ERROR_INTERNAL);
VerifyOrReturnError(state == CHIP_SPAKE2P_STATE::R2, CHIP_ERROR_INTERNAL);

#if !ENABLE_HSM_SPAKE_VERIFIER
const bool sw_rollback_verifier = (role == chip::Crypto::CHIP_SPAKE2P_ROLE::VERIFIER);
Expand All @@ -518,7 +514,6 @@ CHIP_ERROR Spake2pHSM_P256_SHA256_HKDF_HMAC::KeyConfirm(const uint8_t * in, size
{
return Spake2p::KeyConfirm(in, in_len);
}

const CHIP_ERROR error = Spake2p_KeyConfirm_HSM(&hsm_pake_context, role, in, in_len);
if (CHIP_NO_ERROR == error)
{
Expand Down
2 changes: 1 addition & 1 deletion third_party/simw-top-mini/simw_config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@

declare_args() {
# possible values host_k32w, host_linux
host = "host_linux"
host = "host_k32w"
}