aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/key.c')
-rw-r--r--net/mac80211/key.c86
1 files changed, 0 insertions, 86 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 5e5bc599da4c..3df7b0392d30 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -932,50 +932,6 @@ void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid,
932} 932}
933EXPORT_SYMBOL_GPL(ieee80211_gtk_rekey_notify); 933EXPORT_SYMBOL_GPL(ieee80211_gtk_rekey_notify);
934 934
935void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf,
936 struct ieee80211_key_seq *seq)
937{
938 struct ieee80211_key *key;
939 u64 pn64;
940
941 if (WARN_ON(!(keyconf->flags & IEEE80211_KEY_FLAG_GENERATE_IV)))
942 return;
943
944 key = container_of(keyconf, struct ieee80211_key, conf);
945
946 switch (key->conf.cipher) {
947 case WLAN_CIPHER_SUITE_TKIP:
948 seq->tkip.iv32 = key->u.tkip.tx.iv32;
949 seq->tkip.iv16 = key->u.tkip.tx.iv16;
950 break;
951 case WLAN_CIPHER_SUITE_CCMP:
952 case WLAN_CIPHER_SUITE_CCMP_256:
953 case WLAN_CIPHER_SUITE_AES_CMAC:
954 case WLAN_CIPHER_SUITE_BIP_CMAC_256:
955 BUILD_BUG_ON(offsetof(typeof(*seq), ccmp) !=
956 offsetof(typeof(*seq), aes_cmac));
957 case WLAN_CIPHER_SUITE_BIP_GMAC_128:
958 case WLAN_CIPHER_SUITE_BIP_GMAC_256:
959 BUILD_BUG_ON(offsetof(typeof(*seq), ccmp) !=
960 offsetof(typeof(*seq), aes_gmac));
961 case WLAN_CIPHER_SUITE_GCMP:
962 case WLAN_CIPHER_SUITE_GCMP_256:
963 BUILD_BUG_ON(offsetof(typeof(*seq), ccmp) !=
964 offsetof(typeof(*seq), gcmp));
965 pn64 = atomic64_read(&key->conf.tx_pn);
966 seq->ccmp.pn[5] = pn64;
967 seq->ccmp.pn[4] = pn64 >> 8;
968 seq->ccmp.pn[3] = pn64 >> 16;
969 seq->ccmp.pn[2] = pn64 >> 24;
970 seq->ccmp.pn[1] = pn64 >> 32;
971 seq->ccmp.pn[0] = pn64 >> 40;
972 break;
973 default:
974 WARN_ON(1);
975 }
976}
977EXPORT_SYMBOL(ieee80211_get_key_tx_seq);
978
979void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, 935void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
980 int tid, struct ieee80211_key_seq *seq) 936 int tid, struct ieee80211_key_seq *seq)
981{ 937{
@@ -1029,48 +985,6 @@ void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
1029} 985}
1030EXPORT_SYMBOL(ieee80211_get_key_rx_seq); 986EXPORT_SYMBOL(ieee80211_get_key_rx_seq);
1031 987
1032void ieee80211_set_key_tx_seq(struct ieee80211_key_conf *keyconf,
1033 struct ieee80211_key_seq *seq)
1034{
1035 struct ieee80211_key *key;
1036 u64 pn64;
1037
1038 key = container_of(keyconf, struct ieee80211_key, conf);
1039
1040 switch (key->conf.cipher) {
1041 case WLAN_CIPHER_SUITE_TKIP:
1042 key->u.tkip.tx.iv32 = seq->tkip.iv32;
1043 key->u.tkip.tx.iv16 = seq->tkip.iv16;
1044 break;
1045 case WLAN_CIPHER_SUITE_CCMP:
1046 case WLAN_CIPHER_SUITE_CCMP_256:
1047 case WLAN_CIPHER_SUITE_AES_CMAC:
1048 case WLAN_CIPHER_SUITE_BIP_CMAC_256:
1049 BUILD_BUG_ON(offsetof(typeof(*seq), ccmp) !=
1050 offsetof(typeof(*seq), aes_cmac));
1051 case WLAN_CIPHER_SUITE_BIP_GMAC_128:
1052 case WLAN_CIPHER_SUITE_BIP_GMAC_256:
1053 BUILD_BUG_ON(offsetof(typeof(*seq), ccmp) !=
1054 offsetof(typeof(*seq), aes_gmac));
1055 case WLAN_CIPHER_SUITE_GCMP:
1056 case WLAN_CIPHER_SUITE_GCMP_256:
1057 BUILD_BUG_ON(offsetof(typeof(*seq), ccmp) !=
1058 offsetof(typeof(*seq), gcmp));
1059 pn64 = (u64)seq->ccmp.pn[5] |
1060 ((u64)seq->ccmp.pn[4] << 8) |
1061 ((u64)seq->ccmp.pn[3] << 16) |
1062 ((u64)seq->ccmp.pn[2] << 24) |
1063 ((u64)seq->ccmp.pn[1] << 32) |
1064 ((u64)seq->ccmp.pn[0] << 40);
1065 atomic64_set(&key->conf.tx_pn, pn64);
1066 break;
1067 default:
1068 WARN_ON(1);
1069 break;
1070 }
1071}
1072EXPORT_SYMBOL_GPL(ieee80211_set_key_tx_seq);
1073
1074void ieee80211_set_key_rx_seq(struct ieee80211_key_conf *keyconf, 988void ieee80211_set_key_rx_seq(struct ieee80211_key_conf *keyconf,
1075 int tid, struct ieee80211_key_seq *seq) 989 int tid, struct ieee80211_key_seq *seq)
1076{ 990{