aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/lib80211_crypt_tkip.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/lib80211_crypt_tkip.c')
-rw-r--r--net/wireless/lib80211_crypt_tkip.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/net/wireless/lib80211_crypt_tkip.c b/net/wireless/lib80211_crypt_tkip.c
index e6bce1f130c9..346e19cbdf59 100644
--- a/net/wireless/lib80211_crypt_tkip.c
+++ b/net/wireless/lib80211_crypt_tkip.c
@@ -64,9 +64,9 @@ struct lib80211_tkip_data {
64 64
65 int key_idx; 65 int key_idx;
66 66
67 struct crypto_skcipher *rx_tfm_arc4; 67 struct crypto_sync_skcipher *rx_tfm_arc4;
68 struct crypto_shash *rx_tfm_michael; 68 struct crypto_shash *rx_tfm_michael;
69 struct crypto_skcipher *tx_tfm_arc4; 69 struct crypto_sync_skcipher *tx_tfm_arc4;
70 struct crypto_shash *tx_tfm_michael; 70 struct crypto_shash *tx_tfm_michael;
71 71
72 /* scratch buffers for virt_to_page() (crypto API) */ 72 /* scratch buffers for virt_to_page() (crypto API) */
@@ -99,8 +99,7 @@ static void *lib80211_tkip_init(int key_idx)
99 99
100 priv->key_idx = key_idx; 100 priv->key_idx = key_idx;
101 101
102 priv->tx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0, 102 priv->tx_tfm_arc4 = crypto_alloc_sync_skcipher("ecb(arc4)", 0, 0);
103 CRYPTO_ALG_ASYNC);
104 if (IS_ERR(priv->tx_tfm_arc4)) { 103 if (IS_ERR(priv->tx_tfm_arc4)) {
105 priv->tx_tfm_arc4 = NULL; 104 priv->tx_tfm_arc4 = NULL;
106 goto fail; 105 goto fail;
@@ -112,8 +111,7 @@ static void *lib80211_tkip_init(int key_idx)
112 goto fail; 111 goto fail;
113 } 112 }
114 113
115 priv->rx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0, 114 priv->rx_tfm_arc4 = crypto_alloc_sync_skcipher("ecb(arc4)", 0, 0);
116 CRYPTO_ALG_ASYNC);
117 if (IS_ERR(priv->rx_tfm_arc4)) { 115 if (IS_ERR(priv->rx_tfm_arc4)) {
118 priv->rx_tfm_arc4 = NULL; 116 priv->rx_tfm_arc4 = NULL;
119 goto fail; 117 goto fail;
@@ -130,9 +128,9 @@ static void *lib80211_tkip_init(int key_idx)
130 fail: 128 fail:
131 if (priv) { 129 if (priv) {
132 crypto_free_shash(priv->tx_tfm_michael); 130 crypto_free_shash(priv->tx_tfm_michael);
133 crypto_free_skcipher(priv->tx_tfm_arc4); 131 crypto_free_sync_skcipher(priv->tx_tfm_arc4);
134 crypto_free_shash(priv->rx_tfm_michael); 132 crypto_free_shash(priv->rx_tfm_michael);
135 crypto_free_skcipher(priv->rx_tfm_arc4); 133 crypto_free_sync_skcipher(priv->rx_tfm_arc4);
136 kfree(priv); 134 kfree(priv);
137 } 135 }
138 136
@@ -144,9 +142,9 @@ static void lib80211_tkip_deinit(void *priv)
144 struct lib80211_tkip_data *_priv = priv; 142 struct lib80211_tkip_data *_priv = priv;
145 if (_priv) { 143 if (_priv) {
146 crypto_free_shash(_priv->tx_tfm_michael); 144 crypto_free_shash(_priv->tx_tfm_michael);
147 crypto_free_skcipher(_priv->tx_tfm_arc4); 145 crypto_free_sync_skcipher(_priv->tx_tfm_arc4);
148 crypto_free_shash(_priv->rx_tfm_michael); 146 crypto_free_shash(_priv->rx_tfm_michael);
149 crypto_free_skcipher(_priv->rx_tfm_arc4); 147 crypto_free_sync_skcipher(_priv->rx_tfm_arc4);
150 } 148 }
151 kfree(priv); 149 kfree(priv);
152} 150}
@@ -344,7 +342,7 @@ static int lib80211_tkip_hdr(struct sk_buff *skb, int hdr_len,
344static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) 342static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
345{ 343{
346 struct lib80211_tkip_data *tkey = priv; 344 struct lib80211_tkip_data *tkey = priv;
347 SKCIPHER_REQUEST_ON_STACK(req, tkey->tx_tfm_arc4); 345 SYNC_SKCIPHER_REQUEST_ON_STACK(req, tkey->tx_tfm_arc4);
348 int len; 346 int len;
349 u8 rc4key[16], *pos, *icv; 347 u8 rc4key[16], *pos, *icv;
350 u32 crc; 348 u32 crc;
@@ -374,9 +372,9 @@ static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
374 icv[2] = crc >> 16; 372 icv[2] = crc >> 16;
375 icv[3] = crc >> 24; 373 icv[3] = crc >> 24;
376 374
377 crypto_skcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); 375 crypto_sync_skcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16);
378 sg_init_one(&sg, pos, len + 4); 376 sg_init_one(&sg, pos, len + 4);
379 skcipher_request_set_tfm(req, tkey->tx_tfm_arc4); 377 skcipher_request_set_sync_tfm(req, tkey->tx_tfm_arc4);
380 skcipher_request_set_callback(req, 0, NULL, NULL); 378 skcipher_request_set_callback(req, 0, NULL, NULL);
381 skcipher_request_set_crypt(req, &sg, &sg, len + 4, NULL); 379 skcipher_request_set_crypt(req, &sg, &sg, len + 4, NULL);
382 err = crypto_skcipher_encrypt(req); 380 err = crypto_skcipher_encrypt(req);
@@ -400,7 +398,7 @@ static inline int tkip_replay_check(u32 iv32_n, u16 iv16_n,
400static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) 398static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
401{ 399{
402 struct lib80211_tkip_data *tkey = priv; 400 struct lib80211_tkip_data *tkey = priv;
403 SKCIPHER_REQUEST_ON_STACK(req, tkey->rx_tfm_arc4); 401 SYNC_SKCIPHER_REQUEST_ON_STACK(req, tkey->rx_tfm_arc4);
404 u8 rc4key[16]; 402 u8 rc4key[16];
405 u8 keyidx, *pos; 403 u8 keyidx, *pos;
406 u32 iv32; 404 u32 iv32;
@@ -463,9 +461,9 @@ static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
463 461
464 plen = skb->len - hdr_len - 12; 462 plen = skb->len - hdr_len - 12;
465 463
466 crypto_skcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); 464 crypto_sync_skcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
467 sg_init_one(&sg, pos, plen + 4); 465 sg_init_one(&sg, pos, plen + 4);
468 skcipher_request_set_tfm(req, tkey->rx_tfm_arc4); 466 skcipher_request_set_sync_tfm(req, tkey->rx_tfm_arc4);
469 skcipher_request_set_callback(req, 0, NULL, NULL); 467 skcipher_request_set_callback(req, 0, NULL, NULL);
470 skcipher_request_set_crypt(req, &sg, &sg, plen + 4, NULL); 468 skcipher_request_set_crypt(req, &sg, &sg, plen + 4, NULL);
471 err = crypto_skcipher_decrypt(req); 469 err = crypto_skcipher_decrypt(req);
@@ -660,9 +658,9 @@ static int lib80211_tkip_set_key(void *key, int len, u8 * seq, void *priv)
660 struct lib80211_tkip_data *tkey = priv; 658 struct lib80211_tkip_data *tkey = priv;
661 int keyidx; 659 int keyidx;
662 struct crypto_shash *tfm = tkey->tx_tfm_michael; 660 struct crypto_shash *tfm = tkey->tx_tfm_michael;
663 struct crypto_skcipher *tfm2 = tkey->tx_tfm_arc4; 661 struct crypto_sync_skcipher *tfm2 = tkey->tx_tfm_arc4;
664 struct crypto_shash *tfm3 = tkey->rx_tfm_michael; 662 struct crypto_shash *tfm3 = tkey->rx_tfm_michael;
665 struct crypto_skcipher *tfm4 = tkey->rx_tfm_arc4; 663 struct crypto_sync_skcipher *tfm4 = tkey->rx_tfm_arc4;
666 664
667 keyidx = tkey->key_idx; 665 keyidx = tkey->key_idx;
668 memset(tkey, 0, sizeof(*tkey)); 666 memset(tkey, 0, sizeof(*tkey));