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

Restyle CASE spec refresh #8649

Closed
wants to merge 20 commits into from
Closed

Restyle CASE spec refresh #8649

wants to merge 20 commits into from

Conversation

restyled-io[bot]
Copy link
Contributor

@restyled-io restyled-io bot commented Jul 27, 2021

A duplicate of #8137 with additional commits that automatically address
incorrect style, created by Restyled.

⚠️ Even though this PR is not a Fork, it contains outside contributions.
Please review accordingly.

Since the original Pull Request was opened as a fork in a contributor's
repository, we are unable to create a Pull Request branching from it with only
the style fixes.

The following Restylers made fixes:

To incorporate these changes, you can either:

  1. Merge this Pull Request instead of the original, or

  2. Ask your contributor to locally incorporate these commits and push them to
    the original Pull Request

    Expand for example instructions
    ```console
    git remote add upstream https://github.com/project-chip/connectedhomeip.git
    git fetch upstream pull/<this PR number>/head
    git merge --ff-only FETCH_HEAD
    git push
    ```
    

NOTE: As work continues on the original Pull Request, this process will
re-run and update (force-push) this Pull Request with updated style fixes as
necessary. If the style is fixed manually at any point (i.e. this process finds
no fixes to make), this Pull Request will be closed automatically.

Sorry if this was unexpected. To disable it, see our documentation.

jpk233 added 18 commits July 21, 2021 08:23
…HMAC-SHA256 Algorithm in GenerateDestinationID method.
…alCredentialSet.

Added CredentialsIndex parameter to AdminPairingTable's GetCredentials method.
Removed FabricSecret.
Removed kIPKInfo.
Removed Deprecated ComputeIPK method - Replaced it with dummy RetrieveIPK method.
…to an actual OperationalCredentialSet method to retrieve a TrustedRootId, renamed kMAX_Hash_Length refs to kSHA256_Hash_Length to match the Spec.
This method will release the last certificate data in the set.
Added call to ReleaseLastCert method during CASESession after a successful validation of the NOC certificate.
Updated CASE Unit Tests to force 3 certificates maximum. This will guarantee that for the tests to work fine,
CASESession must release the NOC certificate every time.
CASESession: change LoadCerts to LoadCert - Only NOC is transferred during CASE Protocol. No need to handle ICA
…ng a const ChipCertificateData type anymore to avoid confusion.

Removed redundant comment from ReleaseLastCert method.
Wrote some TODO items to update OperationalCredentialSet class in order to work with size_t variable counters: useful to index more than 255 Credentials.
Update DestinationIDGeneration Test to use Spec's test vectors.
Added static assert to check TBEData2 and TBEData3 Nonce Lengths : they must match.
Added new method to Estimate TLV Struct overhead.
Updated GenerateDestinationID to be stateless: now directly accesses the inputs as raw memory buffers.
Updated HandleSigma methods to handle TLV tags sequentially.
Removed redundant GetLength and GetType calls during TLV Reads.
Renamed encryptionKeyId to initiatorSessionId and responderSessionId.
Fixed typo in ENABLE_HSM_CASE_EPHEMERAL_KEY macro.
…cureSession, so it needs to be stored. Updated FindDestinationIDCandidate loop variables to size_t. Also updated names to reflect what they are indexing.
…. They can be overridden by the Unit Tests in order to feed in the test IPK vectors.
Update GetCertFabricId method to use UINT64_MAX macro as an invalid reference,
and added a final sanity check to see if there were actually any fabricIds present in the certificate.
Added doxygen to GetCredentials method.
@todo
Copy link

todo bot commented Jul 27, 2021

Switch to size_t whenever OperationalCredentialSet Class is updated to support more then 255 credentials per controller

// TODO: Switch to size_t whenever OperationalCredentialSet Class is updated to support more then 255 credentials per controller
uint8_t mCredentialsIndex = 0;
PersistentStorageDelegate * mStorageDelegate = nullptr;


This comment was generated by todo based on a TODO comment in 60a8fc4 in #8649. cc @project-chip.

@todo
Copy link

todo bot commented Jul 27, 2021

switch mOpCredCount var type to size_t in order to allow more than 255 credentials per controller.

// TODO: switch mOpCredCount var type to size_t in order to allow more than 255 credentials per controller.
uint8_t mOpCredCount; /**< Number of certificates in mOpCreds
array. We maintain the invariant that all
the slots at indices less than


This comment was generated by todo based on a TODO comment in 60a8fc4 in #8649. cc @project-chip.

@todo
Copy link

todo bot commented Jul 27, 2021

Remove TrustedRootId indexing - Replace it with size_t index.

// TODO: Remove TrustedRootId indexing - Replace it with size_t index.
const NodeCredential * GetNodeCredentialAt(const CertificateKeyId & trustedRootId) const;
P256Keypair * GetNodeKeypairAt(const CertificateKeyId & trustedRootId);
};


This comment was generated by todo based on a TODO comment in 60a8fc4 in #8649. cc @project-chip.

@todo
Copy link

todo bot commented Jul 27, 2021

move this constant over to src/crypto/CHIPCryptoPAL.h - name it CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES

// TODO: move this constant over to src/crypto/CHIPCryptoPAL.h - name it CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES
constexpr size_t kTAGSize = 16;
constexpr size_t kDestinationMessageLen = kSigmaParamRandomNumberSize + kP256_PublicKey_Length + sizeof(FabricId) + sizeof(NodeId);
#ifdef ENABLE_HSM_HKDF
using HKDF_sha_crypto = HKDF_shaHSM;
#else


This comment was generated by todo based on a TODO comment in 60a8fc4 in #8649. cc @project-chip.

@todo
Copy link

todo bot commented Jul 27, 2021

move this constant over to src/crypto/CHIPCryptoPAL.h - name it CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES

// TODO: move this constant over to src/crypto/CHIPCryptoPAL.h - name it CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES
constexpr uint16_t kAEADKeySize = 16;
constexpr uint16_t kSigmaParamRandomNumberSize = 32;


This comment was generated by todo based on a TODO comment in 60a8fc4 in #8649. cc @project-chip.

@todo
Copy link

todo bot commented Jul 27, 2021

Remove this list. Replace it with an actual method to retrieve an IPK list (e.g. from a Crypto Store API)

// TODO: Remove this list. Replace it with an actual method to retrieve an IPK list (e.g. from a Crypto Store API)
static uint8_t sIPKList[][kIPKSize] = {
{ 0 }, /* Corresponds to the FabricID for the Commissioning Example. All zeros. */
};
static ByteSpan ipkListSpan[] = { ByteSpan(sIPKList[0]) };
return ipkListSpan;
}
virtual size_t GetIPKListEntries() const { return 1; }
};
typedef struct CASESessionSerialized


This comment was generated by todo based on a TODO comment in 60a8fc4 in #8649. cc @project-chip.

@todo
Copy link

todo bot commented Jul 27, 2021

Remove this list. Replace it with an actual method to retrieve an IPK list (e.g. from a Crypto Store API)

// TODO: Remove this list. Replace it with an actual method to retrieve an IPK list (e.g. from a Crypto Store API)
static uint8_t sIPKList[][kIPKSize] = {
{ 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D,
0x1D }, /* Corresponds to the FabricID for the Node01_01 Test Vector */
};
static ByteSpan ipkListSpan[] = { ByteSpan(sIPKList[0]) };
return ipkListSpan;
}
size_t GetIPKListEntries() const override { return 1; }
};


This comment was generated by todo based on a TODO comment in 60a8fc4 in #8649. cc @project-chip.

@todo
Copy link

todo bot commented Jul 27, 2021

Rename KeyID to SessionID

// TODO: Rename KeyID to SessionID
uint16_t GetLocalKeyID() const { return mLocalKeyID; }
void SetLocalKeyID(uint16_t id) { mLocalKeyID = id; }


This comment was generated by todo based on a TODO comment in 60a8fc4 in #8649. cc @project-chip.

@restyled-io restyled-io bot force-pushed the restyled/pull-8137 branch from 60a8fc4 to c583249 Compare July 27, 2021 19:43
@restyled-io restyled-io bot closed this Jul 28, 2021
@restyled-io restyled-io bot deleted the restyled/pull-8137 branch July 28, 2021 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants