This is an automated email from the ASF dual-hosted git repository. sjanc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 52342c45271891658ab4f52bbfd7437e8268f8b1 Author: raiden00pl <[email protected]> AuthorDate: Wed Oct 14 13:51:35 2026 +0200 nimble/mesh: Skip empty segments in AES-CMAC bt_mesh_k2() passes an empty first segment with a NULL pointer to bt_mesh_aes_cmac(). mbedtls_cipher_cmac_update() rejects NULL input even when the length is zero, so k2 fails and provisioning cannot create the subnet ("Unable to generate NID, EncKey & PrivacyKey"). Skip zero-length segments; they do not change the MAC. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: raiden00pl <[email protected]> --- nimble/host/mesh/src/crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nimble/host/mesh/src/crypto.c b/nimble/host/mesh/src/crypto.c index 90488b766..6121ea027 100644 --- a/nimble/host/mesh/src/crypto.c +++ b/nimble/host/mesh/src/crypto.c @@ -40,7 +40,7 @@ int bt_mesh_aes_cmac(const uint8_t key[16], struct bt_mesh_sg *sg, } for (; sg_len; sg_len--, sg++) { - if (mbedtls_cipher_cmac_update(&ctx, sg->data, sg->len)) { + if (sg->len && mbedtls_cipher_cmac_update(&ctx, sg->data, sg->len)) { goto done; } }
