linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Emmanuel Grumbach <egrumbach@gmail.com>
Cc: alexander.wetzel@web.de, Jouni Malinen <j@w1.fi>,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: mac80211 drops packet with old IV after rekeying
Date: Sun, 17 May 2015 22:22:20 +0200	[thread overview]
Message-ID: <1431894140.2129.20.camel@sipsolutions.net> (raw)
In-Reply-To: <CANUX_P0cJc4Ww5AY7sNFL5z4EPit+ngHvX=4eFXF96K-E8p3MA@mail.gmail.com> (sfid-20150517_221304_420222_D8022C07)

On Sun, 2015-05-17 at 23:13 +0300, Emmanuel Grumbach wrote:

> >> Yeah - ok. But how come we *already* set the pointer to the new key
> >> while the HW is still successfully decrypting with the old key. This
> >> is the point I can' figure out. I'd expect the transmitting side to
> >> stop using the old key prior to sending the EAPOL (which #triggers the
> >> set key pointer line). So those 2 lines don't make sense to me:
> >>
> >> >  # set key pointer to new key
> >> >  * data RX in HW, decrypt w/ old key, PN=999
> >>
> >> After all, the Rx path is serialized all the way through from the air
> >> to mac80211. The only thing I can think about is that the sending side
> >> is still using the old key *after* it already sent its EAPOL frames.
> >
> > Not sure, isn't the key only installed on EAPOL acknowledgement or so?
> > With PTK rekeying, I'm not really sure what the timing is, and there's
> > not really any way it can be correct (without extended key ID support.)
> 
> Whatever the timing is, since the Rx path is serialized, there
> shouldn't be any timing issues. Or at least, I can't figure out how
> these lines above could be in the order you put them.

I agree that it'll depend on how the key is installed on the sender,
however, I have no idea how that's done and how much potential delay
there is between sending the EAPOL frame and installing the key there.
If you're looking at RX path synchronisation only then you're assuming a
perfect sender, but that clearly cannot be the case.

> > Actually, yes, this *could* happen, in exactly the same way as on the
> > receiver, with hardware crypto that does PN generation in software. Not
> > on iwlwifi, because we copy the key material into the TX command, but on
> > any hardware that uses hw_key_idx to identify the key, and could replace
> > the key:
> >
> >  * mac80211: encrypt TX frame - assign PN, ((tx_info
> > *)skb->cb)->hw_key_idx = 7
> >  * mac80211: replace key with new key
> >    * driver: remove old key from hw accel (hw_key_idx 7)
> >    * driver: insert new key to hw accel (reusing hw_key_idx 7)
> >
> 
> This seems to be exactly what the submitter is mentioning: new key old PN.
> I don't really know how we can determine what key was used though.
> Maybe by just trying to decrypt in wireshark with the new key and
> check.

Then it'd actually be more of a sender problem, not sure how to solve it
there.

johannes


  reply	other threads:[~2015-05-17 20:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15  6:48 mac80211 drops packet with old IV after rekeying Emmanuel Grumbach
2015-05-15  7:25 ` Johannes Berg
2015-05-15  7:52   ` Emmanuel Grumbach
2015-05-15 18:35     ` Johannes Berg
2015-05-16 18:18       ` Emmanuel Grumbach
2015-05-16 19:57         ` Johannes Berg
2015-05-17 16:05           ` Jouni Malinen
2015-05-17 18:23             ` Emmanuel Grumbach
2015-05-17 19:25               ` Johannes Berg
2015-05-17 19:49                 ` Emmanuel Grumbach
2015-05-17 20:05                   ` Johannes Berg
2015-05-17 20:13                     ` Emmanuel Grumbach
2015-05-17 20:22                       ` Johannes Berg [this message]
2015-05-18  6:14                         ` Peer, Ilan
2015-05-18  8:03                           ` Janusz Dziedzic
2015-05-18 14:40                             ` Ben Greear
2015-05-18 15:02                           ` Johannes Berg
2015-05-18 19:34                             ` Emmanuel Grumbach
2015-05-18 19:47                             ` Alexander Wetzel
2015-05-18 21:55                               ` Johannes Berg
2015-05-20 20:55                                 ` mac80211 drops packet with old IV after rekeying - workaround patch for CCMP Alexander Wetzel
2015-05-21  7:11                                   ` Johannes Berg
2015-05-17 19:14             ` mac80211 drops packet with old IV after rekeying Johannes Berg

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=1431894140.2129.20.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=alexander.wetzel@web.de \
    --cc=egrumbach@gmail.com \
    --cc=j@w1.fi \
    --cc=linux-wireless@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).