From 3edba3ed862bef32bcc4a0255efa09c58a45b659 Mon Sep 17 00:00:00 2001 From: Abhishek Ambure Date: Wed, 19 Aug 2020 20:06:45 +0530 Subject: [PATCH] qcacld-3.0: Prepare non-zero IV for auth seq 3 frames If the initialization vector is zero, some IOT APs unable to decrypt auth sequence 3 frame, which leads to disconnection. As IV is first 3 bytes of uninitialized "seed local variable", there are the changes of having IV value as 0. Hence host prepares non-zero initialization vector to encrypt auth sequence 3 frame. Change-Id: Ifc24ccc6c669bac3fc0389670580f6a9ec2672a0 CRs-Fixed: 2750718 --- core/mac/src/pe/lim/lim_security_utils.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/mac/src/pe/lim/lim_security_utils.c b/core/mac/src/pe/lim/lim_security_utils.c index 299f08f52c42..c76ce191cb10 100644 --- a/core/mac/src/pe/lim/lim_security_utils.c +++ b/core/mac/src/pe/lim/lim_security_utils.c @@ -517,6 +517,13 @@ lim_encrypt_auth_frame(struct mac_context *mac, uint8_t keyId, uint8_t *pKey, SIR_MAC_AUTH_FRAME_INFO_LEN + SIR_MAC_CHALLENGE_ID_LEN; keyLength += 3; + /* + * Make sure that IV is non-zero, because few IOT APs fails to decrypt + * auth sequence 3 encrypted frames if initialization vector value is 0 + */ + while (!(*(uint32_t *)seed)) + qdf_get_random_bytes(seed, SIR_MAC_WEP_IV_LENGTH); + /* Bytes 3-7 of seed is key */ qdf_mem_copy((uint8_t *) &seed[3], pKey, keyLength - 3);