Skip to content

Commit

Permalink
Pull request project-chip#1525: Cherry-Pick Add handling for SetAliro…
Browse files Browse the repository at this point in the history
…ReaderConfig and ClearAliroReaderConfig commands (project-chip#31700)

Merge in WMN_TOOLS/matter from cherry-pick/dl_aliro to RC_2.3.0-1.3

Squashed commit of the following:

commit 471bcc1d95bc35bb13a7e02e481d81ec9e4f00d7
Author: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com>
Date:   Tue Jan 30 16:37:46 2024 -0800

    Add handling for SetAliroReaderConfig and ClearAliroReaderConfig commands (project-chip#31700)

    * Add handling for SetAliroReaderConfig and ClearAliroReaderConfig commands

    Add a delegate for the door lock to provide the attribute data for the aliro attributes

    * Apply suggestions from code review

    Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>

    * Address review comments

    * Apply suggestions from code review

    Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>

    * Addressed more review comments

    * Apply suggestions from code review

    Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>

    * Add an AttributeNullabilityType enum instead of boolean to indicate if an attribute is nullable or not

    * Restyled by clang-format

    * Make AttributeNullabilityType enum private

    ---------

    Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
    Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
jmartinez-silabs committed Feb 1, 2024
1 parent d1fe8e7 commit 135dab9
Show file tree
Hide file tree
Showing 4 changed files with 557 additions and 3 deletions.
133 changes: 133 additions & 0 deletions src/app/clusters/door-lock-server/door-lock-delegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <app-common/zap-generated/cluster-objects.h>

namespace chip {
namespace app {
namespace Clusters {
namespace DoorLock {

static constexpr size_t kAliroReaderVerificationKeySize = 65;

static constexpr size_t kAliroReaderGroupIdentifierSize = 16;

static constexpr size_t kAliroReaderGroupSubIdentifierSize = 16;

static constexpr size_t kAliroGroupResolvingKeySize = 16;

static constexpr size_t kAliroProtocolVersionSize = 2;

static constexpr size_t kAliroSigningKeySize = 32;

/** @brief
* Defines methods for implementing application-specific logic for the door lock cluster.
* It defines the interfaces that a door lock should implement to support Aliro provisioning attributes.
*/

class Delegate
{
public:
Delegate() = default;

virtual ~Delegate() = default;

/**
* @brief Get the Aliro verification key component of the Reader's key pair.
*
* @param[out] verificationKey The MutableByteSpan to copy the verification key into. On success,
* the callee must update the length to the length of the copied data. If the value of
* the attribute is null, the callee must set the MutableByteSpan to empty.
*/
virtual CHIP_ERROR GetAliroReaderVerificationKey(MutableByteSpan & verificationKey) = 0;

/**
* @brief Get the Aliro Reader's group identifier
*
* @param[out] groupIdentifier The MutableByteSpan to copy the group identifier into. On success,
* the callee must update the length to the length of the copied data. If the value of
* the attribute is null, the callee must set the MutableByteSpan to empty.
*/
virtual CHIP_ERROR GetAliroReaderGroupIdentifier(MutableByteSpan & groupIdentifier) = 0;

/**
* @brief Get the Aliro Reader's group subidentifier
*
* @param[out] groupSubIdentifier The MutableByteSpan to copy the group subidentifier into. On success,
* the callee must update the length to the length of the copied data. The MutableByteSpan
* must not be empty since the attribute is not nullable.
*/
virtual CHIP_ERROR GetAliroReaderGroupSubIdentifier(MutableByteSpan & groupSubIdentifier) = 0;

/**
* @brief Get the Aliro expedited transaction supported protocol version at the given index.
*
* @param[in] index The index of the protocol version in the list.
* @param[out] protocolVersion The MutableByteSpan to copy the expedited transaction supported protocol version at the given
* index into. On success, the callee must update the length to the length of the copied data.
* @return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is out of range for the attribute list.
*/
virtual CHIP_ERROR GetAliroExpeditedTransactionSupportedProtocolVersionAtIndex(size_t index,
MutableByteSpan & protocolVersion) = 0;

/**
* @brief Get the Reader's group resolving key.
*
* @param[out] groupResolvingKey The MutableByteSpan to copy the group resolving key into. On success,
* the callee must update the length to the length of the copied data. If the value of
* the attribute is null, the callee must set the MutableByteSpan to empty.
*/
virtual CHIP_ERROR GetAliroGroupResolvingKey(MutableByteSpan & groupResolvingKey) = 0;

/**
* @brief Get the Aliro supported BLE UWB protocol version at the given index.
*
* @param[in] index The index of the protocol version in the list.
* @param[out] protocolVersion The MutableByteSpan to copy the supported BLE UWB protocol version at the given index into.
* On success, the callee must update the length to the length of the copied data.
* @return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is out of range for the attribute list.
*/
virtual CHIP_ERROR GetAliroSupportedBLEUWBProtocolVersionAtIndex(size_t index, MutableByteSpan & protocolVersion) = 0;

/**
* @brief Get the Aliro BLE Advertising Version.
*
* @return The BLE Advertising Version.
*/
virtual uint8_t GetAliroBLEAdvertisingVersion() = 0;

/**
* @brief Get the maximum number of Aliro credential issuer keys supported.
*
* @return The max number of Aliro credential issuer keys supported.
*/
virtual uint16_t GetNumberOfAliroCredentialIssuerKeysSupported() = 0;

/**
* @brief Get the maximum number of Aliro endpoint keys supported.
*
* @return The max number of Aliro endpoint keys supported.
*/
virtual uint16_t GetNumberOfAliroEndpointKeysSupported() = 0;
};

} // namespace DoorLock
} // namespace Clusters
} // namespace app
} // namespace chip
12 changes: 12 additions & 0 deletions src/app/clusters/door-lock-server/door-lock-server-callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,15 @@ emberAfPluginDoorLockGetFaceCredentialLengthConstraints(chip::EndpointId endpoin
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockSetAliroReaderConfig(EndpointId endpointId, const ByteSpan & signingKey, const ByteSpan & verificationKey,
const ByteSpan & groupIdentifier, const Optional<ByteSpan> groupResolvingKey)
{
return false;
}

bool __attribute__((weak)) emberAfPluginDoorLockClearAliroReaderConfig(chip::EndpointId endpointId)
{
return false;
}
Loading

0 comments on commit 135dab9

Please sign in to comment.