From: Jeff Garzik Date: Sat, 23 Sep 2006 00:10:23 +0000 (-0400) Subject: Merge branch 'master' into upstream X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=28eb177dfa5982d132edceed891cb3885df258bb;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git Merge branch 'master' into upstream Conflicts: net/ieee80211/ieee80211_crypt_tkip.c net/ieee80211/ieee80211_crypt_wep.c --- 28eb177dfa5982d132edceed891cb3885df258bb diff --cc net/ieee80211/ieee80211_crypt_tkip.c index f2df2f5b3e4c,407a17495b61..259572dfd4f1 --- a/net/ieee80211/ieee80211_crypt_tkip.c +++ b/net/ieee80211/ieee80211_crypt_tkip.c @@@ -52,10 -53,8 +53,10 @@@ struct ieee80211_tkip_data int key_idx; - struct crypto_tfm *tx_tfm_arc4; - struct crypto_tfm *tx_tfm_michael; - struct crypto_tfm *rx_tfm_arc4; - struct crypto_tfm *rx_tfm_michael; - struct crypto_blkcipher *tfm_arc4; - struct crypto_hash *tfm_michael; ++ struct crypto_blkcipher *rx_tfm_arc4; ++ struct crypto_hash *rx_tfm_michael; ++ struct crypto_blkcipher *tx_tfm_arc4; ++ struct crypto_hash *tx_tfm_michael; /* scratch buffers for virt_to_page() (crypto API) */ u8 rx_hdr[16], tx_hdr[16]; @@@ -87,31 -86,21 +88,37 @@@ static void *ieee80211_tkip_init(int ke priv->key_idx = key_idx; - priv->tx_tfm_arc4 = crypto_alloc_tfm("arc4", 0); - if (priv->tx_tfm_arc4 == NULL) { - priv->tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, ++ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, + CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->tfm_arc4)) { ++ if (IS_ERR(priv->tx_tfm_arc4)) { printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " "crypto API arc4\n"); + priv->tfm_arc4 = NULL; goto fail; } - priv->tx_tfm_michael = crypto_alloc_tfm("michael_mic", 0); - if (priv->tx_tfm_michael == NULL) { - priv->tfm_michael = crypto_alloc_hash("michael_mic", 0, - CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->tfm_michael)) { ++ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, ++ CRYPTO_ALG_ASYNC); ++ if (IS_ERR(priv->tx_tfm_michael)) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API michael_mic\n"); + goto fail; + } + - priv->rx_tfm_arc4 = crypto_alloc_tfm("arc4", 0); - if (priv->rx_tfm_arc4 == NULL) { ++ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, ++ CRYPTO_ALG_ASYNC); ++ if (IS_ERR(priv->rx_tfm_arc4)) { + printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " + "crypto API arc4\n"); + goto fail; + } + - priv->rx_tfm_michael = crypto_alloc_tfm("michael_mic", 0); - if (priv->rx_tfm_michael == NULL) { ++ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, ++ CRYPTO_ALG_ASYNC); ++ if (IS_ERR(priv->rx_tfm_michael)) { printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " "crypto API michael_mic\n"); + priv->tfm_michael = NULL; goto fail; } @@@ -119,14 -108,10 +126,14 @@@ fail: if (priv) { - if (priv->tfm_michael) - crypto_free_hash(priv->tfm_michael); - if (priv->tfm_arc4) - crypto_free_blkcipher(priv->tfm_arc4); + if (priv->tx_tfm_michael) - crypto_free_tfm(priv->tx_tfm_michael); ++ crypto_free_hash(priv->tx_tfm_michael); + if (priv->tx_tfm_arc4) - crypto_free_tfm(priv->tx_tfm_arc4); ++ crypto_free_blkcipher(priv->tx_tfm_arc4); + if (priv->rx_tfm_michael) - crypto_free_tfm(priv->rx_tfm_michael); ++ crypto_free_hash(priv->rx_tfm_michael); + if (priv->rx_tfm_arc4) - crypto_free_tfm(priv->rx_tfm_arc4); ++ crypto_free_blkcipher(priv->rx_tfm_arc4); kfree(priv); } @@@ -136,16 -121,10 +143,16 @@@ static void ieee80211_tkip_deinit(void *priv) { struct ieee80211_tkip_data *_priv = priv; - if (_priv && _priv->tfm_michael) - crypto_free_hash(_priv->tfm_michael); - if (_priv && _priv->tfm_arc4) - crypto_free_blkcipher(_priv->tfm_arc4); + if (_priv) { + if (_priv->tx_tfm_michael) - crypto_free_tfm(_priv->tx_tfm_michael); ++ crypto_free_hash(_priv->tx_tfm_michael); + if (_priv->tx_tfm_arc4) - crypto_free_tfm(_priv->tx_tfm_arc4); ++ crypto_free_blkcipher(_priv->tx_tfm_arc4); + if (_priv->rx_tfm_michael) - crypto_free_tfm(_priv->rx_tfm_michael); ++ crypto_free_hash(_priv->rx_tfm_michael); + if (_priv->rx_tfm_arc4) - crypto_free_tfm(_priv->rx_tfm_arc4); ++ crypto_free_blkcipher(_priv->rx_tfm_arc4); + } kfree(priv); } @@@ -344,6 -323,7 +351,7 @@@ static int ieee80211_tkip_hdr(struct sk static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct ieee80211_tkip_data *tkey = priv; - struct blkcipher_desc desc = { .tfm = tkey->tfm_arc4 }; ++ struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 }; int len; u8 rc4key[16], *pos, *icv; u32 crc; @@@ -377,7 -357,7 +385,7 @@@ icv[2] = crc >> 16; icv[3] = crc >> 24; - crypto_cipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); - crypto_blkcipher_setkey(tkey->tfm_arc4, rc4key, 16); ++ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); sg.page = virt_to_page(pos); sg.offset = offset_in_page(pos); sg.length = len + 4; @@@ -402,6 -367,7 +395,7 @@@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct ieee80211_tkip_data *tkey = priv; - struct blkcipher_desc desc = { .tfm = tkey->tfm_arc4 }; ++ struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 }; u8 rc4key[16]; u8 keyidx, *pos; u32 iv32; @@@ -472,7 -439,7 +466,7 @@@ plen = skb->len - hdr_len - 12; - crypto_cipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); - crypto_blkcipher_setkey(tkey->tfm_arc4, rc4key, 16); ++ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); sg.page = virt_to_page(pos); sg.offset = offset_in_page(pos); sg.length = plen + 4; @@@ -510,12 -484,13 +511,13 @@@ return keyidx; } - static int michael_mic(struct crypto_tfm *tfm_michael, u8 * key, u8 * hdr, -static int michael_mic(struct ieee80211_tkip_data *tkey, u8 * key, u8 * hdr, ++static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, u8 * data, size_t data_len, u8 * mic) { + struct hash_desc desc; struct scatterlist sg[2]; - if (tkey->tfm_michael == NULL) { + if (tfm_michael == NULL) { printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); return -1; } @@@ -527,12 -502,12 +529,12 @@@ sg[1].offset = offset_in_page(data); sg[1].length = data_len; - crypto_digest_init(tfm_michael); - crypto_digest_setkey(tfm_michael, key, 8); - crypto_digest_update(tfm_michael, sg, 2); - crypto_digest_final(tfm_michael, mic); - if (crypto_hash_setkey(tkey->tfm_michael, key, 8)) ++ if (crypto_hash_setkey(tfm_michael, key, 8)) + return -1; - return 0; - desc.tfm = tkey->tfm_michael; ++ desc.tfm = tfm_michael; + desc.flags = 0; + return crypto_hash_digest(&desc, sg, data_len + 16, mic); } static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr) @@@ -656,10 -631,8 +658,10 @@@ static int ieee80211_tkip_set_key(void { struct ieee80211_tkip_data *tkey = priv; int keyidx; - struct crypto_tfm *tfm = tkey->tx_tfm_michael; - struct crypto_tfm *tfm2 = tkey->tx_tfm_arc4; - struct crypto_tfm *tfm3 = tkey->rx_tfm_michael; - struct crypto_tfm *tfm4 = tkey->rx_tfm_arc4; - struct crypto_hash *tfm = tkey->tfm_michael; - struct crypto_blkcipher *tfm2 = tkey->tfm_arc4; ++ struct crypto_hash *tfm = tkey->tx_tfm_michael; ++ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; ++ struct crypto_hash *tfm3 = tkey->rx_tfm_michael; ++ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; keyidx = tkey->key_idx; memset(tkey, 0, sizeof(*tkey)); diff --cc net/ieee80211/ieee80211_crypt_wep.c index b435b28857ed,3d46d3efe1dd..9eeec13c28b0 --- a/net/ieee80211/ieee80211_crypt_wep.c +++ b/net/ieee80211/ieee80211_crypt_wep.c @@@ -32,8 -33,7 +33,8 @@@ struct prism2_wep_data u8 key[WEP_KEY_LEN + 1]; u8 key_len; u8 key_idx; - struct crypto_tfm *tx_tfm; - struct crypto_tfm *rx_tfm; - struct crypto_blkcipher *tfm; ++ struct crypto_blkcipher *tx_tfm; ++ struct crypto_blkcipher *rx_tfm; }; static void *prism2_wep_init(int keyidx) @@@ -45,19 -45,14 +46,20 @@@ goto fail; priv->key_idx = keyidx; - priv->tx_tfm = crypto_alloc_tfm("arc4", 0); - if (priv->tx_tfm == NULL) { - priv->tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->tfm)) { ++ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(priv->tx_tfm)) { printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " "crypto API arc4\n"); + priv->tfm = NULL; goto fail; } - priv->rx_tfm = crypto_alloc_tfm("arc4", 0); - if (priv->rx_tfm == NULL) { ++ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); ++ if (IS_ERR(priv->rx_tfm)) { + printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " + "crypto API arc4\n"); + goto fail; + } /* start WEP IV from a random value */ get_random_bytes(&priv->iv, 4); @@@ -65,10 -60,8 +67,10 @@@ fail: if (priv) { - if (priv->tfm) - crypto_free_blkcipher(priv->tfm); + if (priv->tx_tfm) - crypto_free_tfm(priv->tx_tfm); ++ crypto_free_blkcipher(priv->tx_tfm); + if (priv->rx_tfm) - crypto_free_tfm(priv->rx_tfm); ++ crypto_free_blkcipher(priv->rx_tfm); kfree(priv); } return NULL; @@@ -77,12 -70,8 +79,12 @@@ static void prism2_wep_deinit(void *priv) { struct prism2_wep_data *_priv = priv; - if (_priv && _priv->tfm) - crypto_free_blkcipher(_priv->tfm); + if (_priv) { + if (_priv->tx_tfm) - crypto_free_tfm(_priv->tx_tfm); ++ crypto_free_blkcipher(_priv->tx_tfm); + if (_priv->rx_tfm) - crypto_free_tfm(_priv->rx_tfm); ++ crypto_free_blkcipher(_priv->rx_tfm); + } kfree(priv); } @@@ -133,6 -122,7 +135,7 @@@ static int prism2_wep_build_iv(struct s static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct prism2_wep_data *wep = priv; - struct blkcipher_desc desc = { .tfm = wep->tfm }; ++ struct blkcipher_desc desc = { .tfm = wep->tx_tfm }; u32 crc, klen, len; u8 *pos, *icv; struct scatterlist sg; @@@ -164,7 -154,7 +167,7 @@@ icv[2] = crc >> 16; icv[3] = crc >> 24; - crypto_cipher_setkey(wep->tx_tfm, key, klen); - crypto_blkcipher_setkey(wep->tfm, key, klen); ++ crypto_blkcipher_setkey(wep->tx_tfm, key, klen); sg.page = virt_to_page(pos); sg.offset = offset_in_page(pos); sg.length = len + 4; @@@ -183,6 -171,7 +184,7 @@@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) { struct prism2_wep_data *wep = priv; - struct blkcipher_desc desc = { .tfm = wep->tfm }; ++ struct blkcipher_desc desc = { .tfm = wep->rx_tfm }; u32 crc, klen, plen; u8 key[WEP_KEY_LEN + 3]; u8 keyidx, *pos, icv[4]; @@@ -207,7 -196,7 +209,7 @@@ /* Apply RC4 to data and compute CRC32 over decrypted data */ plen = skb->len - hdr_len - 8; - crypto_cipher_setkey(wep->rx_tfm, key, klen); - crypto_blkcipher_setkey(wep->tfm, key, klen); ++ crypto_blkcipher_setkey(wep->rx_tfm, key, klen); sg.page = virt_to_page(pos); sg.offset = offset_in_page(pos); sg.length = plen + 4;