From 5ccc3d2dcc280d5c0016557a7e7913199b5980bf Mon Sep 17 00:00:00 2001 From: Abhishek Ambure Date: Mon, 14 Sep 2020 11:36:17 +0530 Subject: [PATCH] qcacld-3.0: Generate the IV and repeat until it is non-zero If the IV value is zero then some IOT APs fail to decrypt WEP AUTH frame hence host gets random value of IV using qdf_get_random_bytes(). Presently host checks if the IV is non-zero value in "seed" which is local uninitialized variable, static analysis tool reports an error "seed array elements are used uninitiated". In order to address both these issues, generate the IV using qdf_get_random_bytes() first and if it is zero, then repeat invoking qdf_get_random_bytes() until it is non-zero. Change-Id: Ib211e58ebe21d49ab1dc693ee8a6cad9bfd25ae8 CRs-Fixed: 2775943 --- core/mac/src/pe/lim/lim_security_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/core/mac/src/pe/lim/lim_security_utils.c b/core/mac/src/pe/lim/lim_security_utils.c index c76ce191cb10..a88292212062 100644 --- a/core/mac/src/pe/lim/lim_security_utils.c +++ b/core/mac/src/pe/lim/lim_security_utils.c @@ -521,6 +521,7 @@ lim_encrypt_auth_frame(struct mac_context *mac, uint8_t keyId, uint8_t *pKey, * 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 */ + qdf_get_random_bytes(seed, SIR_MAC_WEP_IV_LENGTH); while (!(*(uint32_t *)seed)) qdf_get_random_bytes(seed, SIR_MAC_WEP_IV_LENGTH);