Re: [PATCH] staging: rtl8192u: ieee80211: Silence sparse warning
From: Gaston Gonzalez
Date: Wed May 06 2015 - 23:10:39 EST
On 27/04/15 07:12, Dan Carpenter wrote:
> Can't we just export the tkip.c function?
>
> regards,
> dan carpenter
>
Hi Dan,
(sorry for the delayed response)
The inputs of the two implementations of tkip_mixing_phase2() differ in
one parameter:
- ieee80211_crypt_tkip.c expects 'const u16 *TTAK'
- tkip.c expects 'struct tkip_ctx *ctx'
tkip_mixing_phase2() is called two times in ieee80211_crypt_tkip.c:
git grep tkip_mixing_phase2 drivers/staging/rtl8192u/ieee80211/
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:static void
tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK,
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:
tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16);
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:
tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
tkey is a 'struct ieee80211_tkip_data', which differs from tkip_ctx
structure. So in the case of exporting the tkip.c function, we would
need to add 'struct tkip_ctx' definition, and not just change the
function input definition.
The only member of tkip_ctx structure used in tkip_mixing_phase2() is
p1k, which is the equivalent of TTAK array in ieee80211_crypt_tkip.c .
Thus - I'm new to this so I may be missing something - one way would be
to just add the tkip_ctx structure definition in ieee80211_crypt_tkip.c.
The down side of doing this is that there would be some parameters
defined twice in two different structures: u32 iv32, u16 iv16, u16
p1k[5], u32 p1k_iv32
Another way would be split ieee80211_tkip_data structure in struct
tkip_ctx on one side, and leave the rest of the members on the original
structure. This would avoid to duplicate the members definitions, but I
guess that approach could broke other things...
As I said, I'm new to this so I may be missing something, maybe a
different approach?
One detail: although not used in the function, 'enum
ieee80211_internal_tkip_state state' is not defined in 'struct
ieee80211_tkip_data', thus in any case that definition would have to be
added.
regards,
Gaston
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/