aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/aes_ccm.c
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-07-02 19:30:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-07-08 14:16:02 -0400
commitfeccb466944cb1aeaabc701cfde6771f3be74919 (patch)
tree62da55862059f4adb4858376b4698f1d81afbec4 /net/mac80211/aes_ccm.c
parentc34498b9e633baa3266af98106502633b6bc371b (diff)
mac80211: pass scratch buffer directly, remove additional pointers
Recalculate the offset pointers in the ccmp calculations rather than in the callers. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/aes_ccm.c')
-rw-r--r--net/mac80211/aes_ccm.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c
index 4d4c2dfcf9a0..e756ed931164 100644
--- a/net/mac80211/aes_ccm.c
+++ b/net/mac80211/aes_ccm.c
@@ -53,15 +53,17 @@ static inline void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
53 53
54 54
55void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch, 55void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
56 u8 *b_0, u8 *aad, u8 *data, size_t data_len, 56 u8 *data, size_t data_len,
57 u8 *cdata, u8 *mic) 57 u8 *cdata, u8 *mic)
58{ 58{
59 int i, j, last_len, num_blocks; 59 int i, j, last_len, num_blocks;
60 u8 *pos, *cpos, *b, *s_0, *e; 60 u8 *pos, *cpos, *b, *s_0, *e, *b_0, *aad;
61 61
62 b = scratch; 62 b = scratch;
63 s_0 = scratch + AES_BLOCK_LEN; 63 s_0 = scratch + AES_BLOCK_LEN;
64 e = scratch + 2 * AES_BLOCK_LEN; 64 e = scratch + 2 * AES_BLOCK_LEN;
65 b_0 = scratch + 3 * AES_BLOCK_LEN;
66 aad = scratch + 4 * AES_BLOCK_LEN;
65 67
66 num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); 68 num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN);
67 last_len = data_len % AES_BLOCK_LEN; 69 last_len = data_len % AES_BLOCK_LEN;
@@ -92,15 +94,16 @@ void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
92 94
93 95
94int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch, 96int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
95 u8 *b_0, u8 *aad, u8 *cdata, size_t data_len, 97 u8 *cdata, size_t data_len, u8 *mic, u8 *data)
96 u8 *mic, u8 *data)
97{ 98{
98 int i, j, last_len, num_blocks; 99 int i, j, last_len, num_blocks;
99 u8 *pos, *cpos, *b, *s_0, *a; 100 u8 *pos, *cpos, *b, *s_0, *a, *b_0, *aad;
100 101
101 b = scratch; 102 b = scratch;
102 s_0 = scratch + AES_BLOCK_LEN; 103 s_0 = scratch + AES_BLOCK_LEN;
103 a = scratch + 2 * AES_BLOCK_LEN; 104 a = scratch + 2 * AES_BLOCK_LEN;
105 b_0 = scratch + 3 * AES_BLOCK_LEN;
106 aad = scratch + 4 * AES_BLOCK_LEN;
104 107
105 num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); 108 num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN);
106 last_len = data_len % AES_BLOCK_LEN; 109 last_len = data_len % AES_BLOCK_LEN;