6
6
7
7
#include " credentials/CHIPCert.h"
8
8
9
+ namespace {
10
+
9
11
using namespace chip ;
10
12
using namespace chip ::Credentials;
11
13
@@ -47,11 +49,6 @@ void ChipCertFuzzer(const std::vector<std::uint8_t> & bytes)
47
49
(void ) ExtractSubjectDNFromChipCert (span, subjectDN);
48
50
}
49
51
50
- {
51
- ChipCertificateData certData;
52
- (void ) DecodeChipCert (span, certData);
53
- }
54
-
55
52
{
56
53
uint8_t outCertBuf[kMaxDERCertLength ];
57
54
MutableByteSpan outCert (outCertBuf);
@@ -61,13 +58,12 @@ void ChipCertFuzzer(const std::vector<std::uint8_t> & bytes)
61
58
{
62
59
// TODO: #34352 To Move this to a Fixture once Errors related to FuzzTest Fixtures are resolved
63
60
ASSERT_EQ (chip::Platform::MemoryInit (), CHIP_NO_ERROR);
64
- ByteSpan span (bytes.data (), bytes.size ());
65
61
ValidateChipRCAC (span);
66
62
chip::Platform::MemoryShutdown ();
67
63
}
68
64
}
69
65
70
- FUZZ_TEST (ChipCert , ChipCertFuzzer).WithDomains(Arbitrary<std::vector<std::uint8_t >>());
66
+ FUZZ_TEST (FuzzChipCert , ChipCertFuzzer).WithDomains(Arbitrary<std::vector<std::uint8_t >>());
71
67
72
68
// The Property function for DecodeChipCertFuzzer, The FUZZ_TEST Macro will call this function.
73
69
void DecodeChipCertFuzzer (const std::vector<std::uint8_t > & bytes, BitFlags<CertDecodeFlags> aDecodeFlag)
@@ -88,12 +84,12 @@ void DecodeChipCertFuzzer(const std::vector<std::uint8_t> & bytes, BitFlags<Cert
88
84
// https://github.com/google/fuzztest/blob/main/doc/domains-reference.md#elementof-domains-element-of
89
85
auto AnyCertDecodeFlag ()
90
86
{
91
-
92
87
constexpr BitFlags<CertDecodeFlags> NullDecodeFlag;
93
88
constexpr BitFlags<CertDecodeFlags> GenTBSHashFlag (CertDecodeFlags::kGenerateTBSHash );
94
89
constexpr BitFlags<CertDecodeFlags> TrustAnchorFlag (CertDecodeFlags::kIsTrustAnchor );
95
90
96
91
return ElementOf<CertDecodeFlags>({ NullDecodeFlag, GenTBSHashFlag, TrustAnchorFlag });
97
92
}
98
93
99
- FUZZ_TEST (ChipCert, DecodeChipCertFuzzer).WithDomains(Arbitrary<std::vector<std::uint8_t >>(), AnyCertDecodeFlag());
94
+ FUZZ_TEST (FuzzChipCert, DecodeChipCertFuzzer).WithDomains(Arbitrary<std::vector<std::uint8_t >>(), AnyCertDecodeFlag());
95
+ } // namespace
0 commit comments