All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: Jiri Benc <jbenc@suse.cz>
Cc: John Linville <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org,
	Johannes Berg <johannes@sipsolutions.net>,
	Michael Wu <flamingice@sourmilk.net>
Subject: Re: [PATCH RFC] d80211: Fix TKIP phase1 key mixing for hwcrypto
Date: Tue, 6 Feb 2007 16:02:45 +0100	[thread overview]
Message-ID: <200702061602.45510.mb@bu3sch.de> (raw)
In-Reply-To: <20070205221957.3c9003b5@griffin.suse.cz>

On Monday 05 February 2007 22:19, Jiri Benc wrote:
> On Sat, 3 Feb 2007 18:32:48 +0100, Michael Buesch wrote:
> > @@ -192,10 +192,15 @@ u8 * ieee80211_tkip_add_iv(u8 *pos, stru
> >  
> >  
> >  void ieee80211_tkip_gen_phase1key(struct ieee80211_key *key, u8 *ta,
> > -				  u16 *phase1key)
> > +				  u8 *phase1key)
> >  {
> > +	__le16 *k = (__le16 *)phase1key;
> > +	int i;
> > +
> >  	tkip_mixing_phase1(ta, &key->key[ALG_TKIP_TEMP_ENCR_KEY],
> > -			   key->u.tkip.iv32, phase1key);
> > +			   key->u.tkip.iv32, (u16 *)k);
> > +	for (i = 0; i < 5; i++)
> > +		k[i] = cpu_to_le16(k[i]);
> >  }
> 
> Maybe a slightly better type checking but still looks ugly:

Hm, well. I don't really see how typechecking is better in this case,
but if you like it more, I'm ok with it. ;)

> @@ -192,10 +192,16 @@ u8 * ieee80211_tkip_add_iv(u8 *pos, stru
>  
>  
>  void ieee80211_tkip_gen_phase1key(struct ieee80211_key *key, u8 *ta,
> -				  u16 *phase1key)
> +				  u8 *phase1key)
>  {
> +	u16 *tmp_result = (u16 *)phase1key;
> +	__le16 *k = (__le16 *)phase1key;
> +	int i;
> +
>  	tkip_mixing_phase1(ta, &key->key[ALG_TKIP_TEMP_ENCR_KEY],
> -			   key->u.tkip.iv32, phase1key);
> +			   key->u.tkip.iv32, tmp_result);
> +	for (i = 0; i < 5; i++)
> +		k[i] = cpu_to_le16(tmp_result[i]);
>  }
>  
>  void ieee80211_tkip_gen_rc4key(struct ieee80211_key *key, u8 *ta,
> 
> 
> Moreover, I'm not sure if GCC is able to optimize out the for loop in
> this case :-(

Yeah, I was going to check this and was going to add #ifdefs if it doesn't.
But that was not my major concern at this point.
It was more that people agree to me that it _is_ broken on BE platforms.
(I cannot test it, yet, as tkip has other problems for bcm43xx).

-- 
Greetings Michael.

  reply	other threads:[~2007-02-06 15:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-03 17:32 [PATCH RFC] d80211: Fix TKIP phase1 key mixing for hwcrypto Michael Buesch
2007-02-05 21:19 ` Jiri Benc
2007-02-06 15:02   ` Michael Buesch [this message]
2007-02-08 18:17     ` Jiri Benc
2007-02-06 15:33   ` d80211: Fix TKIP key type Michael Wu
2007-02-06 15:44     ` Michael Buesch
2007-02-07 11:44       ` Johannes Berg
2007-02-08 17:15     ` Michael Buesch
2007-02-08 18:22       ` Jiri Benc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200702061602.45510.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=flamingice@sourmilk.net \
    --cc=jbenc@suse.cz \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.