aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch')
-rw-r--r--package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch43
1 files changed, 22 insertions, 21 deletions
diff --git a/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch b/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch
index f2bee9b05c..d138b2c5ac 100644
--- a/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch
+++ b/package/kernel/mac80211/patches/131-Revert-mac80211-aes-cmac-switch-to-shash-CMAC-driver.patch
@@ -20,12 +20,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
-void ieee80211_aes_cmac(struct crypto_shash *tfm, const u8 *aad,
- const u8 *data, size_t data_len, u8 *mic)
+void gf_mulx(u8 *pad)
- {
-- SHASH_DESC_ON_STACK(desc, tfm);
-- u8 out[AES_BLOCK_SIZE];
++{
+ int i, carry;
-
-- desc->tfm = tfm;
++
+ carry = pad[0] & 0x80;
+ for (i = 0; i < AES_BLOCK_SIZE - 1; i++)
+ pad[i] = (pad[i] << 1) | (pad[i + 1] >> 7);
@@ -33,20 +30,17 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ if (carry)
+ pad[AES_BLOCK_SIZE - 1] ^= 0x87;
+}
-
-- crypto_shash_init(desc);
-- crypto_shash_update(desc, aad, AAD_LEN);
-- crypto_shash_update(desc, data, data_len - CMAC_TLEN);
-- crypto_shash_finup(desc, zero, CMAC_TLEN, out);
++
+void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
+ const u8 *addr[], const size_t *len, u8 *mac,
+ size_t mac_len)
-+{
+ {
+- SHASH_DESC_ON_STACK(desc, tfm);
+- u8 out[AES_BLOCK_SIZE];
+ u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
+ const u8 *pos, *end;
+ size_t i, e, left, total_len;
-
-- memcpy(mic, out, CMAC_TLEN);
++
+ memset(cbc, 0, AES_BLOCK_SIZE);
+
+ total_len = 0;
@@ -93,10 +87,14 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ pad[i] ^= cbc[i];
+ crypto_cipher_encrypt_one(tfm, pad, pad);
+ memcpy(mac, pad, mac_len);
- }
++}
--void ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad,
-+
+- desc->tfm = tfm;
+
+- crypto_shash_init(desc);
+- crypto_shash_update(desc, aad, AAD_LEN);
+- crypto_shash_update(desc, data, data_len - CMAC_TLEN);
+- crypto_shash_finup(desc, zero, CMAC_TLEN, out);
+void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
+ const u8 *data, size_t data_len, u8 *mic)
+{
@@ -111,10 +109,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ len[1] = data_len - CMAC_TLEN;
+ addr[2] = zero;
+ len[2] = CMAC_TLEN;
-+
+
+- memcpy(mic, out, CMAC_TLEN);
+ aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN);
-+}
-+
+ }
+
+-void ieee80211_aes_cmac_256(struct crypto_shash *tfm, const u8 *aad,
+void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
const u8 *data, size_t data_len, u8 *mic)
{
@@ -122,8 +122,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ const u8 *addr[3];
+ size_t len[3];
+ u8 zero[CMAC_TLEN_256];
-
-- desc->tfm = tfm;
++
+ memset(zero, 0, CMAC_TLEN_256);
+ addr[0] = aad;
+ len[0] = AAD_LEN;
@@ -132,6 +131,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+ addr[2] = zero;
+ len[2] = CMAC_TLEN_256;
+- desc->tfm = tfm;
+-
- crypto_shash_init(desc);
- crypto_shash_update(desc, aad, AAD_LEN);
- crypto_shash_update(desc, data, data_len - CMAC_TLEN_256);