瀏覽代碼

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
Abhishek Ambure 4 年之前
父節點
當前提交
5ccc3d2dcc
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      core/mac/src/pe/lim/lim_security_utils.c

+ 1 - 0
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);