|
31 | 31 | #include <platform/internal/GenericConfigurationManagerImpl.h>
|
32 | 32 | #include <support/Base64.h>
|
33 | 33 | #include <support/CodeUtils.h>
|
| 34 | +#include <support/CHIPMem.h> |
34 | 35 |
|
35 | 36 | #if CHIP_DEVICE_CONFIG_ENABLE_THREAD
|
36 | 37 | #include <platform/ThreadStackManager.h>
|
37 | 38 | #endif
|
38 | 39 |
|
| 40 | +#if CHIP_DEVICE_CONFIG_LOG_PROVISIONING_HASH |
| 41 | +#include <crypto/CHIPCryptoPAL.h> |
| 42 | +#endif |
| 43 | + |
39 | 44 | namespace chip {
|
40 | 45 | namespace DeviceLayer {
|
41 | 46 | namespace Internal {
|
@@ -94,7 +99,7 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_ConfigureChipStack()
|
94 | 99 |
|
95 | 100 | #if CHIP_DEVICE_CONFIG_LOG_PROVISIONING_HASH
|
96 | 101 | {
|
97 |
| - uint8_t provHash[Platform::Security::SHA256::kHashLength]; |
| 102 | + uint8_t provHash[chip::Crypto::kSHA256_Hash_Length]; |
98 | 103 | char provHashBase64[BASE64_ENCODED_LEN(sizeof(provHash)) + 1];
|
99 | 104 | err = Impl()->_ComputeProvisioningHash(provHash, sizeof(provHash));
|
100 | 105 | if (err == CHIP_NO_ERROR)
|
@@ -821,15 +826,14 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_ComputeProvisioningHash(
|
821 | 826 | CHIP_ERROR err = CHIP_NO_ERROR;
|
822 | 827 |
|
823 | 828 | #if CHIP_DEVICE_CONFIG_LOG_PROVISIONING_HASH
|
824 |
| - using HashAlgo = Platform::Security::SHA256; |
| 829 | + using HashAlgo = chip::Crypto::Hash_SHA256_stream; |
825 | 830 |
|
826 |
| - CHIP_ERROR err = CHIP_NO_ERROR; |
827 | 831 | HashAlgo hash;
|
828 | 832 | uint8_t * dataBuf = NULL;
|
829 | 833 | size_t dataBufSize;
|
830 | 834 | constexpr uint16_t kLenFieldLen = 4; // 4 hex characters
|
831 | 835 |
|
832 |
| - VerifyOrExit(hashBufSize >= HashAlgo::kHashLength, err = CHIP_ERROR_BUFFER_TOO_SMALL); |
| 836 | + VerifyOrExit(hashBufSize >= chip::Crypto::kSHA256_Hash_Length, err = CHIP_ERROR_BUFFER_TOO_SMALL); |
833 | 837 |
|
834 | 838 | // Compute a hash of the device's provisioning data. The generated hash value confirms to the form
|
835 | 839 | // described in the CHIP Chip: Factory Provisioning Specification.
|
@@ -902,7 +906,7 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_ComputeProvisioningHash(
|
902 | 906 | chip::Platform::MemoryFree(dataBuf);
|
903 | 907 |
|
904 | 908 | dataBufSize = certsLen;
|
905 |
| - dataBuf = (uint8_t *) Platform::Security::MemoryAlloc(dataBufSize); |
| 909 | + dataBuf = (uint8_t *) chip::Platform::MemoryAlloc(dataBufSize); |
906 | 910 | VerifyOrExit(dataBuf != NULL, err = CHIP_ERROR_NO_MEMORY);
|
907 | 911 | }
|
908 | 912 |
|
@@ -951,8 +955,8 @@ CHIP_ERROR GenericConfigurationManagerImpl<ImplClass>::_ComputeProvisioningHash(
|
951 | 955 | exit:
|
952 | 956 | if (dataBuf != NULL)
|
953 | 957 | {
|
954 |
| - Crypto::ClearSecretData(dataBuf, dataBufSize); |
955 |
| - Platform::Security::MemoryFree(dataBuf); |
| 958 | + chip::Crypto::ClearSecretData(dataBuf, dataBufSize); |
| 959 | + chip::Platform::MemoryFree(dataBuf); |
956 | 960 | }
|
957 | 961 | #endif // CHIP_DEVICE_CONFIG_LOG_PROVISIONING_HASH
|
958 | 962 |
|
|
0 commit comments