Skip to content

Commit f0f5a2d

Browse files
cecillerestyled-commits
authored andcommitted
Fix constexpr complaints on test vectors (project-chip#29462)
* Fix constexpr complaints on test vectors * Attempt #2 - separate PAAs used in non-test * Things work better when we add all the files * Restyled by whitespace * Restyled by clang-format * add tokenizer * add the gni * add pigweed import * Change filenames * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 8226b2d commit f0f5a2d

10 files changed

+164
-77
lines changed

src/credentials/BUILD.gn

+21
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
import("//build_overrides/chip.gni")
1616
import("//build_overrides/nlassert.gni")
1717
import("${chip_root}/src/crypto/crypto.gni")
18+
import("${chip_root}/src/lib/core/core.gni")
1819
import("${chip_root}/src/platform/device.gni")
20+
1921
declare_args() {
2022
chip_build_example_creds = true
2123
}
@@ -126,6 +128,24 @@ static_library("credentials") {
126128
]
127129
}
128130

131+
source_set("test_paa_store") {
132+
sources = [
133+
"attestation_verifier/TestPAAStore.cpp",
134+
"attestation_verifier/TestPAAStore.h",
135+
]
136+
137+
public_deps = [
138+
"${chip_root}/src/lib/core:chip_config_header", # for lib/support/Span.h
139+
"${nlassert_root}:nlassert", # for lib/support/Span.h
140+
]
141+
if (chip_pw_tokenizer_logging) {
142+
import("//build_overrides/pigweed.gni")
143+
public_deps += [
144+
"${dir_pw_tokenizer}", # for /lib/support/Span.h
145+
]
146+
}
147+
}
148+
129149
static_library("default_attestation_verifier") {
130150
output_name = "libDefaultAttestationVerifier"
131151

@@ -144,6 +164,7 @@ static_library("default_attestation_verifier") {
144164

145165
public_deps = [
146166
":credentials",
167+
":test_paa_store",
147168
"${chip_root}/src/crypto",
148169
"${nlassert_root}:nlassert",
149170
]

src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp

+3-10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <credentials/CertificationDeclaration.h>
2222
#include <credentials/DeviceAttestationConstructor.h>
2323
#include <credentials/DeviceAttestationVendorReserved.h>
24+
#include <credentials/attestation_verifier/TestPAAStore.h>
2425
#include <crypto/CHIPCryptoPAL.h>
2526

2627
#include <lib/core/CHIPError.h>
@@ -29,14 +30,8 @@
2930
#include <lib/support/ScopedBuffer.h>
3031
#include <lib/support/Span.h>
3132

32-
namespace chip {
33-
namespace TestCerts {
34-
extern const Span<const ByteSpan> kTestAttestationTrustStoreRoots;
35-
} // namespace TestCerts
36-
} // namespace chip
37-
3833
using namespace chip::Crypto;
39-
using chip::TestCerts::kTestAttestationTrustStoreRoots;
34+
using chip::TestCerts::GetTestPaaRootStore;
4035

4136
namespace chip {
4237
namespace Credentials {
@@ -274,9 +269,7 @@ constexpr std::array<MatterCDSigningKey, 6> gCdSigningKeys = { {
274269

275270
struct TestAttestationTrustStore final : public ArrayAttestationTrustStore
276271
{
277-
TestAttestationTrustStore() :
278-
ArrayAttestationTrustStore(kTestAttestationTrustStoreRoots.data(), kTestAttestationTrustStoreRoots.size())
279-
{}
272+
TestAttestationTrustStore() : ArrayAttestationTrustStore(GetTestPaaRootStore().data(), GetTestPaaRootStore().size()) {}
280273
};
281274
Global<TestAttestationTrustStore> gTestAttestationTrustStore;
282275

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#include <lib/support/Span.h>
20+
21+
namespace chip {
22+
namespace TestCerts {
23+
24+
// ${chip_root}/credentials/test/attestation/Chip-Test-PAA-FFF1-Cert.pem
25+
26+
constexpr uint8_t sTestCert_PAA_FFF1_Cert_Array[] = {
27+
0x30, 0x82, 0x01, 0xbd, 0x30, 0x82, 0x01, 0x64, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x4e, 0xa8, 0xe8, 0x31, 0x82, 0xd4,
28+
0x1c, 0x1c, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x30, 0x31, 0x18, 0x30, 0x16, 0x06,
29+
0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41,
30+
0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46,
31+
0x31, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, 0x39,
32+
0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x30, 0x31, 0x18, 0x30, 0x16, 0x06,
33+
0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41,
34+
0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46,
35+
0x31, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
36+
0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xb6, 0xcb, 0x63, 0x72, 0x88, 0x7f, 0x29, 0x28, 0xf5, 0xba, 0xc8, 0x1a, 0xa9, 0xd9,
37+
0x3a, 0xe2, 0x43, 0x1c, 0xad, 0xa9, 0xd7, 0x9e, 0x24, 0x2f, 0x65, 0x17, 0x7e, 0xf9, 0xce, 0xd9, 0x32, 0xa2, 0x8e, 0xcd, 0x03,
38+
0xba, 0xaf, 0x6a, 0x8f, 0xca, 0x18, 0x4a, 0x1a, 0x50, 0x35, 0x42, 0x96, 0x0d, 0x45, 0x3f, 0x30, 0x3f, 0x1f, 0x19, 0x42, 0x1d,
39+
0x75, 0x1e, 0x8f, 0x8f, 0x1a, 0x9a, 0x9b, 0x75, 0xa3, 0x66, 0x30, 0x64, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01,
40+
0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff,
41+
0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x6a, 0xfd, 0x22, 0x77,
42+
0x1f, 0x51, 0x1f, 0xec, 0xbf, 0x16, 0x41, 0x97, 0x67, 0x10, 0xdc, 0xdc, 0x31, 0xa1, 0x71, 0x7e, 0x30, 0x1f, 0x06, 0x03, 0x55,
43+
0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x6a, 0xfd, 0x22, 0x77, 0x1f, 0x51, 0x1f, 0xec, 0xbf, 0x16, 0x41, 0x97, 0x67,
44+
0x10, 0xdc, 0xdc, 0x31, 0xa1, 0x71, 0x7e, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47,
45+
0x00, 0x30, 0x44, 0x02, 0x20, 0x50, 0xaa, 0x80, 0x02, 0xf4, 0xd9, 0x32, 0xa9, 0xa0, 0x05, 0x38, 0xf6, 0x53, 0x68, 0xad, 0x0f,
46+
0xff, 0xc8, 0xef, 0xbb, 0xc9, 0xbe, 0xb7, 0xda, 0x56, 0x98, 0x35, 0xcf, 0x9a, 0xa7, 0x51, 0x0e, 0x02, 0x20, 0x23, 0xba, 0xc8,
47+
0xfe, 0x0f, 0x23, 0xe7, 0x54, 0x45, 0xb6, 0x53, 0x39, 0x08, 0x1a, 0x47, 0x99, 0x49, 0x29, 0xc7, 0x2a, 0xaf, 0x0a, 0x15, 0x48,
48+
0xd4, 0x0d, 0x03, 0x4d, 0x51, 0x4b, 0x25, 0xde,
49+
};
50+
51+
// These are used directly by the CryptoPAL test, so need to be declared extern
52+
extern constexpr ByteSpan sTestCert_PAA_FFF1_Cert = ByteSpan(sTestCert_PAA_FFF1_Cert_Array);
53+
54+
// ${chip_root}/credentials/test/attestation/Chip-Test-PAA-NoVID-Cert.pem
55+
56+
constexpr uint8_t sTestCert_PAA_NoVID_Cert_Array[] = {
57+
0x30, 0x82, 0x01, 0x91, 0x30, 0x82, 0x01, 0x37, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x07, 0x0b, 0x8f, 0xba, 0xa8, 0xdd, 0x86,
58+
0xee, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x1a, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
59+
0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41, 0x30,
60+
0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, 0x39, 0x39, 0x39,
61+
0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x1a, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55,
62+
0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41, 0x30, 0x59,
63+
0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
64+
0x03, 0x42, 0x00, 0x04, 0x10, 0xef, 0x02, 0xa8, 0x1a, 0x87, 0xb6, 0x81, 0x21, 0xfb, 0xa8, 0xd3, 0x19, 0x78, 0xf8, 0x07, 0xa3,
65+
0x17, 0xe5, 0x0a, 0xa8, 0xa8, 0x28, 0x44, 0x68, 0x28, 0x91, 0x4b, 0x93, 0x3d, 0xe8, 0xed, 0xd4, 0xa5, 0xc3, 0x9c, 0x9f, 0xf7,
66+
0x1a, 0x4c, 0xe3, 0x64, 0x7f, 0xd7, 0xf6, 0x26, 0x53, 0xb7, 0xd2, 0x49, 0x5f, 0xcb, 0xa4, 0xc0, 0xf4, 0x7f, 0x87, 0x68, 0x80,
67+
0x03, 0x9e, 0x07, 0x20, 0x4a, 0xa3, 0x66, 0x30, 0x64, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08,
68+
0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03,
69+
0x02, 0x01, 0x06, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x78, 0x5c, 0xe7, 0x05, 0xb8, 0x6b, 0x8f,
70+
0x4e, 0x6f, 0xc7, 0x93, 0xaa, 0x60, 0xcb, 0x43, 0xea, 0x69, 0x68, 0x82, 0xd5, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04,
71+
0x18, 0x30, 0x16, 0x80, 0x14, 0x78, 0x5c, 0xe7, 0x05, 0xb8, 0x6b, 0x8f, 0x4e, 0x6f, 0xc7, 0x93, 0xaa, 0x60, 0xcb, 0x43, 0xea,
72+
0x69, 0x68, 0x82, 0xd5, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45,
73+
0x02, 0x21, 0x00, 0xb9, 0xef, 0xdb, 0x3e, 0xa0, 0x6a, 0x52, 0xec, 0x0b, 0xf0, 0x1e, 0x61, 0xda, 0xed, 0x2c, 0x2d, 0x15, 0x6d,
74+
0xdb, 0x6c, 0xf0, 0x14, 0x10, 0x1d, 0xab, 0x79, 0x8f, 0xac, 0x05, 0xfa, 0x47, 0xe5, 0x02, 0x20, 0x60, 0x06, 0x1d, 0x3e, 0x35,
75+
0xd6, 0x0d, 0x9d, 0x4b, 0x0d, 0x44, 0x8d, 0xad, 0x76, 0x12, 0xf7, 0xe8, 0x5c, 0x58, 0x2e, 0x3f, 0xc3, 0x12, 0xdc, 0x18, 0x79,
76+
0x4d, 0xd3, 0x73, 0x71, 0x5e, 0x5d,
77+
};
78+
79+
// These are used directly by the CryptoPAL test, so need to be declared extern
80+
extern constexpr ByteSpan sTestCert_PAA_NoVID_Cert = ByteSpan(sTestCert_PAA_NoVID_Cert_Array);
81+
82+
const Span<const ByteSpan> kTestAttestationTrustStoreRoots((const ByteSpan[]){
83+
sTestCert_PAA_FFF1_Cert,
84+
sTestCert_PAA_NoVID_Cert,
85+
});
86+
87+
const Span<const ByteSpan> & GetTestPaaRootStore()
88+
{
89+
return kTestAttestationTrustStoreRoots;
90+
}
91+
92+
} // namespace TestCerts
93+
} // namespace chip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
*
3+
* Copyright (c) 2021-2023 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* Storage for test attestation PAA certificates. Contains the certs for
19+
* the 0xFFF1 vid PAA cert and the test PAA cert with no VID.
20+
*
21+
* These certs are used by the device attestation and crypto tests
22+
* and by the DefaultDeviceAttestationVerifier.
23+
*/
24+
25+
#pragma once
26+
27+
#include <lib/support/Span.h>
28+
29+
namespace chip {
30+
namespace TestCerts {
31+
32+
extern const ByteSpan sTestCert_PAA_FFF1_Cert;
33+
extern const ByteSpan sTestCert_PAA_NoVID_Cert;
34+
35+
const Span<const ByteSpan> & GetTestPaaRootStore();
36+
37+
} // namespace TestCerts
38+
} // namespace chip

src/credentials/tests/BUILD.gn

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ static_library("cert_test_vectors") {
3636

3737
cflags = [ "-Wconversion" ]
3838

39-
public_deps = [ "${chip_root}/src/credentials" ]
39+
public_deps = [
40+
"${chip_root}/src/credentials",
41+
"${chip_root}/src/credentials:test_paa_store",
42+
]
4043
}
4144

4245
chip_test_suite("tests") {

src/credentials/tests/CHIPAttCert_test_vectors.cpp

-61
Original file line numberDiff line numberDiff line change
@@ -3347,35 +3347,6 @@ constexpr uint8_t sTestCert_DAC_FFF2_8006_0035_Val1SecBefore_PrivateKey_Array[]
33473347
extern const ByteSpan sTestCert_DAC_FFF2_8006_0035_Val1SecBefore_PrivateKey =
33483348
ByteSpan(sTestCert_DAC_FFF2_8006_0035_Val1SecBefore_PrivateKey_Array);
33493349

3350-
// ${chip_root}/credentials/test/attestation/Chip-Test-PAA-FFF1-Cert.pem
3351-
3352-
constexpr uint8_t sTestCert_PAA_FFF1_Cert_Array[] = {
3353-
0x30, 0x82, 0x01, 0xbd, 0x30, 0x82, 0x01, 0x64, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x4e, 0xa8, 0xe8, 0x31, 0x82, 0xd4,
3354-
0x1c, 0x1c, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x30, 0x31, 0x18, 0x30, 0x16, 0x06,
3355-
0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41,
3356-
0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46,
3357-
0x31, 0x30, 0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, 0x39,
3358-
0x39, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x30, 0x31, 0x18, 0x30, 0x16, 0x06,
3359-
0x03, 0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41,
3360-
0x31, 0x14, 0x30, 0x12, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x02, 0x01, 0x0c, 0x04, 0x46, 0x46, 0x46,
3361-
0x31, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
3362-
0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xb6, 0xcb, 0x63, 0x72, 0x88, 0x7f, 0x29, 0x28, 0xf5, 0xba, 0xc8, 0x1a, 0xa9, 0xd9,
3363-
0x3a, 0xe2, 0x43, 0x1c, 0xad, 0xa9, 0xd7, 0x9e, 0x24, 0x2f, 0x65, 0x17, 0x7e, 0xf9, 0xce, 0xd9, 0x32, 0xa2, 0x8e, 0xcd, 0x03,
3364-
0xba, 0xaf, 0x6a, 0x8f, 0xca, 0x18, 0x4a, 0x1a, 0x50, 0x35, 0x42, 0x96, 0x0d, 0x45, 0x3f, 0x30, 0x3f, 0x1f, 0x19, 0x42, 0x1d,
3365-
0x75, 0x1e, 0x8f, 0x8f, 0x1a, 0x9a, 0x9b, 0x75, 0xa3, 0x66, 0x30, 0x64, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01,
3366-
0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff,
3367-
0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x6a, 0xfd, 0x22, 0x77,
3368-
0x1f, 0x51, 0x1f, 0xec, 0xbf, 0x16, 0x41, 0x97, 0x67, 0x10, 0xdc, 0xdc, 0x31, 0xa1, 0x71, 0x7e, 0x30, 0x1f, 0x06, 0x03, 0x55,
3369-
0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x6a, 0xfd, 0x22, 0x77, 0x1f, 0x51, 0x1f, 0xec, 0xbf, 0x16, 0x41, 0x97, 0x67,
3370-
0x10, 0xdc, 0xdc, 0x31, 0xa1, 0x71, 0x7e, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47,
3371-
0x00, 0x30, 0x44, 0x02, 0x20, 0x50, 0xaa, 0x80, 0x02, 0xf4, 0xd9, 0x32, 0xa9, 0xa0, 0x05, 0x38, 0xf6, 0x53, 0x68, 0xad, 0x0f,
3372-
0xff, 0xc8, 0xef, 0xbb, 0xc9, 0xbe, 0xb7, 0xda, 0x56, 0x98, 0x35, 0xcf, 0x9a, 0xa7, 0x51, 0x0e, 0x02, 0x20, 0x23, 0xba, 0xc8,
3373-
0xfe, 0x0f, 0x23, 0xe7, 0x54, 0x45, 0xb6, 0x53, 0x39, 0x08, 0x1a, 0x47, 0x99, 0x49, 0x29, 0xc7, 0x2a, 0xaf, 0x0a, 0x15, 0x48,
3374-
0xd4, 0x0d, 0x03, 0x4d, 0x51, 0x4b, 0x25, 0xde,
3375-
};
3376-
3377-
extern const ByteSpan sTestCert_PAA_FFF1_Cert = ByteSpan(sTestCert_PAA_FFF1_Cert_Array);
3378-
33793350
constexpr uint8_t sTestCert_PAA_FFF1_SKID_Array[] = {
33803351
0x6A, 0xFD, 0x22, 0x77, 0x1F, 0x51, 0x1F, 0xEC, 0xBF, 0x16, 0x41, 0x97, 0x67, 0x10, 0xDC, 0xDC, 0x31, 0xA1, 0x71, 0x7E,
33813352
};
@@ -3506,33 +3477,6 @@ constexpr uint8_t sTestCert_PAA_FFF2_ValInPast_PrivateKey_Array[] = {
35063477

35073478
extern const ByteSpan sTestCert_PAA_FFF2_ValInPast_PrivateKey = ByteSpan(sTestCert_PAA_FFF2_ValInPast_PrivateKey_Array);
35083479

3509-
// ${chip_root}/credentials/test/attestation/Chip-Test-PAA-NoVID-Cert.pem
3510-
3511-
constexpr uint8_t sTestCert_PAA_NoVID_Cert_Array[] = {
3512-
0x30, 0x82, 0x01, 0x91, 0x30, 0x82, 0x01, 0x37, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x07, 0x0b, 0x8f, 0xba, 0xa8, 0xdd, 0x86,
3513-
0xee, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x1a, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
3514-
0x55, 0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41, 0x30,
3515-
0x20, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x36, 0x32, 0x38, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, 0x39, 0x39, 0x39,
3516-
0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x1a, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55,
3517-
0x04, 0x03, 0x0c, 0x0f, 0x4d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x50, 0x41, 0x41, 0x30, 0x59,
3518-
0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,
3519-
0x03, 0x42, 0x00, 0x04, 0x10, 0xef, 0x02, 0xa8, 0x1a, 0x87, 0xb6, 0x81, 0x21, 0xfb, 0xa8, 0xd3, 0x19, 0x78, 0xf8, 0x07, 0xa3,
3520-
0x17, 0xe5, 0x0a, 0xa8, 0xa8, 0x28, 0x44, 0x68, 0x28, 0x91, 0x4b, 0x93, 0x3d, 0xe8, 0xed, 0xd4, 0xa5, 0xc3, 0x9c, 0x9f, 0xf7,
3521-
0x1a, 0x4c, 0xe3, 0x64, 0x7f, 0xd7, 0xf6, 0x26, 0x53, 0xb7, 0xd2, 0x49, 0x5f, 0xcb, 0xa4, 0xc0, 0xf4, 0x7f, 0x87, 0x68, 0x80,
3522-
0x03, 0x9e, 0x07, 0x20, 0x4a, 0xa3, 0x66, 0x30, 0x64, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08,
3523-
0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03,
3524-
0x02, 0x01, 0x06, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x78, 0x5c, 0xe7, 0x05, 0xb8, 0x6b, 0x8f,
3525-
0x4e, 0x6f, 0xc7, 0x93, 0xaa, 0x60, 0xcb, 0x43, 0xea, 0x69, 0x68, 0x82, 0xd5, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04,
3526-
0x18, 0x30, 0x16, 0x80, 0x14, 0x78, 0x5c, 0xe7, 0x05, 0xb8, 0x6b, 0x8f, 0x4e, 0x6f, 0xc7, 0x93, 0xaa, 0x60, 0xcb, 0x43, 0xea,
3527-
0x69, 0x68, 0x82, 0xd5, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45,
3528-
0x02, 0x21, 0x00, 0xb9, 0xef, 0xdb, 0x3e, 0xa0, 0x6a, 0x52, 0xec, 0x0b, 0xf0, 0x1e, 0x61, 0xda, 0xed, 0x2c, 0x2d, 0x15, 0x6d,
3529-
0xdb, 0x6c, 0xf0, 0x14, 0x10, 0x1d, 0xab, 0x79, 0x8f, 0xac, 0x05, 0xfa, 0x47, 0xe5, 0x02, 0x20, 0x60, 0x06, 0x1d, 0x3e, 0x35,
3530-
0xd6, 0x0d, 0x9d, 0x4b, 0x0d, 0x44, 0x8d, 0xad, 0x76, 0x12, 0xf7, 0xe8, 0x5c, 0x58, 0x2e, 0x3f, 0xc3, 0x12, 0xdc, 0x18, 0x79,
3531-
0x4d, 0xd3, 0x73, 0x71, 0x5e, 0x5d,
3532-
};
3533-
3534-
extern const ByteSpan sTestCert_PAA_NoVID_Cert = ByteSpan(sTestCert_PAA_NoVID_Cert_Array);
3535-
35363480
constexpr uint8_t sTestCert_PAA_NoVID_SKID_Array[] = {
35373481
0x78, 0x5C, 0xE7, 0x05, 0xB8, 0x6B, 0x8F, 0x4E, 0x6F, 0xC7, 0x93, 0xAA, 0x60, 0xCB, 0x43, 0xEA, 0x69, 0x68, 0x82, 0xD5,
35383482
};
@@ -4289,10 +4233,5 @@ constexpr uint8_t sTestCert_PAI_FFF2_NoPID_Resigned_SKID_Array[] = {
42894233

42904234
extern const ByteSpan sTestCert_PAI_FFF2_NoPID_Resigned_SKID = ByteSpan(sTestCert_PAI_FFF2_NoPID_Resigned_SKID_Array);
42914235

4292-
extern constexpr Span<const ByteSpan> kTestAttestationTrustStoreRoots((const ByteSpan[]){
4293-
sTestCert_PAA_FFF1_Cert,
4294-
sTestCert_PAA_NoVID_Cert,
4295-
});
4296-
42974236
} // namespace TestCerts
42984237
} // namespace chip

src/credentials/tests/CHIPAttCert_test_vectors.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
namespace chip {
2424
namespace TestCerts {
2525

26-
// Root CA certs for chip::Credentials::GetTestAttestationTrustStore()
27-
extern const Span<const ByteSpan> kTestAttestationTrustStoreRoots;
28-
2926
extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_Cert;
3027
extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_SKID;
3128
extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_PublicKey;
@@ -316,7 +313,7 @@ extern const ByteSpan sTestCert_DAC_FFF2_8006_0035_Val1SecBefore_SKID;
316313
extern const ByteSpan sTestCert_DAC_FFF2_8006_0035_Val1SecBefore_PublicKey;
317314
extern const ByteSpan sTestCert_DAC_FFF2_8006_0035_Val1SecBefore_PrivateKey;
318315

319-
extern const ByteSpan sTestCert_PAA_FFF1_Cert;
316+
// Cert is provided in the PAA store file as it is used in the default verifier.
320317
extern const ByteSpan sTestCert_PAA_FFF1_SKID;
321318
extern const ByteSpan sTestCert_PAA_FFF1_PublicKey;
322319
extern const ByteSpan sTestCert_PAA_FFF1_PrivateKey;
@@ -331,7 +328,7 @@ extern const ByteSpan sTestCert_PAA_FFF2_ValInPast_SKID;
331328
extern const ByteSpan sTestCert_PAA_FFF2_ValInPast_PublicKey;
332329
extern const ByteSpan sTestCert_PAA_FFF2_ValInPast_PrivateKey;
333330

334-
extern const ByteSpan sTestCert_PAA_NoVID_Cert;
331+
// Cert is provided in the PAA store file as it is used in the default verifier.
335332
extern const ByteSpan sTestCert_PAA_NoVID_SKID;
336333
extern const ByteSpan sTestCert_PAA_NoVID_PublicKey;
337334
extern const ByteSpan sTestCert_PAA_NoVID_PrivateKey;

src/credentials/tests/TestDeviceAttestationCredentials.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <credentials/DeviceAttestationCredsProvider.h>
2323
#include <credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h>
2424
#include <credentials/attestation_verifier/DeviceAttestationVerifier.h>
25+
#include <credentials/attestation_verifier/TestPAAStore.h>
2526
#include <credentials/examples/DeviceAttestationCredsExample.h>
2627
#include <credentials/examples/ExampleDACs.h>
2728
#include <credentials/examples/ExamplePAI.h>

src/crypto/tests/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ chip_test_suite("tests") {
6464
cflags = [ "-Wconversion" ]
6565

6666
public_deps = [
67+
"${chip_root}/src/credentials:test_paa_store",
6768
"${chip_root}/src/credentials/tests:cert_test_vectors",
6869
"${chip_root}/src/crypto",
6970
"${chip_root}/src/lib/core",

src/crypto/tests/CHIPCryptoPALTest.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#endif
5858

5959
#include <credentials/CHIPCert.h>
60+
#include <credentials/attestation_verifier/TestPAAStore.h>
6061
#include <credentials/tests/CHIPAttCert_test_vectors.h>
6162
#include <credentials/tests/CHIPCert_test_vectors.h>
6263

0 commit comments

Comments
 (0)