Skip to content

Commit

Permalink
Simplicity SDK 2024.12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
silabsbot committed Feb 8, 2025
1 parent 8627f84 commit 7f1b2fe
Show file tree
Hide file tree
Showing 6,579 changed files with 139,956 additions and 12,554 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=com.silabs.sdk.stack.sisdk

version=2024.12.0
version=2024.12.1

label=Simplicity SDK Suite
description=Simplicity SDK Suite
Expand Down
798 changes: 190 additions & 608 deletions app/bluetooth/bluetooth_experimental_demos.xml

Large diffs are not rendered by default.

68 changes: 34 additions & 34 deletions app/bluetooth/bluetooth_experimental_templates.xml

Large diffs are not rendered by default.

124 changes: 74 additions & 50 deletions app/bluetooth/bluetooth_internal_demos.xml

Large diffs are not rendered by default.

775 changes: 387 additions & 388 deletions app/bluetooth/bluetooth_production_demos.xml

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions app/bluetooth/bluetooth_production_templates.xml

Large diffs are not rendered by default.

98 changes: 66 additions & 32 deletions app/bluetooth/common/ead_core/sl_bt_ead_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
******************************************************************************/
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "sl_common.h"
#include "sl_memory_manager.h"
#include "psa/crypto.h"
#include "sl_bt_ead_core.h"
#include "psa/crypto_values.h"
#include "mbedtls/platform_util.h"
#include "sli_protocol_crypto.h"
#include "sl_bt_ead_core_config.h"

Expand All @@ -53,9 +53,14 @@ static const uint8_t aad[] = { SL_BT_ENCRYPTED_DATA_B1_HEADER };
sl_status_t sl_bt_ead_randomizer_update(sl_bt_ead_nonce_p nonce)
{
sl_status_t result = SL_STATUS_FAIL;
// Keep calling the psa_crypto_init() as it allows doing so, explicitly
// (see the comment in it's implementation) This is safer than accidentally
// not doing it at all.
psa_status_t status = psa_crypto_init();

assert(nonce != NULL);
if (nonce == NULL) {
return SL_STATUS_NULL_POINTER;
}

if (status == PSA_SUCCESS) {
status = psa_generate_random((uint8_t *)(nonce->randomizer),
Expand All @@ -76,7 +81,9 @@ sl_status_t sl_bt_ead_randomizer_set(sl_bt_ead_randomizer_t randomizer,
{
sl_status_t result = SL_STATUS_NOT_SUPPORTED;

assert(nonce != NULL);
if (nonce == NULL) {
return SL_STATUS_NULL_POINTER;
}

if (randomizer != NULL) {
memcpy((void *)(nonce->randomizer),
Expand Down Expand Up @@ -152,7 +159,7 @@ sl_status_t sl_bt_ead_store_key(psa_key_usage_t key_usage,
key_id);

if (status == PSA_SUCCESS) {
memset(key_material->key, 0, sizeof(key_material->key));
mbedtls_platform_zeroize(key_material->key, sizeof(key_material->key));
key_material->key_id = *key_id;
result = SL_STATUS_OK;
}
Expand All @@ -166,7 +173,7 @@ sl_status_t sl_bt_ead_store_key(psa_key_usage_t key_usage,
}

// Sanitize the copy before leaving as it is not needed anymore
memset(tmp, 0, sizeof(tmp));
mbedtls_platform_zeroize(tmp, sizeof(tmp));
}

return result;
Expand Down Expand Up @@ -194,7 +201,8 @@ sl_status_t sl_bt_ead_delete_key(sl_bt_ead_key_material_p key_material)
#endif // (SL_BT_EAD_CORE_ACCELERATOR == SL_BT_EAD_CORE_USE_RADIOAES)

if (result == SL_STATUS_OK) {
memset(key_material, 0, sizeof(struct sl_bt_ead_key_material_s));
mbedtls_platform_zeroize(key_material,
sizeof(struct sl_bt_ead_key_material_s));
}
return result;
}
Expand Down Expand Up @@ -240,11 +248,15 @@ sl_status_t sl_bt_ead_encrypt(sl_bt_ead_key_material_p key_material,
const size_t output_size = length + SL_BT_EAD_MIC_SIZE;
#endif // (SL_BT_EAD_CORE_ACCELERATOR == SL_BT_EAD_CORE_USE_PSA_ACC)

assert(key_material != NULL);
assert(nonce != NULL);
assert(length >= 1);
assert(data != NULL);
assert(mic != NULL);
if (key_material == NULL
|| nonce == NULL
|| data == NULL
|| mic == NULL) {
return SL_STATUS_NULL_POINTER;
}
if (length < 1) {
return SL_STATUS_INVALID_COUNT;
}

#if (SL_BT_EAD_CORE_ACCELERATOR == SL_BT_EAD_CORE_USE_RADIOAES)
// Use the RADIOAES accelerator instead of PSA Crypto library
Expand Down Expand Up @@ -280,7 +292,8 @@ sl_status_t sl_bt_ead_encrypt(sl_bt_ead_key_material_p key_material,

// Purge the key copies, if any
psa_purge_key(key_material->key_id);

// Purge local buffer
mbedtls_platform_zeroize(output_data, sizeof(output_data));
sl_free(output_data);
output_data = NULL;
}
Expand All @@ -305,10 +318,16 @@ sl_status_t sl_bt_ead_decrypt(sl_bt_ead_key_material_p key_material,
size_t output_length;
const size_t output_size = length + SL_BT_EAD_MIC_SIZE;
#endif // (SL_BT_EAD_CORE_ACCELERATOR == SL_BT_EAD_CORE_USE_PSA_ACC)
assert(key_material != NULL);
assert(length >= 1);
assert(data != NULL);
assert(mic != NULL);

if (key_material == NULL
|| nonce == NULL
|| mic == NULL
|| data == NULL) {
return SL_STATUS_NULL_POINTER;
}
if (length < 1) {
return SL_STATUS_INVALID_COUNT;
}

#if (SL_BT_EAD_CORE_ACCELERATOR == SL_BT_EAD_CORE_USE_RADIOAES)
// Use the RADIOAES accelerator instead of PSA Crypto library
Expand Down Expand Up @@ -367,10 +386,14 @@ sl_status_t sl_bt_ead_unpack_decrypt(sl_bt_ead_key_material_p key_material,
sl_status_t result = SL_STATUS_INVALID_TYPE;
uint32_t data_length;

assert(key_material != NULL);
assert(length != NULL);
assert(data != NULL);
assert(*data != NULL);
if (key_material == NULL
|| data == NULL
|| length == NULL) {
return SL_STATUS_NULL_POINTER;
}
if (*data == NULL) {
return SL_STATUS_INVALID_PARAMETER;
}

data_length = (uint32_t)(*data)[0];
// Check if the encrypted data has the minimum expected size
Expand Down Expand Up @@ -406,7 +429,7 @@ sl_status_t sl_bt_ead_unpack_decrypt(sl_bt_ead_key_material_p key_material,
}
}
// Sanitize nonce copy
memset(&nonce, 0, sizeof(nonce));
mbedtls_platform_zeroize(&nonce, sizeof(nonce));
}

return result;
Expand All @@ -424,14 +447,18 @@ sl_status_t sl_bt_ead_pack_ad_data(sl_bt_ead_ad_structure_p ad_info,
uint32_t data_index;

// Check for invalid parameters
assert(ad_info != NULL);
assert(size != NULL);
assert(pack_buf != NULL);
if (ad_info == NULL
|| size == NULL
|| pack_buf == NULL) {
return SL_STATUS_NULL_POINTER;
}

// Check for uninitialized ad_info structure
assert(ad_info->randomizer != NULL);
assert(ad_info->ad_data != NULL);
assert(ad_info->mic != NULL);
if (ad_info->randomizer == NULL
|| ad_info->ad_data == NULL
|| ad_info->mic == NULL) {
return SL_STATUS_INVALID_PARAMETER;
}

// Check for valid encrypted length
if (ad_info->length < 1) {
Expand Down Expand Up @@ -475,11 +502,18 @@ sl_status_t sl_bt_ead_unpack_ad_data(uint8_t *packed_data,
sl_status_t result = SL_STATUS_INVALID_TYPE;
uint32_t data_length;

assert(packed_data != NULL);
assert(ad_info != NULL);
assert(ad_info->randomizer != NULL);
assert(ad_info->ad_data != NULL);
assert(ad_info->mic != NULL);
// Check for invalid parameters
if (ad_info == NULL
|| packed_data == NULL) {
return SL_STATUS_NULL_POINTER;
}

// Check for uninitialized ad_info structure
if (ad_info->randomizer == NULL
|| ad_info->ad_data == NULL
|| ad_info->mic == NULL) {
return SL_STATUS_INVALID_PARAMETER;
}

data_length = (uint32_t)packed_data[0];
ad_info->ad_type = packed_data[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* 3. This notice may not be removed or altered from any source distribution.
*
******************************************************************************/
#include "em_iadc.h"
#include "sl_common.h"
#include "sl_core.h"
#include "sl_status.h"
Expand Down
4 changes: 4 additions & 0 deletions app/bluetooth/common/esl_tag_core/src/esl_tag_opcodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,10 @@ sl_status_t esl_core_process_opcode(esl_id_t self_id,
bool has_notifications = esl_core_has_notifications();
bool needs_response = (has_notifications || (id == self_id));

// validate data pointers before use, they must never be NULL
if (data == NULL || *data == NULL) {
return SL_STATUS_NULL_POINTER;
}
// process only TLVs addressed to this ESL Tag or broadcasted (only over PAwR!)
if (id == self_id || (id == ESL_BROADCAST_ID && !has_notifications)) {
#ifdef ESL_TAG_VENDOR_OPCODES_ENABLED
Expand Down
5 changes: 4 additions & 1 deletion app/bluetooth/common/esl_tag_core/src/esl_tag_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ sl_status_t esl_core_build_response(tlv_t tlv, const void *input_data)
uint8_t length = esl_core_get_tlv_len(tlv);
const uint8_t *data = (uint8_t *)input_data;

if (esl_response_queue.size - esl_response_queue.count > length) {
if (data == NULL) {
// input data pointer shall never be NULL
return SL_STATUS_NULL_POINTER;
} else if (esl_response_queue.size - esl_response_queue.count > length) {
queueAdd(&esl_response_queue, (void *)(uint32_t)tlv);

while (length--) {
Expand Down
Loading

0 comments on commit 7f1b2fe

Please sign in to comment.