GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / staging / otus / wrap_sec.c
blob1fba7a98d52bdec16b2756964bbb20fbfd7ecdce
1 /*
2 * Copyright (c) 2007-2008 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 /* */
17 /* Module Name : wrap_sec.c */
18 /* */
19 /* Abstract */
20 /* This module contains wrapper functions for CENC. */
21 /* */
22 /* NOTES */
23 /* Platform dependent. */
24 /* */
25 /************************************************************************/
27 #include "oal_dt.h"
28 #include "usbdrv.h"
30 #include <linux/netlink.h>
31 #include <net/iw_handler.h>
33 #ifdef ZM_ENABLE_CENC
34 extern int zfLnxCencSendMsg(struct sock *netlink_sk, u_int8_t *msg, int len);
36 u16_t zfLnxCencAsocNotify(zdev_t *dev, u16_t *macAddr, u8_t *body,
37 u16_t bodySize, u16_t port)
39 struct usbdrv_private *macp = dev->priv;
40 struct zydas_cenc_sta_info cenc_info;
41 /* struct sock *netlink_sk; */
42 u8_t ie_len;
43 int ii;
45 /* Create NETLINK socket */
46 /*netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, NULL); */
48 if (macp->netlink_sk == NULL) {
49 printk(KERN_ERR "NETLINK Socket is NULL\n");
50 return -1;
53 memset(&cenc_info, 0, sizeof(cenc_info));
55 /* memcpy(cenc_info.gsn, vap->iv_cencmsk_keys.wk_txiv,
56 * ZM_CENC_IV_LEN);
58 zfiWlanQueryGSN(dev, cenc_info.gsn, port);
59 cenc_info.datalen += ZM_CENC_IV_LEN;
60 ie_len = body[1] + 2;
61 memcpy(cenc_info.wie, body, ie_len);
62 cenc_info.datalen += ie_len;
64 memcpy(cenc_info.sta_mac, macAddr, 6);
65 cenc_info.msg_type = ZM_CENC_WAI_REQUEST;
66 cenc_info.datalen += 6 + 2;
68 printk(KERN_ERR "===== zfwCencSendMsg, bodySize: %d =====\n", bodySize);
70 for (ii = 0; ii < bodySize; ii++) {
71 printk(KERN_ERR "%02x ", body[ii]);
73 if ((ii & 0xf) == 0xf)
74 printk(KERN_ERR "\n");
77 zfLnxCencSendMsg(macp->netlink_sk, (u8_t *)&cenc_info,
78 cenc_info.datalen+4);
80 /* Close NETLINK socket */
81 /* sock_release(netlink_sk); */
83 return 0;
85 #endif /* ZM_ENABLE_CENC */
87 u8_t zfwCencHandleBeaconProbrespon(zdev_t *dev, u8_t *pWIEc,
88 u8_t *pPeerSSIDc, u8_t *pPeerAddrc)
90 return 0;
93 u8_t zfwGetPktEncExemptionActionType(zdev_t *dev, zbuf_t *buf)
95 return ZM_ENCRYPTION_EXEMPT_NO_EXEMPTION;
98 void copyToIntTxBuffer(zdev_t *dev, zbuf_t *buf, u8_t *src,
99 u16_t offset, u16_t length)
101 u16_t i;
103 for (i = 0; i < length; i++) {
104 /* zmw_tx_buf_writeb(dev, buf, offset+i, src[i]); */
105 *(u8_t *)((u8_t *)buf->data+offset+i) = src[i];
109 u16_t zfwStaAddIeWpaRsn(zdev_t *dev, zbuf_t *buf, u16_t offset, u8_t frameType)
111 struct usbdrv_private *macp = dev->ml_priv;
112 /* zm_msg1_mm(ZM_LV_0, "CWY - add wpaie content Length : "
113 * , macp->supIe[1]);
115 if (macp->supIe[1] != 0) {
116 copyToIntTxBuffer(dev, buf, macp->supIe, offset,
117 macp->supIe[1]+2);
118 /* memcpy(buf->data[offset], macp->supIe, macp->supIe[1]+2);*/
119 offset += (macp->supIe[1]+2);
122 return offset;
125 /* Leave an empty line below to remove warning message on some compiler */