Skip to content

Commit a35da4f

Browse files
theob-prorlubos
authored andcommitted
[nrf fromlist] Bluetooth: Host: Use memset to initialize psa_mac_operation_t
In `db_hash_setup()` the state object for MAC operations was initialized using `psa_mac_operation_init()`. This function was not always optimized or inlined. A way to reduce stack usage is to use `memset()` and set the object to 0. This is one of the option documented to initialize `psa_mac_operation_t` object. Upstream PR #: 86094 Signed-off-by: Théo Battrel <[email protected]>
1 parent b36b947 commit a35da4f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/bluetooth/host/gatt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ static int db_hash_setup(struct gen_hash_state *state, uint8_t *key)
717717
LOG_ERR("Unable to import the key for AES CMAC %d", ret);
718718
return -EIO;
719719
}
720-
state->operation = psa_mac_operation_init();
720+
memset(&state->operation, 0, sizeof(state->operation));
721721

722722
ret = psa_mac_sign_setup(&(state->operation), state->key, PSA_ALG_CMAC);
723723
if (ret != PSA_SUCCESS) {

0 commit comments

Comments
 (0)