Lines Matching refs:rsn
144 static int __mesh_rsn_auth_init(struct mesh_rsn *rsn, const u8 *addr, in __mesh_rsn_auth_init() argument
161 conf.wpa_pairwise = rsn->pairwise_cipher; in __mesh_rsn_auth_init()
162 conf.rsn_pairwise = rsn->pairwise_cipher; in __mesh_rsn_auth_init()
163 conf.wpa_group = rsn->group_cipher; in __mesh_rsn_auth_init()
171 conf.group_mgmt_cipher = rsn->mgmt_group_cipher; in __mesh_rsn_auth_init()
177 rsn->auth = wpa_init(addr, &conf, &cb, rsn); in __mesh_rsn_auth_init()
178 if (rsn->auth == NULL) { in __mesh_rsn_auth_init()
184 rsn->mgtk_len = wpa_cipher_key_len(conf.wpa_group); in __mesh_rsn_auth_init()
185 if (random_get_bytes(rsn->mgtk, rsn->mgtk_len) < 0) in __mesh_rsn_auth_init()
187 rsn->mgtk_key_id = 1; in __mesh_rsn_auth_init()
191 rsn->igtk_len = wpa_cipher_key_len(conf.group_mgmt_cipher); in __mesh_rsn_auth_init()
192 if (random_get_bytes(rsn->igtk, rsn->igtk_len) < 0) in __mesh_rsn_auth_init()
194 rsn->igtk_key_id = 4; in __mesh_rsn_auth_init()
198 rsn->igtk, rsn->igtk_len); in __mesh_rsn_auth_init()
199 wpa_drv_set_key(rsn->wpa_s, in __mesh_rsn_auth_init()
200 wpa_cipher_to_alg(rsn->mgmt_group_cipher), NULL, in __mesh_rsn_auth_init()
201 rsn->igtk_key_id, 1, in __mesh_rsn_auth_init()
202 seq, sizeof(seq), rsn->igtk, rsn->igtk_len); in __mesh_rsn_auth_init()
208 rsn->mgtk, rsn->mgtk_len); in __mesh_rsn_auth_init()
209 wpa_drv_set_key(rsn->wpa_s, wpa_cipher_to_alg(rsn->group_cipher), NULL, in __mesh_rsn_auth_init()
210 rsn->mgtk_key_id, 1, seq, sizeof(seq), in __mesh_rsn_auth_init()
211 rsn->mgtk, rsn->mgtk_len); in __mesh_rsn_auth_init()
217 static void mesh_rsn_deinit(struct mesh_rsn *rsn) in mesh_rsn_deinit() argument
219 os_memset(rsn->mgtk, 0, sizeof(rsn->mgtk)); in mesh_rsn_deinit()
220 rsn->mgtk_len = 0; in mesh_rsn_deinit()
221 os_memset(rsn->igtk, 0, sizeof(rsn->igtk)); in mesh_rsn_deinit()
222 rsn->igtk_len = 0; in mesh_rsn_deinit()
223 if (rsn->auth) in mesh_rsn_deinit()
224 wpa_deinit(rsn->auth); in mesh_rsn_deinit()
416 void mesh_rsn_get_pmkid(struct mesh_rsn *rsn, struct sta_info *sta, u8 *pmkid) in mesh_rsn_get_pmkid() argument
423 mesh_rsn_derive_aek(struct mesh_rsn *rsn, struct sta_info *sta) in mesh_rsn_derive_aek() argument
425 u8 *myaddr = rsn->wpa_s->own_addr; in mesh_rsn_derive_aek()
534 int mesh_rsn_protect_frame(struct mesh_rsn *rsn, struct sta_info *sta, in mesh_rsn_protect_frame() argument
540 const u8 *aad[] = { rsn->wpa_s->own_addr, sta->addr, cat }; in mesh_rsn_protect_frame()
547 len += rsn->mgtk_len + WPA_KEY_RSC_LEN + 4; in mesh_rsn_protect_frame()
549 if (cat[1] == PLINK_OPEN && rsn->igtk_len) in mesh_rsn_protect_frame()
550 len += 2 + 6 + rsn->igtk_len; in mesh_rsn_protect_frame()
586 os_memcpy(pos, rsn->mgtk, rsn->mgtk_len); in mesh_rsn_protect_frame()
587 pos += rsn->mgtk_len; in mesh_rsn_protect_frame()
588 wpa_drv_get_seqnum(rsn->wpa_s, NULL, rsn->mgtk_key_id, pos); in mesh_rsn_protect_frame()
599 if (rsn->igtk_len) { in mesh_rsn_protect_frame()
600 WPA_PUT_LE16(pos, rsn->igtk_key_id); in mesh_rsn_protect_frame()
602 wpa_drv_get_seqnum(rsn->wpa_s, NULL, rsn->igtk_key_id, pos); in mesh_rsn_protect_frame()
604 os_memcpy(pos, rsn->igtk, rsn->igtk_len); in mesh_rsn_protect_frame()