Browse Source

qcacld-3.0: Initialize the PN and plumb it to DP

Initialize the PN with value, which has been given by upper layer
and plumb it to DP

Change-Id: If6b14d2b9b92e4571a85cb20dc445608d5f56961
CRs-Fixed: 2350950
Krunal Soni 6 years ago
parent
commit
bcd09fce48
1 changed files with 25 additions and 1 deletions
  1. 25 1
      core/wma/src/wma_mgmt.c

+ 25 - 1
core/wma/src/wma_mgmt.c

@@ -2023,7 +2023,31 @@ static QDF_STATUS wma_setup_install_key_cmd(tp_wma_handle wma_handle,
 		 key_params->def_key_idx);
 	WMA_LOGD("keyrsc param %llu", *(params.key_rsc_counter));
 
-	/* Set PN check & security type in data path */
+	/*
+	 * To prevent from any replay-attack, PN number provided by
+	 * upper layer is used.
+	 *
+	 * Plumb the PN number to HW which will be used to evaluate whether
+	 * incoming traffic is not replayed.
+	 *
+	 * supplicant would have some thing like following, example:
+	 *
+	 * num = 0x123456789ABCDEFF (64 bit number)
+	 * uint8_t keyrsc[16] would look like following
+	 *
+	 * bit  0      7      15      23      31      39      47      55      63
+	 *      +------+-------+-------+-------+-------+-------+-------+-------+
+	 * byte |  0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |
+	 *      +------+-------+-------+-------+-------+-------+-------+-------+
+	 * value| 0xFF |  0XDE | 0xBC  | 0x9A  | 0x78  | 0x56  | 0x34  | 0x12  |
+	 *      +------+-------+-------+-------+-------+-------+-------+-------+
+	 */
+	qdf_mem_copy(&pn[0],
+		     &key_params->key_rsc[0], sizeof(pn));
+	wma_debug("key_type[%s] pn[%x:%x:%x:%x]",
+		  (key_params->unicast) ? "unicast" : "group",
+		  key_params->key_rsc[3], key_params->key_rsc[2],
+		  key_params->key_rsc[1], key_params->key_rsc[0]);
 	cdp_set_pn_check(soc, txrx_vdev, peer, sec_type, pn);
 	cdp_set_key(soc, peer, key_params->unicast,
 		    (uint32_t *)(key_params->key_data +