Skip to content

Commit

Permalink
mac80211: update to wireless-testing 2016-10-08
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Oct 13, 2016
1 parent 4379bcb commit ad51e09
Show file tree
Hide file tree
Showing 216 changed files with 977 additions and 8,597 deletions.
4 changes: 2 additions & 2 deletions package/kernel/mac80211/Makefile
Expand Up @@ -10,11 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=mac80211

PKG_VERSION:=2016-06-20
PKG_VERSION:=2016-10-08
PKG_RELEASE:=1
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
PKG_BACKPORT_VERSION:=
PKG_MD5SUM:=29c79bdc3928ef5113b17042ebda9237
PKG_MD5SUM:=4f6350e3b75815060bfdf47ef266ad613c7bfea5b7b1dc4552dee69e1bebe4fb

PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
Expand Down
@@ -1,6 +1,6 @@
--- a/compat/Makefile
+++ b/compat/Makefile
@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
@@ -36,8 +36,6 @@ compat-$(CPTCFG_KERNEL_4_7) += backport-

compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
Expand Down

This file was deleted.

@@ -1,6 +1,6 @@
--- a/.local-symbols
+++ b/.local-symbols
@@ -481,45 +481,6 @@ USB_IPHETH=
@@ -477,45 +477,6 @@ USB_IPHETH=
USB_SIERRA_NET=
USB_VL600=
USB_NET_CH9200=
Expand Down
Expand Up @@ -34,12 +34,9 @@
#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);
Expand All @@ -54,55 +51,56 @@
+ 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)
+{
u8 *data, size_t data_len, u8 *mic,
size_t mic_len)
{
- struct scatterlist sg[3];
+ 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);
Expand All @@ -125,37 +123,30 @@
- 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;
Expand All @@ -166,7 +157,10 @@
+ }
+ 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;
Expand All @@ -185,12 +179,12 @@
{
- 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;
Expand Down
Expand Up @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects

--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph
@@ -1016,7 +1016,6 @@ static int ieee80211_stop_ap(struct wiph
sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;

__sta_info_flush(sdata, true);
Expand Down
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2631,7 +2631,7 @@ static int mac80211_hwsim_new_radio(stru
@@ -2662,7 +2662,7 @@ static int mac80211_hwsim_new_radio(stru

tasklet_hrtimer_init(&data->beacon_timer,
mac80211_hwsim_beacon,
Expand Down
Expand Up @@ -18,7 +18,7 @@
static int ieee80211_ifa6_changed(struct notifier_block *nb,
unsigned long data, void *arg)
{
@@ -1090,14 +1090,14 @@ int ieee80211_register_hw(struct ieee802
@@ -1101,14 +1101,14 @@ int ieee80211_register_hw(struct ieee802
if (result)
goto fail_flows;

Expand All @@ -35,7 +35,7 @@
local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
result = register_inet6addr_notifier(&local->ifa6_notifier);
if (result)
@@ -1106,13 +1106,13 @@ int ieee80211_register_hw(struct ieee802
@@ -1117,13 +1117,13 @@ int ieee80211_register_hw(struct ieee802

return 0;

Expand All @@ -52,7 +52,7 @@
fail_ifa:
#endif
ieee80211_txq_teardown_flows(local);
@@ -1142,10 +1142,10 @@ void ieee80211_unregister_hw(struct ieee
@@ -1153,10 +1153,10 @@ void ieee80211_unregister_hw(struct ieee
tasklet_kill(&local->tx_pending_tasklet);
tasklet_kill(&local->tasklet);

Expand Down
2 changes: 1 addition & 1 deletion package/kernel/mac80211/patches/210-ap_scan.patch
@@ -1,6 +1,6 @@
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
@@ -2175,7 +2175,7 @@ static int ieee80211_scan(struct wiphy *
* the frames sent while scanning on other channel will be
* lost)
*/
Expand Down

0 comments on commit ad51e09

Please sign in to comment.