Skip to content

Commit 3aaa9a8

Browse files
committed
Apply restyled changes.
1 parent 2a0b2eb commit 3aaa9a8

16 files changed

+125
-127
lines changed

docs/guides/infineon_trustm_provisioning.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ Please note that production devices cannot re-use these test keys/certificates.
5757
_Step3: Write DAC test certificate into OPTIGA™ Trust M certificate slot
5858
0xE0E0_
5959

60-
_Step4: Write Matter test PAI into OPTIGA™ Trust M certificate slot 0xE0E8
61-
and test CD into OPTIGA™ Trust M Arbitrary OID 0xF1E0.
60+
\_Step4: Write Matter test PAI into OPTIGA™ Trust M certificate slot
61+
0xE0E8 and test CD into OPTIGA™ Trust M Arbitrary OID 0xF1E0.

examples/lock-app/infineon/psoc6/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,14 @@ cloud, giving every IoT device its own unique identity.
154154

155155
- Building
156156

157-
Follow the steps to build with OPTIGA™ Trust M for device attestation use case:
157+
Follow the steps to build with OPTIGA™ Trust M for device attestation use
158+
case:
158159

159160
```
160161
$ source scripts/activate.sh
161162
$ scripts/build/build_examples.py --no-log-timestamps --target 'infineon-psoc6-lock-trustm' build
162163
```
164+
163165
- To delete generated executable, libraries and object files use:
164166
165167
$ cd ~/connectedhomeip

scripts/build/builders/infineon.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(self,
8181
board: InfineonBoard = InfineonBoard.PSOC6BOARD,
8282
enable_ota_requestor: bool = False,
8383
update_image: bool = False,
84-
enable_trustm: bool = False):
84+
enable_trustm: bool = False):
8585
super(InfineonBuilder, self).__init__(
8686
root=app.BuildRoot(root),
8787
runner=runner)
@@ -97,6 +97,7 @@ def __init__(self,
9797
self.extra_gn_options.append('chip_crypto=\"platform\"')
9898
if enable_trustm is False:
9999
self.extra_gn_options.append('chip_crypto=\"mbedtls\"')
100+
100101
def GnBuildArgs(self):
101102
return self.extra_gn_options
102103

src/crypto/crypto.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare_args() {
1616
# Crypto implementation: mbedtls, openssl, boringssl, platform.
1717
chip_crypto = ""
1818
chip_with_se05x = 0
19-
19+
2020
# Compile mbedtls externally. Only used if chip_crypto == "mbedtls"
2121
chip_external_mbedtls = false
2222
}

src/platform/Infineon/crypto/trustm/BUILD.gn

+4-8
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,33 @@ if (chip_crypto == "platform") {
2323
}
2424

2525
source_set("public_headers") {
26-
sources = [
27-
]
26+
sources = []
2827

2928
public_deps = [
29+
"${chip_root}/src/crypto",
3030
"${chip_root}/src/lib/asn1",
3131
"${chip_root}/src/lib/core",
3232
"${chip_root}/src/lib/support",
3333
"${nlassert_root}:nlassert",
34-
"${chip_root}/src/crypto",
35-
3634
]
3735
}
3836

3937
static_library("infineon_crypto_lib") {
4038
sources = [
41-
"CHIPCryptoPAL_HostFallBack.cpp",
4239
"CHIPCryptoPALHost.cpp",
4340
"CHIPCryptoPALHsm_HKDF_trustm.cpp",
4441
"CHIPCryptoPALHsm_HMAC_trustm.cpp",
4542
"CHIPCryptoPALHsm_P256_trustm.cpp",
4643
"CHIPCryptoPALHsm_rng_trustm.cpp",
4744
"CHIPCryptoPALHsm_utils_trustm.cpp",
45+
"CHIPCryptoPAL_HostFallBack.cpp",
4846
"DeviceAttestationCredsExampleTrustM.cpp",
4947
]
5048

5149
public_deps = [ ":public_headers" ]
5250
public_configs = []
5351
public_deps += [ "${chip_root}/third_party/infineon/trustm:optiga-trust-m" ]
54-
public_configs +=
55-
[ "${chip_root}/third_party/infineon/trustm:trustm_config" ]
52+
public_configs += [ "${chip_root}/third_party/infineon/trustm:trustm_config" ]
5653
deps = [ "${chip_root}/${infineon_crypto_root}:optiga-trust-m" ]
5754
external_mbedtls = current_os == "zephyr"
5855

@@ -64,5 +61,4 @@ static_library("infineon_crypto_lib") {
6461
"${chip_root}/src/crypto",
6562
"${chip_root}/src/platform/Infineon/crypto/trustm",
6663
]
67-
6864
}

src/platform/Infineon/crypto/trustm/CHIPCryptoPALHost.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ CHIP_ERROR AES_CCM_encrypt(const uint8_t * plaintext, size_t plaintext_length, c
129129
}
130130

131131
// Size of key is expressed in bits, hence the multiplication by 8.
132-
result = mbedtls_ccm_setkey(&ccm_context, MBEDTLS_CIPHER_ID_AES, key.As<Symmetric128BitsKeyByteArray>(), sizeof(Symmetric128BitsKeyByteArray) * 8);
132+
result = mbedtls_ccm_setkey(&ccm_context, MBEDTLS_CIPHER_ID_AES, key.As<Symmetric128BitsKeyByteArray>(),
133+
sizeof(Symmetric128BitsKeyByteArray) * 8);
133134
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);
134135

135136
// Encrypt
@@ -165,7 +166,8 @@ CHIP_ERROR AES_CCM_decrypt(const uint8_t * ciphertext, size_t ciphertext_len, co
165166
}
166167

167168
// Size of key is expressed in bits, hence the multiplication by 8.
168-
result = mbedtls_ccm_setkey(&ccm_context, MBEDTLS_CIPHER_ID_AES, key.As<Symmetric128BitsKeyByteArray>(), sizeof(Symmetric128BitsKeyByteArray) * 8);
169+
result = mbedtls_ccm_setkey(&ccm_context, MBEDTLS_CIPHER_ID_AES, key.As<Symmetric128BitsKeyByteArray>(),
170+
sizeof(Symmetric128BitsKeyByteArray) * 8);
169171
VerifyOrExit(result == 0, error = CHIP_ERROR_INTERNAL);
170172

171173
// Decrypt
@@ -293,7 +295,6 @@ CHIP_ERROR pbkdf2_sha256_h(const uint8_t * password, size_t plen, const uint8_t
293295
return error;
294296
}
295297

296-
297298
CHIP_ERROR Hash_SHA256_stream::AddData(const ByteSpan data)
298299
{
299300
mbedtls_sha256_context * const context = to_inner_hash_sha256_context(&mContext);

src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_HKDF_trustm.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ namespace Crypto {
4747
extern CHIP_ERROR HKDF_SHA256_H(const uint8_t * secret, const size_t secret_length, const uint8_t * salt, const size_t salt_length,
4848
const uint8_t * info, const size_t info_length, uint8_t * out_buffer, size_t out_length);
4949

50-
CHIP_ERROR HKDF_sha::HKDF_SHA256(const uint8_t * secret, const size_t secret_length, const uint8_t * salt,
51-
const size_t salt_length, const uint8_t * info, const size_t info_length, uint8_t * out_buffer,
52-
size_t out_length)
50+
CHIP_ERROR HKDF_sha::HKDF_SHA256(const uint8_t * secret, const size_t secret_length, const uint8_t * salt, const size_t salt_length,
51+
const uint8_t * info, const size_t info_length, uint8_t * out_buffer, size_t out_length)
5352
{
5453
#if !ENABLE_TRUSTM_HKDF_SHA256
5554
return HKDF_SHA256_H(secret, secret_length, salt, salt_length, info, info_length, out_buffer, out_length);

src/platform/Infineon/crypto/trustm/CHIPCryptoPALHsm_HMAC_trustm.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ extern CHIP_ERROR HMAC_SHA256_h(const uint8_t * key, size_t key_length, const ui
4848
uint8_t * out_buffer, size_t out_length);
4949

5050
CHIP_ERROR HMAC_sha::HMAC_SHA256(const uint8_t * key, size_t key_length, const uint8_t * message, size_t message_length,
51-
uint8_t * out_buffer, size_t out_length)
51+
uint8_t * out_buffer, size_t out_length)
5252

5353
{
5454
#if !ENABLE_TRUSTM_HMAC_SHA256
@@ -75,7 +75,7 @@ CHIP_ERROR HMAC_sha::HMAC_SHA256(const uint8_t * key, size_t key_length, const u
7575
// Trust M init
7676
trustm_Open();
7777
// Write metada for secret OID(Done during Provisioning)
78-
//write_metadata(TRUSTM_HMAC_OID_KEY, metadata_hmac, sizeof(metadata_hmac));
78+
// write_metadata(TRUSTM_HMAC_OID_KEY, metadata_hmac, sizeof(metadata_hmac));
7979
// Update the secret key
8080
write_data(TRUSTM_HMAC_OID_KEY, key, key_length_u16);
8181

0 commit comments

Comments
 (0)