1. 17 10月, 2016 1 次提交
    • A
      mac80211: move struct aead_req off the stack · f4a067f9
      Ard Biesheuvel 提交于
      Some crypto implementations (such as the generic CCM wrapper in crypto/)
      use scatterlists to map fields of private data in their struct aead_req.
      This means these data structures cannot live in the vmalloc area, which
      means that they cannot live on the stack (with CONFIG_VMAP_STACK.)
      
      This currently occurs only with the generic software implementation, but
      the private data and usage is implementation specific, so move the whole
      data structures off the stack into heap by allocating every time we need
      to use them.
      
      In addition, take care not to put any of our own stack allocations into
      scatterlists. This involves reserving some extra room when allocating the
      aead_request structures, and referring to those allocations in the scatter-
      lists (while copying the data from the stack before the crypto operation)
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      f4a067f9
  2. 12 5月, 2016 1 次提交
  3. 05 4月, 2016 1 次提交
  4. 24 2月, 2016 1 次提交
    • E
      mac80211: move TKIP TX IVs to public part of key struct · f8079d43
      Eliad Peller 提交于
      Some drivers/devices might want to set the IVs by
      themselves (and still let mac80211 generate MMIC).
      
      Specifically, this is needed when the device does
      offloading at certain times, and the driver has
      to make sure that the IVs of new tx frames (from
      the host) are synchronized with IVs that were
      potentially used during the offloading.
      
      Similarly to CCMP, move the TX IVs of TKIP keys to the
      public part of the key struct, and export a function
      to add the IV right into the crypto header.
      
      The public tx_pn field is defined as atomic64, so define
      TKIP_PN_TO_IV16/32 helper macros to convert it to iv16/32
      when needed.
      
      Since the iv32 used for the p1k cache is taken
      directly from the frame, we can safely remove
      iv16/32 from being protected by tkip.txlock.
      Signed-off-by: NEliad Peller <eliadx.peller@intel.com>
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      f8079d43
  5. 15 10月, 2015 1 次提交
  6. 17 7月, 2015 1 次提交
    • J
      mac80211: support device/driver PN check for CCMP/GCMP · 981d94a8
      Johannes Berg 提交于
      When there are multiple RX queues, the PN checks in mac80211 cannot be
      used since packets might be processed out of order on different CPUs.
      
      Allow the driver to report that the PN has been checked, drivers that
      will use multi-queue RX will have to set this flag.
      
      For now, the flag is only valid when the frame has been decrypted, in
      theory that restriction doesn't have to be there, but in practice the
      hardware will have decrypted the frame already.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      981d94a8
  7. 02 6月, 2015 1 次提交
    • J
      mac80211: move TX PN to public part of key struct · db388a56
      Johannes Berg 提交于
      For drivers supporting TSO or similar features, but that still have
      PN assignment in software, there's a need to have some memory to
      store the current PN value. As mac80211 already stores this and it's
      somewhat complicated to add a per-driver area to the key struct (due
      to the dynamic sizing thereof) it makes sense to just move the TX PN
      to the keyconf, i.e. the public part of the key struct.
      
      As TKIP is more complicated and we won't able to offload it in this
      way right now (fast-xmit is skipped for TKIP unless the HW does it
      all, and our hardware needs MMIC calculation in software) I've not
      moved that for now - it's possible but requires exposing a lot of
      the internal TKIP state.
      
      As an bonus side effect, we can remove a lot of code by assuming the
      keyseq struct has a certain layout - with BUILD_BUG_ON to verify it.
      
      This might also improve performance, since now TX and RX no longer
      share a cacheline.
      Reviewed-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      db388a56
  8. 17 3月, 2015 1 次提交
  9. 27 1月, 2015 4 次提交
  10. 24 10月, 2014 1 次提交
  11. 08 9月, 2014 1 次提交
  12. 21 7月, 2014 1 次提交
  13. 25 4月, 2014 1 次提交
  14. 05 2月, 2014 2 次提交
  15. 07 1月, 2014 1 次提交
  16. 26 11月, 2013 1 次提交
  17. 11 10月, 2013 1 次提交
  18. 17 5月, 2013 1 次提交
  19. 15 2月, 2013 1 次提交
  20. 05 12月, 2012 1 次提交
  21. 16 10月, 2012 1 次提交
  22. 01 10月, 2012 1 次提交
    • J
      mac80211: Fix FC masking in BIP AAD generation · 33766368
      Jouni Malinen 提交于
      The bits used in the mask were off-by-one and ended up masking PwrMgt,
      MoreData, Protected fields instead of Retry, PwrMgt, MoreData. Fix this
      and to mask the correct fields. While doing so, convert the code to mask
      the full FC using IEEE80211_FCTL_* defines similarly to how CCMP AAD is
      built.
      
      Since BIP is used only with broadcast/multicast management frames, the
      Retry field is always 0 in these frames. The Protected field is also
      zero to maintain backwards compatibility. As such, the incorrect mask
      here does not really cause any problems for valid frames. In theory, an
      invalid BIP frame with Retry or Protected field set to 1 could be
      rejected because of BIP validation. However, no such frame should show
      up with standard compliant implementations, so this does not cause
      problems in normal BIP use.
      Signed-off-by: NJouni Malinen <j@w1.fi>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      33766368
  23. 17 5月, 2012 2 次提交
  24. 14 3月, 2012 1 次提交
  25. 17 1月, 2012 1 次提交
  26. 12 1月, 2012 1 次提交
  27. 22 11月, 2011 1 次提交
  28. 12 11月, 2011 1 次提交
  29. 09 11月, 2011 1 次提交
  30. 12 10月, 2011 1 次提交
  31. 08 7月, 2011 5 次提交
    • J
      mac80211: simplify RX PN/IV handling · 9e26297a
      Johannes Berg 提交于
      The current rx->queue value is slightly confusing.
      It is set to 16 on non-QoS frames, including data,
      and then used for sequence number and PN/IV checks.
      Until recently, we had a TKIP IV checking bug that
      had been introduced in 2008 to fix a seqno issue.
      Before that, we always used TID 0 for checking the
      PN or IV on non-QoS packets.
      
      Go back to the old status for PN/IV checks using
      the TID 0 counter for non-QoS by splitting up the
      rx->queue value into "seqno_idx" and "security_idx"
      in order to avoid confusion in the future. They
      each have special rules on the value used for non-
      QoS data frames.
      
      Since the handling is now unified, also revert the
      special TKIP handling from my patch
      "mac80211: fix TKIP replay vulnerability".
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      9e26297a
    • J
      mac80211: use AES_BLOCK_SIZE · 0cd20a27
      Johannes Berg 提交于
      mac80211 has a defnition of AES_BLOCK_SIZE and
      multiple definitions of AES_BLOCK_LEN. Remove
      them all and use crypto/aes.h.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      0cd20a27
    • J
      mac80211: fix CMAC races · 75396ae6
      Johannes Berg 提交于
      Just like TKIP and CCMP, CMAC has the PN race.
      It might not actually be possible to hit it now
      since there aren't multiple ACs for management
      frames, but fix it anyway.
      
      Also move scratch buffers onto the stack.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      75396ae6
    • J
      mac80211: fix CCMP races · aba83a0b
      Johannes Berg 提交于
      Since we can process multiple packets at the
      same time for different ACs, but the PN is
      allocated from a single counter, we need to
      use an atomic value there. Use atomic64_t to
      make this cheaper on 64-bit platforms, other
      platforms will support this through software
      emulation, see lib/atomic64.c.
      
      We also need to use an on-stack scratch buf
      so that multiple packets won't corrupt each
      others scratch buffers.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      aba83a0b
    • J
      mac80211: fix TKIP races, make API easier to use · 523b02ea
      Johannes Berg 提交于
      Our current TKIP code races against itself on TX
      since we can process multiple packets at the same
      time on different ACs, but they all share the TX
      context for TKIP. This can lead to bad IVs etc.
      
      Also, the crypto offload helper code just obtains
      the P1K/P2K from the cache, and can update it as
      well, but there's no guarantee that packets are
      really processed in order.
      
      To fix these issues, first introduce a spinlock
      that will protect the IV16/IV32 values in the TX
      context. This first step makes sure that we don't
      assign the same IV multiple times or get confused
      in other ways.
      
      Secondly, change the way the P1K cache works. I
      add a field "p1k_iv32" that stores the value of
      the IV32 when the P1K was last recomputed, and
      if different from the last time, then a new P1K
      is recomputed. This can cause the P1K computation
      to flip back and forth if packets are processed
      out of order. All this also happens under the new
      spinlock.
      
      Finally, because there are argument differences,
      split up the ieee80211_get_tkip_key() API into
      ieee80211_get_tkip_p1k() and ieee80211_get_tkip_p2k()
      and give them the correct arguments.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      523b02ea