static int init_wpa(const unsigned char * bssid , const unsigned char * supp_addr , const char * psk) { memcpy(g_wpa.auth_addr,bssid,ETH_ALEN); memcpy(g_wpa.supp_addr,supp_addr,ETH_ALEN); memcpy(g_wpa.psk,psk,PMK_LEN); dbug_buf("DBUG PSK ##########################" , psk,PMK_LEN); supp_init(&g_wpa); memcpy((g_wpa.supp->bssid),bssid,ETH_ALEN); wpa_sm_set_own_addr(g_wpa.supp,supp_addr); wpa_sm_set_pmk(g_wpa.supp,psk,PMK_LEN); // }
int main(int argc, char *argv[]) { struct wpa wpa; if (os_program_init()) return -1; os_memset(&wpa, 0, sizeof(wpa)); os_memset(wpa.auth_addr, 0x12, ETH_ALEN); os_memset(wpa.supp_addr, 0x32, ETH_ALEN); os_memset(wpa.psk, 0x44, PMK_LEN); wpa_debug_level = 0; wpa_debug_show_keys = 1; if (eloop_init()) { wpa_printf(MSG_ERROR, "Failed to initialize event loop"); return -1; } if (auth_init_group(&wpa) < 0) return -1; if (supp_init(&wpa) < 0) return -1; if (auth_init(&wpa) < 0) return -1; wpa_printf(MSG_DEBUG, "Starting eloop"); eloop_run(); wpa_printf(MSG_DEBUG, "eloop done"); deinit(&wpa); eloop_destroy(); os_program_deinit(); return 0; }