Commit 5fdae6b37e9346dbaea1e51ed6235ed0269d445d

Authored by Harvey Harrison
Committed by John W. Linville
1 parent feccb46694

mac80211: aes_ccm.c remove crypto wrapper and extra args

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 1 changed file with 17 additions and 21 deletions Side-by-side Diff

net/mac80211/aes_ccm.c
... ... @@ -16,31 +16,28 @@
16 16 #include "key.h"
17 17 #include "aes_ccm.h"
18 18  
19   -
20   -static void ieee80211_aes_encrypt(struct crypto_cipher *tfm,
21   - const u8 pt[16], u8 ct[16])
  19 +static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
22 20 {
23   - crypto_cipher_encrypt_one(tfm, ct, pt);
24   -}
25   -
26   -
27   -static inline void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
28   - u8 *b, u8 *s_0, u8 *a)
29   -{
30 21 int i;
  22 + u8 *b_0, *aad, *b, *s_0;
31 23  
32   - ieee80211_aes_encrypt(tfm, b_0, b);
  24 + b_0 = scratch + 3 * AES_BLOCK_LEN;
  25 + aad = scratch + 4 * AES_BLOCK_LEN;
  26 + b = scratch;
  27 + s_0 = scratch + AES_BLOCK_LEN;
33 28  
  29 + crypto_cipher_encrypt_one(tfm, b, b_0);
  30 +
34 31 /* Extra Authenticate-only data (always two AES blocks) */
35 32 for (i = 0; i < AES_BLOCK_LEN; i++)
36 33 aad[i] ^= b[i];
37   - ieee80211_aes_encrypt(tfm, aad, b);
  34 + crypto_cipher_encrypt_one(tfm, b, aad);
38 35  
39 36 aad += AES_BLOCK_LEN;
40 37  
41 38 for (i = 0; i < AES_BLOCK_LEN; i++)
42 39 aad[i] ^= b[i];
43   - ieee80211_aes_encrypt(tfm, aad, a);
  40 + crypto_cipher_encrypt_one(tfm, a, aad);
44 41  
45 42 /* Mask out bits from auth-only-b_0 */
46 43 b_0[0] &= 0x07;
... ... @@ -48,7 +45,7 @@
48 45 /* S_0 is used to encrypt T (= MIC) */
49 46 b_0[14] = 0;
50 47 b_0[15] = 0;
51   - ieee80211_aes_encrypt(tfm, b_0, s_0);
  48 + crypto_cipher_encrypt_one(tfm, s_0, b_0);
52 49 }
53 50  
54 51  
... ... @@ -67,7 +64,7 @@
67 64  
68 65 num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN);
69 66 last_len = data_len % AES_BLOCK_LEN;
70   - aes_ccm_prepare(tfm, b_0, aad, b, s_0, b);
  67 + aes_ccm_prepare(tfm, scratch, b);
71 68  
72 69 /* Process payload blocks */
73 70 pos = data;
74 71  
... ... @@ -79,11 +76,11 @@
79 76 /* Authentication followed by encryption */
80 77 for (i = 0; i < blen; i++)
81 78 b[i] ^= pos[i];
82   - ieee80211_aes_encrypt(tfm, b, b);
  79 + crypto_cipher_encrypt_one(tfm, b, b);
83 80  
84 81 b_0[14] = (j >> 8) & 0xff;
85 82 b_0[15] = j & 0xff;
86   - ieee80211_aes_encrypt(tfm, b_0, e);
  83 + crypto_cipher_encrypt_one(tfm, e, b_0);
87 84 for (i = 0; i < blen; i++)
88 85 *cpos++ = *pos++ ^ e[i];
89 86 }
... ... @@ -107,7 +104,7 @@
107 104  
108 105 num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN);
109 106 last_len = data_len % AES_BLOCK_LEN;
110   - aes_ccm_prepare(tfm, b_0, aad, b, s_0, a);
  107 + aes_ccm_prepare(tfm, scratch, a);
111 108  
112 109 /* Process payload blocks */
113 110 cpos = cdata;
114 111  
... ... @@ -119,13 +116,12 @@
119 116 /* Decryption followed by authentication */
120 117 b_0[14] = (j >> 8) & 0xff;
121 118 b_0[15] = j & 0xff;
122   - ieee80211_aes_encrypt(tfm, b_0, b);
  119 + crypto_cipher_encrypt_one(tfm, b, b_0);
123 120 for (i = 0; i < blen; i++) {
124 121 *pos = *cpos++ ^ b[i];
125 122 a[i] ^= *pos++;
126 123 }
127   -
128   - ieee80211_aes_encrypt(tfm, a, a);
  124 + crypto_cipher_encrypt_one(tfm, a, a);
129 125 }
130 126  
131 127 for (i = 0; i < CCMP_MIC_LEN; i++) {