1 /*
2  * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifdef CONFIG_OWE_STA
7 
8 #include "crypto/crypto.h"
9 #include "esp_owe_i.h"
10 #include "rsn_supp/wpa.h"
11 
owe_build_dhie(uint16_t group)12 uint8_t *owe_build_dhie(uint16_t group)
13 {
14     struct wpa_sm *sm = NULL;
15     sm = get_wpa_sm();
16     return (uint8_t *)(owe_build_assoc_req(sm, group));
17 }
18 
owe_deinit(void)19 void owe_deinit(void)
20 {
21     struct wpa_sm *sm;
22     sm = get_wpa_sm();
23     if (sm->key_mgmt == WPA_KEY_MGMT_OWE) {
24         if (sm->owe_ie) {
25             wpabuf_free(sm->owe_ie);
26             sm->owe_ie = NULL;
27         }
28         crypto_ecdh_deinit(sm->owe_ecdh);
29         sm->owe_ecdh = NULL;
30     }
31 }
32 
esp_wifi_register_owe_cb(struct wpa_funcs * wpa_cb)33 void esp_wifi_register_owe_cb(struct wpa_funcs *wpa_cb)
34 {
35     wpa_cb->owe_build_dhie = owe_build_dhie;
36     wpa_cb->owe_process_assoc_resp = owe_process_assoc_resp;
37 }
38 #endif /* CONFIG_OWE_STA */
39