aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-01-08 06:32:02 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 16:00:03 -0500
commit3cfcf6ac6d69dc290e96416731eea5c88ac7d426 (patch)
tree35bc626e2e3f7c37a7eb50c1f057adb4830eccc6 /net/wireless/nl80211.c
parent765cb46a3fc856245ea68a7c961ac87c77e4ae2d (diff)
mac80211: 802.11w - Use BIP (AES-128-CMAC)
Add mechanism for managing BIP keys (IGTK) and integrate BIP into the TX/RX paths. Signed-off-by: Jouni Malinen <j@w1.fi> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1e728fff474e..123d3b160fad 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -738,7 +738,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
738 if (info->attrs[NL80211_ATTR_KEY_IDX]) 738 if (info->attrs[NL80211_ATTR_KEY_IDX])
739 key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]); 739 key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]);
740 740
741 if (key_idx > 3) 741 if (key_idx > 5)
742 return -EINVAL; 742 return -EINVAL;
743 743
744 if (info->attrs[NL80211_ATTR_MAC]) 744 if (info->attrs[NL80211_ATTR_MAC])
@@ -804,30 +804,41 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
804 int err; 804 int err;
805 struct net_device *dev; 805 struct net_device *dev;
806 u8 key_idx; 806 u8 key_idx;
807 int (*func)(struct wiphy *wiphy, struct net_device *netdev,
808 u8 key_index);
807 809
808 if (!info->attrs[NL80211_ATTR_KEY_IDX]) 810 if (!info->attrs[NL80211_ATTR_KEY_IDX])
809 return -EINVAL; 811 return -EINVAL;
810 812
811 key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]); 813 key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]);
812 814
813 if (key_idx > 3) 815 if (info->attrs[NL80211_ATTR_KEY_DEFAULT_MGMT]) {
816 if (key_idx < 4 || key_idx > 5)
817 return -EINVAL;
818 } else if (key_idx > 3)
814 return -EINVAL; 819 return -EINVAL;
815 820
816 /* currently only support setting default key */ 821 /* currently only support setting default key */
817 if (!info->attrs[NL80211_ATTR_KEY_DEFAULT]) 822 if (!info->attrs[NL80211_ATTR_KEY_DEFAULT] &&
823 !info->attrs[NL80211_ATTR_KEY_DEFAULT_MGMT])
818 return -EINVAL; 824 return -EINVAL;
819 825
820 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); 826 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
821 if (err) 827 if (err)
822 return err; 828 return err;
823 829
824 if (!drv->ops->set_default_key) { 830 if (info->attrs[NL80211_ATTR_KEY_DEFAULT])
831 func = drv->ops->set_default_key;
832 else
833 func = drv->ops->set_default_mgmt_key;
834
835 if (!func) {
825 err = -EOPNOTSUPP; 836 err = -EOPNOTSUPP;
826 goto out; 837 goto out;
827 } 838 }
828 839
829 rtnl_lock(); 840 rtnl_lock();
830 err = drv->ops->set_default_key(&drv->wiphy, dev, key_idx); 841 err = func(&drv->wiphy, dev, key_idx);
831 rtnl_unlock(); 842 rtnl_unlock();
832 843
833 out: 844 out:
@@ -863,7 +874,7 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
863 if (info->attrs[NL80211_ATTR_MAC]) 874 if (info->attrs[NL80211_ATTR_MAC])
864 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 875 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
865 876
866 if (key_idx > 3) 877 if (key_idx > 5)
867 return -EINVAL; 878 return -EINVAL;
868 879
869 /* 880 /*
@@ -894,6 +905,10 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
894 if (params.key_len != 13) 905 if (params.key_len != 13)
895 return -EINVAL; 906 return -EINVAL;
896 break; 907 break;
908 case WLAN_CIPHER_SUITE_AES_CMAC:
909 if (params.key_len != 16)
910 return -EINVAL;
911 break;
897 default: 912 default:
898 return -EINVAL; 913 return -EINVAL;
899 } 914 }
@@ -928,7 +943,7 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info)
928 if (info->attrs[NL80211_ATTR_KEY_IDX]) 943 if (info->attrs[NL80211_ATTR_KEY_IDX])
929 key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]); 944 key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]);
930 945
931 if (key_idx > 3) 946 if (key_idx > 5)
932 return -EINVAL; 947 return -EINVAL;
933 948
934 if (info->attrs[NL80211_ATTR_MAC]) 949 if (info->attrs[NL80211_ATTR_MAC])