diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-26 15:46:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-26 15:46:08 -0700 |
commit | 23908db413eccd77084b09c9b0a4451dfb0524c0 (patch) | |
tree | 646f21a92496bdc04175e95642b0ecb2dc3dd09e /drivers/staging/rtl8192e/rtllib_crypt_tkip.c | |
parent | 8d7804a2f03dbd34940fcb426450c730adf29dae (diff) | |
parent | 53a20e9e378ecd52f0afa4b60f8f8c81b6f97c27 (diff) | |
download | linux-23908db413eccd77084b09c9b0a4451dfb0524c0.tar.bz2 |
Merge tag 'staging-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH:
"Here's the big, really big, staging tree patches for 4.2-rc1.
Loads of stuff in here, almost all just coding style fixes / churn,
and a few new drivers as well, one of which I just disabled from the
build a few minutes ago due to way too many build warnings.
Other than the one "disable this driver" patch, all of these have been
in linux-next for quite a while with no reported issues"
* tag 'staging-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1163 commits)
staging: wilc1000: disable driver due to build warnings
Staging: rts5208: fix CHANGE_LINK_STATE value
Staging: sm750fb: ddk750_swi2c.c: Insert spaces before parenthesis
Staging: sm750fb: ddk750_swi2c.c: Place braces on correct lines
Staging: sm750fb: ddk750_swi2c.c: Insert spaces around operators
Staging: sm750fb: ddk750_swi2c.c: Replace spaces with tabs
Staging: sm750fb: ddk750_swi2c.h: Shorten lines to under 80 characters
Staging: sm750fb: ddk750_swi2c.h: Replace spaces with tabs
Staging: sm750fb: modedb.h: Shorten lines to under 80 characters
Staging: sm750fb: modedb.h: Replace spaces with tabs
staging: comedi: addi_apci_3120: rename 'this_board' variables
staging: comedi: addi_apci_1516: rename 'this_board' variables
staging: comedi: ni_atmio: cleanup ni_getboardtype()
staging: comedi: vmk80xx: sanity check context used to get the boardinfo
staging: comedi: vmk80xx: rename 'boardinfo' variables
staging: comedi: dt3000: rename 'this_board' variables
staging: comedi: adv_pci_dio: rename 'this_board' variables
staging: comedi: cb_pcidas64: rename 'thisboard' variables
staging: comedi: cb_pcidas: rename 'thisboard' variables
staging: comedi: me4000: rename 'thisboard' variables
...
Diffstat (limited to 'drivers/staging/rtl8192e/rtllib_crypt_tkip.c')
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 89 |
1 files changed, 43 insertions, 46 deletions
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index 656b4b359c50..2096d78913bd 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -21,6 +21,7 @@ #include <linux/crypto.h> #include <linux/scatterlist.h> #include <linux/crc32.h> +#include <linux/etherdevice.h> #include "rtllib.h" @@ -52,7 +53,8 @@ struct rtllib_tkip_data { 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]; + u8 rx_hdr[16]; + u8 tx_hdr[16]; }; static void *rtllib_tkip_init(int key_idx) @@ -66,8 +68,7 @@ static void *rtllib_tkip_init(int key_idx) priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm_arc4)) { - printk(KERN_DEBUG - "rtllib_crypt_tkip: could not allocate crypto API arc4\n"); + pr_debug("Could not allocate crypto API arc4\n"); priv->tx_tfm_arc4 = NULL; goto fail; } @@ -75,8 +76,7 @@ static void *rtllib_tkip_init(int key_idx) priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm_michael)) { - printk(KERN_DEBUG - "rtllib_crypt_tkip: could not allocate crypto API michael_mic\n"); + pr_debug("Could not allocate crypto API michael_mic\n"); priv->tx_tfm_michael = NULL; goto fail; } @@ -84,8 +84,7 @@ static void *rtllib_tkip_init(int key_idx) priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm_arc4)) { - printk(KERN_DEBUG - "rtllib_crypt_tkip: could not allocate crypto API arc4\n"); + pr_debug("Could not allocate crypto API arc4\n"); priv->rx_tfm_arc4 = NULL; goto fail; } @@ -93,8 +92,7 @@ static void *rtllib_tkip_init(int key_idx) priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm_michael)) { - printk(KERN_DEBUG - "rtllib_crypt_tkip: could not allocate crypto API michael_mic\n"); + pr_debug("Could not allocate crypto API michael_mic\n"); priv->rx_tfm_michael = NULL; goto fail; } @@ -401,24 +399,24 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) keyidx = pos[3]; if (!(keyidx & (1 << 5))) { if (net_ratelimit()) { - printk(KERN_DEBUG - "TKIP: received packet without ExtIV flag from %pM\n", - hdr->addr2); + netdev_dbg(skb->dev, + "Received packet without ExtIV flag from %pM\n", + hdr->addr2); } return -2; } keyidx >>= 6; if (tkey->key_idx != keyidx) { - printk(KERN_DEBUG - "TKIP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", - tkey->key_idx, keyidx, priv); + netdev_dbg(skb->dev, + "RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", + tkey->key_idx, keyidx, priv); return -6; } if (!tkey->key_set) { if (net_ratelimit()) { - printk(KERN_DEBUG - "TKIP: received packet from %pM with keyid=%d that does not have a configured key\n", - hdr->addr2, keyidx); + netdev_dbg(skb->dev, + "Received packet from %pM with keyid=%d that does not have a configured key\n", + hdr->addr2, keyidx); } return -3; } @@ -431,10 +429,10 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) && tkey->initialized) { if (net_ratelimit()) { - printk(KERN_DEBUG - "TKIP: replay detected: STA= %pM previous TSC %08x%04x received TSC %08x%04x\n", - hdr->addr2, tkey->rx_iv32, tkey->rx_iv16, - iv32, iv16); + netdev_dbg(skb->dev, + "Replay detected: STA= %pM previous TSC %08x%04x received TSC %08x%04x\n", + hdr->addr2, tkey->rx_iv32, + tkey->rx_iv16, iv32, iv16); } tkey->dot11RSNAStatsTKIPReplays++; return -4; @@ -455,9 +453,9 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { if (net_ratelimit()) { - printk(KERN_DEBUG - ": TKIP: failed to decrypt received packet from %pM\n", - hdr->addr2); + netdev_dbg(skb->dev, + "Failed to decrypt received packet from %pM\n", + hdr->addr2); } return -7; } @@ -477,9 +475,9 @@ static int rtllib_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) tkey->rx_phase1_done = 0; } if (net_ratelimit()) { - printk(KERN_DEBUG - "TKIP: ICV error detected: STA= %pM\n", - hdr->addr2); + netdev_dbg(skb->dev, + "ICV error detected: STA= %pM\n", + hdr->addr2); } tkey->dot11RSNAStatsTKIPICVErrors++; return -5; @@ -532,20 +530,20 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) switch (le16_to_cpu(hdr11->frame_ctl) & (RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS)) { case RTLLIB_FCTL_TODS: - memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ + ether_addr_copy(hdr, hdr11->addr3); /* DA */ + ether_addr_copy(hdr + ETH_ALEN, hdr11->addr2); /* SA */ break; case RTLLIB_FCTL_FROMDS: - memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */ + ether_addr_copy(hdr, hdr11->addr1); /* DA */ + ether_addr_copy(hdr + ETH_ALEN, hdr11->addr3); /* SA */ break; case RTLLIB_FCTL_FROMDS | RTLLIB_FCTL_TODS: - memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ + ether_addr_copy(hdr, hdr11->addr3); /* DA */ + ether_addr_copy(hdr + ETH_ALEN, hdr11->addr4); /* SA */ break; case 0: - memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ + ether_addr_copy(hdr, hdr11->addr1); /* DA */ + ether_addr_copy(hdr + ETH_ALEN, hdr11->addr2); /* SA */ break; } @@ -564,9 +562,9 @@ static int rtllib_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) hdr = (struct rtllib_hdr_4addr *) skb->data; if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { - printk(KERN_DEBUG - "Invalid packet for Michael MIC add (tailroom=%d hdr_len=%d skb->len=%d)\n", - skb_tailroom(skb), hdr_len, skb->len); + netdev_dbg(skb->dev, + "Invalid packet for Michael MIC add (tailroom=%d hdr_len=%d skb->len=%d)\n", + skb_tailroom(skb), hdr_len, skb->len); return -1; } @@ -598,7 +596,7 @@ static void rtllib_michael_mic_failure(struct net_device *dev, else ev.flags |= IW_MICFAILURE_PAIRWISE; ev.src_addr.sa_family = ARPHRD_ETHER; - memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); + ether_addr_copy(ev.src_addr.sa_data, hdr->addr2); memset(&wrqu, 0, sizeof(wrqu)); wrqu.data.length = sizeof(ev); wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); @@ -628,12 +626,11 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, struct rtllib_hdr_4addr *hdr; hdr = (struct rtllib_hdr_4addr *) skb->data; - printk(KERN_DEBUG - "%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n", - skb->dev ? skb->dev->name : "N/A", hdr->addr2, - keyidx); - printk(KERN_DEBUG "%d\n", - memcmp(mic, skb->data + skb->len - 8, 8) != 0); + netdev_dbg(skb->dev, + "Michael MIC verification failed for MSDU from %pM keyidx=%d\n", + hdr->addr2, keyidx); + netdev_dbg(skb->dev, "%d\n", + memcmp(mic, skb->data + skb->len - 8, 8) != 0); if (skb->dev) { pr_info("skb->dev != NULL\n"); rtllib_michael_mic_failure(skb->dev, hdr, keyidx); |