software/drivers/sd8887/src/wlan/mlan/mlan_11n_rxreorder.c
/**
 *  @bref This function check PN numbers to detect replay counter attack
 *  @param pmpriv                pointer to mlan_private
 *  @param payload               pointer to mlan_buffer
 *  @param rx_reor_tbl_ptr       pointer to RxReorderTbl
 *
 *  @return                      MTRUE/MFALSE
 */
@bref This function check PN numbers to detect replay counter attack
@param pmpriv                pointer to mlan_private
@param payload               pointer to mlan_buffer
@param rx_reor_tbl_ptr       pointer to RxReorderTbl

@return                      MTRUE/MFALSE
@bref This function check PN numbers to detect replay counter attack @param pmpriv pointer to mlan_private @param payload pointer to mlan_buffer @param rx_reor_tbl_ptr pointer to RxReorderTbl @return MTRUE / MFALSE
t_u8
wlan_is_rsn_replay_attack(mlan_private *pmpriv, t_void *payload,
			  RxReorderTbl *rx_reor_tbl_ptr)
{
	RxPD *prx_pd = MNULL;
	pmlan_buffer pmbuf = MNULL;
	pmlan_adapter pmadapter = pmpriv->adapter;
	ENTER();
	pmbuf = (pmlan_buffer)payload;
	prx_pd = (RxPD *)(pmbuf->pbuf + pmbuf->data_offset);
	if (!(prx_pd->flags & RXPD_FLAG_PN_CHECK_SUPPORT)) {
		LEAVE();
		return MFALSE;
	}
	if ((prx_pd->hi_rx_count32 == rx_reor_tbl_ptr->hi_curr_rx_count32 &&
	     prx_pd->lo_rx_count16 <= rx_reor_tbl_ptr->lo_curr_rx_count16)
	    || (rx_reor_tbl_ptr->hi_curr_rx_count32 != 0xffffffff &&
		prx_pd->hi_rx_count32 < rx_reor_tbl_ptr->hi_curr_rx_count32)) {
		PRINTM(MERROR,
		       "Drop packet because of invalid PN value. Seq_num %d Last PN:0x%x 0x%x,New PN:0x%x 0x%x\n",
		       prx_pd->seq_num, rx_reor_tbl_ptr->hi_curr_rx_count32,
		       rx_reor_tbl_ptr->lo_curr_rx_count16,
		       prx_pd->hi_rx_count32, prx_pd->lo_rx_count16);
		wlan_free_mlan_buffer(pmadapter, pmbuf);
		LEAVE();
		return MTRUE;
	}
	rx_reor_tbl_ptr->lo_curr_rx_count16 = prx_pd->lo_rx_count16;
	rx_reor_tbl_ptr->hi_curr_rx_count32 = prx_pd->hi_rx_count32;
	PRINTM(MDAT_D, "seq_num %d PN:0x%x 0x%x\n", prx_pd->seq_num,
	       prx_pd->hi_rx_count32, prx_pd->lo_rx_count16);
	LEAVE();
	return MFALSE;
}
t_u8 wlan_is_rsn_replay_attack ( mlan_private * pmpriv , t_void * payload , RxReorderTbl * rx_reor_tbl_ptr ) { RxPD * prx_pd = MNULL ; pmlan_buffer pmbuf = MNULL ; pmlan_adapter pmadapter = pmpriv -> adapter ; ENTER ( ) ; pmbuf = ( pmlan_buffer ) payload ; prx_pd = ( RxPD * ) ( pmbuf -> pbuf + pmbuf -> data_offset ) ; if ( ! ( prx_pd -> flags & RXPD_FLAG_PN_CHECK_SUPPORT ) ) { LEAVE ( ) ; return MFALSE ; } if ( ( prx_pd -> hi_rx_count32 == rx_reor_tbl_ptr -> hi_curr_rx_count32 && prx_pd -> lo_rx_count16 <= rx_reor_tbl_ptr -> lo_curr_rx_count16 ) || ( rx_reor_tbl_ptr -> hi_curr_rx_count32 != 0xffffffff && prx_pd -> hi_rx_count32 < rx_reor_tbl_ptr -> hi_curr_rx_count32 ) ) { PRINTM ( MERROR , " \n " , prx_pd -> seq_num , rx_reor_tbl_ptr -> hi_curr_rx_count32 , rx_reor_tbl_ptr -> lo_curr_rx_count16 , prx_pd -> hi_rx_count32 , prx_pd -> lo_rx_count16 ) ; wlan_free_mlan_buffer ( pmadapter , pmbuf ) ; LEAVE ( ) ; return MTRUE ; } rx_reor_tbl_ptr -> lo_curr_rx_count16 = prx_pd -> lo_rx_count16 ; rx_reor_tbl_ptr -> hi_curr_rx_count32 = prx_pd -> hi_rx_count32 ; PRINTM ( MDAT_D , " \n " , prx_pd -> seq_num , prx_pd -> hi_rx_count32 , prx_pd -> lo_rx_count16 ) ; LEAVE ( ) ; return MFALSE ; }
@bref This function check PN numbers to detect replay counter attack
  @param pmpriv                pointer to mlan_private
  @param payload               pointer to mlan_buffer
  @param rx_reor_tbl_ptr       pointer to RxReorderTbl
@bref This function check PN numbers to detect replay counter attack @param pmpriv pointer to mlan_private @param payload pointer to mlan_buffer @param rx_reor_tbl_ptr pointer to RxReorderTbl