diff options
author | MichaĆ Lowas-Rzechonek <michal.lowas-rzechonek@silvair.com> | 2019-06-27 09:40:42 +0200 |
---|---|---|
committer | Brian Gix <brian.gix@intel.com> | 2019-06-27 10:13:35 -0700 |
commit | 3c143c7158b956f978158f34803bf05570171861 (patch) | |
tree | 05c0b50e5aab92ee7d9ae118aea690fcae902698 /mesh/net-keys.c | |
parent | a0ced2910a4f7e7c311ab63d5e696fc761d7a4e5 (diff) | |
download | bluez-3c143c7158b956f978158f34803bf05570171861.tar.gz |
mesh: Fixed handling of IVI flag in app layer
Since IV Index is used in application nonces, we need to honor IVI flag
not only in network layer crypto, but also in application layer.
This means that if IVI field of incoming packet is different than in
current IV Index, try to decode *both* net and app layers using IV Index
decreased by one.
Diffstat (limited to 'mesh/net-keys.c')
-rw-r--r-- | mesh/net-keys.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/mesh/net-keys.c b/mesh/net-keys.c index 25f4caeb7..5be7e0b58 100644 --- a/mesh/net-keys.c +++ b/mesh/net-keys.c @@ -209,12 +209,6 @@ static void decrypt_net_pkt(void *a, void *b) uint32_t net_key_decrypt(uint32_t iv_index, const uint8_t *pkt, size_t len, uint8_t **plain, size_t *plain_len) { - bool iv_flag = !!(iv_index & 1); - bool iv_pkt = !!(pkt[0] & 0x80); - - if (iv_pkt != iv_flag) - iv_index--; - /* If we already successfully decrypted this packet, use cached data */ if (cache_id && cache_len == len && !memcmp(pkt, cache_pkt, len)) { /* IV Index must match what was used to decrypt */ |