Skip to content

Commit

Permalink
Update fuzz-chip-cert driver and add corpus
Browse files Browse the repository at this point in the history
Removed ExtractSubjectDNFromX509Cert (will add into separate driver), and added additional methods instead.
Corpus extracted from unit tests.
NOTE: Corpus is *not* yet minimized.
  • Loading branch information
zcduthie committed Nov 17, 2023
1 parent edbd2b6 commit 1515885
Show file tree
Hide file tree
Showing 102 changed files with 32 additions and 8 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0,j�c) `�$7&�'&n��L7$$0 Am�C,"�X�w�j�#���Op�9>���
��J���"�� �u��3��YJ8����:wD����ì�7
5)$`0�%���]�g�R4������0�%���]�g�R4������0 @�g���[+~o�-�Z?!�=����H�RݸsТyi�n��Vߌ+R��8F7HDs?b�ݺ�>�\
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
37 changes: 29 additions & 8 deletions src/credentials/tests/FuzzChipCert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,50 @@ using namespace chip::Credentials;

extern "C" int LLVMFuzzerTestOneInput(const uint8_t * data, size_t len)
{

NodeId nodeId;
FabricId fabricId;

ByteSpan span(data, len);

(void) ExtractFabricIdFromCert(span, &fabricId);
(void) ExtractNodeIdFabricIdFromOpCert(span, &nodeId, &fabricId);
{
NodeId nodeId;
FabricId fabricId;
(void) ExtractFabricIdFromCert(span, &fabricId);
(void) ExtractNodeIdFabricIdFromOpCert(span, &nodeId, &fabricId);
}

{
ChipDN dn;
(void) ExtractSubjectDNFromX509Cert(span, dn);
CATValues cats;
(void) ExtractCATsFromOpCert(span, cats);
}

{
Credentials::P256PublicKeySpan key;
(void) ExtractPublicKeyFromChipCert(span, key);
}

{
chip::System::Clock::Seconds32 rcacNotBefore;
(void) ExtractNotBeforeFromChipCert(span, rcacNotBefore);
}

{
Credentials::CertificateKeyId skid;
(void) ExtractSKIDFromChipCert(span, skid);
}

{
ChipDN subjectDN;
(void) ExtractSubjectDNFromChipCert(span, subjectDN);
}

{
ChipCertificateData certData;
(void) DecodeChipCert(span, certData);
}

{
uint8_t outCertBuf[kMaxDERCertLength];
MutableByteSpan outCert(outCertBuf);
(void) ConvertChipCertToX509Cert(span, outCert);
}

return 0;
}

0 comments on commit 1515885

Please sign in to comment.