mac80211: refresh patches
authorMathias Kresin <dev@kresin.me>
Fri, 1 Jul 2016 13:41:16 +0000 (15:41 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 2 Jul 2016 17:34:50 +0000 (19:34 +0200)
Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch

index b65b0bd00e441c6d66cf4cc9c9ead4af86b6cdf8..fbe22e51b71eb513e3612d021b7c8ab62415d583 100644 (file)
  #include "aes_ccm.h"
  
 -void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
+-                             u8 *data, size_t data_len, u8 *mic,
+-                             size_t mic_len)
 +static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
 +                          u8 *a, u8 *b)
-+{
+ {
+-      struct scatterlist sg[3];
 +      int i;
 +
 +      crypto_cipher_encrypt_one(tfm, b, b_0);
 +      for (i = 0; i < AES_BLOCK_SIZE; i++)
 +              aad[i] ^= b[i];
 +      crypto_cipher_encrypt_one(tfm, a, aad);
-+
+-      char aead_req_data[sizeof(struct aead_request) +
+-                         crypto_aead_reqsize(tfm)]
+-              __aligned(__alignof__(struct aead_request));
+-      struct aead_request *aead_req = (void *) aead_req_data;
 +      /* Mask out bits from auth-only-b_0 */
 +      b_0[0] &= 0x07;
-+
+-      memset(aead_req, 0, sizeof(aead_req_data));
 +      /* S_0 is used to encrypt T (= MIC) */
 +      b_0[14] = 0;
 +      b_0[15] = 0;
 +      crypto_cipher_encrypt_one(tfm, s_0, b_0);
 +}
-+
-+
+-      sg_init_table(sg, 3);
+-      sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
+-      sg_set_buf(&sg[1], data, data_len);
+-      sg_set_buf(&sg[2], mic, mic_len);
+-      aead_request_set_tfm(aead_req, tfm);
+-      aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
+-      aead_request_set_ad(aead_req, sg[0].length);
 +void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
-                              u8 *data, size_t data_len, u8 *mic,
-                              size_t mic_len)
- {
--      struct scatterlist sg[3];
++                             u8 *data, size_t data_len, u8 *mic,
++                             size_t mic_len)
++{
 +      int i, j, last_len, num_blocks;
 +      u8 b[AES_BLOCK_SIZE];
 +      u8 s_0[AES_BLOCK_SIZE];
 +      u8 e[AES_BLOCK_SIZE];
 +      u8 *pos, *cpos;
--      char aead_req_data[sizeof(struct aead_request) +
--                         crypto_aead_reqsize(tfm)]
--              __aligned(__alignof__(struct aead_request));
--      struct aead_request *aead_req = (void *) aead_req_data;
++
 +      num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
 +      last_len = data_len % AES_BLOCK_SIZE;
 +      aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
--      memset(aead_req, 0, sizeof(aead_req_data));
++
 +      /* Process payload blocks */
 +      pos = data;
 +      cpos = data;
 +      for (j = 1; j <= num_blocks; j++) {
 +              int blen = (j == num_blocks && last_len) ?
 +                      last_len : AES_BLOCK_SIZE;
--      sg_init_table(sg, 3);
--      sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
--      sg_set_buf(&sg[1], data, data_len);
--      sg_set_buf(&sg[2], mic, mic_len);
++
 +              /* Authentication followed by encryption */
 +              for (i = 0; i < blen; i++)
 +                      b[i] ^= pos[i];
 +              crypto_cipher_encrypt_one(tfm, b, b);
--      aead_request_set_tfm(aead_req, tfm);
--      aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
--      aead_request_set_ad(aead_req, sg[0].length);
++
 +              b_0[14] = (j >> 8) & 0xff;
 +              b_0[15] = j & 0xff;
 +              crypto_cipher_encrypt_one(tfm, e, b_0);
 -                         crypto_aead_reqsize(tfm)]
 -              __aligned(__alignof__(struct aead_request));
 -      struct aead_request *aead_req = (void *) aead_req_data;
+-
+-      if (data_len == 0)
+-              return -EINVAL;
+-
+-      memset(aead_req, 0, sizeof(aead_req_data));
+-
+-      sg_init_table(sg, 3);
+-      sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
+-      sg_set_buf(&sg[1], data, data_len);
+-      sg_set_buf(&sg[2], mic, mic_len);
+-
+-      aead_request_set_tfm(aead_req, tfm);
+-      aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
+-      aead_request_set_ad(aead_req, sg[0].length);
 +      int i, j, last_len, num_blocks;
 +      u8 *pos, *cpos;
 +      u8 a[AES_BLOCK_SIZE];
 +      u8 b[AES_BLOCK_SIZE];
 +      u8 s_0[AES_BLOCK_SIZE];
--      if (data_len == 0)
--              return -EINVAL;
++
 +      num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
 +      last_len = data_len % AES_BLOCK_SIZE;
 +      aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
--      memset(aead_req, 0, sizeof(aead_req_data));
++
 +      /* Process payload blocks */
 +      cpos = data;
 +      pos = data;
 +      for (j = 1; j <= num_blocks; j++) {
 +              int blen = (j == num_blocks && last_len) ?
 +                      last_len : AES_BLOCK_SIZE;
--      sg_init_table(sg, 3);
--      sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
--      sg_set_buf(&sg[1], data, data_len);
--      sg_set_buf(&sg[2], mic, mic_len);
++
 +              /* Decryption followed by authentication */
 +              b_0[14] = (j >> 8) & 0xff;
 +              b_0[15] = j & 0xff;
 +              }
 +              crypto_cipher_encrypt_one(tfm, a, a);
 +      }
--      aead_request_set_tfm(aead_req, tfm);
--      aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
--      aead_request_set_ad(aead_req, sg[0].length);
++
 +      for (i = 0; i < mic_len; i++) {
 +              if ((mic[i] ^ s_0[i]) != a[i])
 +                      return -1;
  {
 -      struct crypto_aead *tfm;
 -      int err;
--
++      struct crypto_cipher *tfm;
 -      tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
 -      if (IS_ERR(tfm))
 -              return tfm;
-+      struct crypto_cipher *tfm;
+-
 -      err = crypto_aead_setkey(tfm, key, key_len);
 -      if (err)
 -              goto free_aead;
index 60012662e184d0859ea3232e2d80775cec6424dd..0204fa0556aa3cf1759156a2d7d06f8558394a88 100644 (file)
 +                    GFP_KERNEL);
 +      if (!led)
 +              return -ENOMEM;
--      ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
++
 +      led->gpio = gpio = (struct gpio_led *) (led + 1);
 +      _name = (char *) (led->gpio + 1);
 +
 +      ret = ath_add_led(sc, led);
 +      if (unlikely(ret < 0))
 +              kfree(led);
-+
+-      ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
 +      return ret;
  }
  
  {
 -      if (!sc->led_registered)
 -              return;
--
--      ath_led_brightness(&sc->led_cdev, LED_OFF);
--      led_classdev_unregister(&sc->led_cdev);
 +      struct ath_led *led;
  
+-      ath_led_brightness(&sc->led_cdev, LED_OFF);
+-      led_classdev_unregister(&sc->led_cdev);
+-
 -      ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
 +      while (!list_empty(&sc->leds)) {
 +              led = list_first_entry(&sc->leds, struct ath_led, list);
index be210f2d4bfc22a20b7473012000338e22622bd9..b53102bfed60d74db95bae42836ee3a17897d7ae 100644 (file)
@@ -91,8 +91,7 @@
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM_MT7620, word);
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE_MT7620, 1);
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY_MT7620, 1);
--              rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
++
 +                      rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
 +              }
 +              break;
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1);
 +                      rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
-+
+-              rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
 +                      rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
 +              }
 +              break;