Bluetooth: Mesh: crypto: Remove unnecessary #ifdefs

Static variables and functions don't need #ifdefs if the code calling
them is using IS_ENABLED(). If IS_ENABLED() evaluates to false the
compiler will strip out all the static entities.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2019-10-04 10:53:42 +03:00 committed by Johan Hedberg
commit bca12197fd

View file

@ -521,7 +521,6 @@ static int bt_mesh_ccm_encrypt(const u8_t key[16], u8_t nonce[13],
return 0;
}
#if defined(CONFIG_BT_MESH_PROXY)
static void create_proxy_nonce(u8_t nonce[13], const u8_t *pdu,
u32_t iv_index)
{
@ -547,7 +546,6 @@ static void create_proxy_nonce(u8_t nonce[13], const u8_t *pdu,
/* IV Index */
sys_put_be32(iv_index, &nonce[9]);
}
#endif /* PROXY */
static void create_net_nonce(u8_t nonce[13], const u8_t *pdu,
u32_t iv_index)
@ -612,15 +610,11 @@ int bt_mesh_net_encrypt(const u8_t key[16], struct net_buf_simple *buf,
mic_len);
BT_DBG("PDU (len %u) %s", buf->len, bt_hex(buf->data, buf->len));
#if defined(CONFIG_BT_MESH_PROXY)
if (proxy) {
if (IS_ENABLED(CONFIG_BT_MESH_PROXY) && proxy) {
create_proxy_nonce(nonce, buf->data, iv_index);
} else {
create_net_nonce(nonce, buf->data, iv_index);
}
#else
create_net_nonce(nonce, buf->data, iv_index);
#endif
BT_DBG("Nonce %s", bt_hex(nonce, 13));
@ -643,15 +637,11 @@ int bt_mesh_net_decrypt(const u8_t key[16], struct net_buf_simple *buf,
BT_DBG("iv_index %u, key %s mic_len %u", iv_index, bt_hex(key, 16),
mic_len);
#if defined(CONFIG_BT_MESH_PROXY)
if (proxy) {
if (IS_ENABLED(CONFIG_BT_MESH_PROXY) && proxy) {
create_proxy_nonce(nonce, buf->data, iv_index);
} else {
create_net_nonce(nonce, buf->data, iv_index);
}
#else
create_net_nonce(nonce, buf->data, iv_index);
#endif
BT_DBG("Nonce %s", bt_hex(nonce, 13));