├── .gitignore ├── Android.mk ├── CONTRIBUTIONS ├── COPYING ├── README ├── README.md ├── build_release ├── doc ├── .gitignore ├── Makefile ├── code_structure.doxygen ├── ctrl_iface.doxygen ├── dbus.doxygen ├── directories.doxygen ├── doxygen.conf ├── driver_wrapper.doxygen ├── eap.doxygen ├── eap_server.doxygen ├── hostapd.fig ├── hostapd_ctrl_iface.doxygen ├── mainpage.doxygen ├── p2p.doxygen ├── p2p_arch.dot ├── p2p_arch2.dot ├── p2p_sm.dot ├── porting.doxygen ├── testing_tools.doxygen └── wpa_supplicant.fig ├── eap_example ├── .gitignore ├── Makefile ├── README ├── ca.pem ├── eap_example.c ├── eap_example_peer.c ├── eap_example_server.c ├── server-key.pem ├── server.key └── server.pem ├── hostapd ├── Android.mk ├── ChangeLog ├── Makefile ├── README ├── README-WPS ├── android.config ├── config_file.c ├── config_file.h ├── ctrl_iface.c ├── ctrl_iface.h ├── defconfig ├── eap_register.c ├── eap_register.h ├── eap_testing.txt ├── hapd_module_tests.c ├── hlr_auc_gw.c ├── hlr_auc_gw.milenage_db ├── hlr_auc_gw.txt ├── hostapd.8 ├── hostapd.accept ├── hostapd.conf ├── hostapd.deny ├── hostapd.eap_user ├── hostapd.eap_user_sqlite ├── hostapd.radius_clients ├── hostapd.sim_db ├── hostapd.vlan ├── hostapd.wpa_psk ├── hostapd_cli.1 ├── hostapd_cli.c ├── logwatch │ ├── README │ ├── hostapd │ └── hostapd.conf ├── main.c ├── nt_password_hash.c ├── wired.conf └── wps-ap-nfc.py ├── hs20 ├── client │ ├── Android.mk │ ├── Makefile │ ├── devdetail.xml │ ├── devinfo.xml │ ├── est.c │ ├── oma_dm_client.c │ ├── osu_client.c │ ├── osu_client.h │ └── spp_client.c └── server │ ├── Makefile │ ├── ca │ ├── clean.sh │ ├── est-csrattrs.cnf │ ├── est-csrattrs.sh │ ├── hs20.oid │ ├── ocsp-req.sh │ ├── ocsp-responder-ica.sh │ ├── ocsp-responder.sh │ ├── ocsp-update-cache.sh │ ├── openssl-root.cnf │ ├── openssl.cnf │ ├── setup.sh │ └── w1fi_logo.png │ ├── hs20-osu-server.txt │ ├── hs20_spp_server.c │ ├── spp_server.c │ ├── spp_server.h │ ├── sql-example.txt │ ├── sql.txt │ └── www │ ├── add-free.php │ ├── add-mo.php │ ├── cert-enroll.php │ ├── config.php │ ├── est.php │ ├── free-remediation.php │ ├── free.php │ ├── redirect.php │ ├── remediation.php │ ├── signup.php │ ├── spp.php │ └── users.php ├── mac80211_hwsim ├── tests │ ├── 0001-wpa2-psk │ │ ├── hostapd.conf │ │ ├── test.txt │ │ └── wpa_supplicant.conf │ └── 0002-vlan │ │ ├── hostapd.accept │ │ ├── hostapd.conf │ │ ├── hostapd.vlan │ │ └── test.txt └── tools │ ├── Makefile │ └── hwsim_test.c ├── patches ├── openssl-0.9.8-tls-extensions.patch ├── openssl-0.9.8d-tls-extensions.patch ├── openssl-0.9.8e-tls-extensions.patch ├── openssl-0.9.8g-tls-extensions.patch ├── openssl-0.9.8h-tls-extensions.patch ├── openssl-0.9.8i-tls-extensions.patch ├── openssl-0.9.8x-tls-extensions.patch └── openssl-0.9.9-session-ticket.patch ├── radius_example ├── .gitignore ├── Makefile ├── README └── radius_example.c ├── src ├── Makefile ├── ap │ ├── Makefile │ ├── accounting.c │ ├── accounting.h │ ├── acs.c │ ├── acs.h │ ├── ap_config.c │ ├── ap_config.h │ ├── ap_drv_ops.c │ ├── ap_drv_ops.h │ ├── ap_list.c │ ├── ap_list.h │ ├── ap_mlme.c │ ├── ap_mlme.h │ ├── authsrv.c │ ├── authsrv.h │ ├── beacon.c │ ├── beacon.h │ ├── ctrl_iface_ap.c │ ├── ctrl_iface_ap.h │ ├── dfs.c │ ├── dfs.h │ ├── drv_callbacks.c │ ├── eap_user_db.c │ ├── gas_serv.c │ ├── gas_serv.h │ ├── hostapd.c │ ├── hostapd.h │ ├── hs20.c │ ├── hs20.h │ ├── hw_features.c │ ├── hw_features.h │ ├── iapp.c │ ├── iapp.h │ ├── ieee802_11.c │ ├── ieee802_11.h │ ├── ieee802_11_auth.c │ ├── ieee802_11_auth.h │ ├── ieee802_11_ht.c │ ├── ieee802_11_shared.c │ ├── ieee802_11_vht.c │ ├── ieee802_1x.c │ ├── ieee802_1x.h │ ├── p2p_hostapd.c │ ├── p2p_hostapd.h │ ├── peerkey_auth.c │ ├── pmksa_cache_auth.c │ ├── pmksa_cache_auth.h │ ├── preauth_auth.c │ ├── preauth_auth.h │ ├── sta_info.c │ ├── sta_info.h │ ├── tkip_countermeasures.c │ ├── tkip_countermeasures.h │ ├── utils.c │ ├── vlan_init.c │ ├── vlan_init.h │ ├── vlan_util.c │ ├── vlan_util.h │ ├── wmm.c │ ├── wmm.h │ ├── wnm_ap.c │ ├── wnm_ap.h │ ├── wpa_auth.c │ ├── wpa_auth.h │ ├── wpa_auth_ft.c │ ├── wpa_auth_glue.c │ ├── wpa_auth_glue.h │ ├── wpa_auth_i.h │ ├── wpa_auth_ie.c │ ├── wpa_auth_ie.h │ ├── wps_hostapd.c │ └── wps_hostapd.h ├── common │ ├── Makefile │ ├── defs.h │ ├── eapol_common.h │ ├── gas.c │ ├── gas.h │ ├── ieee802_11_common.c │ ├── ieee802_11_common.h │ ├── ieee802_11_defs.h │ ├── ieee802_1x_defs.h │ ├── privsep_commands.h │ ├── qca-vendor-attr.h │ ├── qca-vendor.h │ ├── sae.c │ ├── sae.h │ ├── tnc.h │ ├── version.h │ ├── wpa_common.c │ ├── wpa_common.h │ ├── wpa_ctrl.c │ ├── wpa_ctrl.h │ ├── wpa_helpers.c │ └── wpa_helpers.h ├── crypto │ ├── .gitignore │ ├── Makefile │ ├── aes-cbc.c │ ├── aes-ccm.c │ ├── aes-ctr.c │ ├── aes-eax.c │ ├── aes-encblock.c │ ├── aes-gcm.c │ ├── aes-internal-dec.c │ ├── aes-internal-enc.c │ ├── aes-internal.c │ ├── aes-omac1.c │ ├── aes-unwrap.c │ ├── aes-wrap.c │ ├── aes.h │ ├── aes_i.h │ ├── aes_wrap.h │ ├── crypto.h │ ├── crypto_cryptoapi.c │ ├── crypto_gnutls.c │ ├── crypto_internal-cipher.c │ ├── crypto_internal-modexp.c │ ├── crypto_internal-rsa.c │ ├── crypto_internal.c │ ├── crypto_libtomcrypt.c │ ├── crypto_none.c │ ├── crypto_nss.c │ ├── crypto_openssl.c │ ├── des-internal.c │ ├── des_i.h │ ├── dh_group5.c │ ├── dh_group5.h │ ├── dh_groups.c │ ├── dh_groups.h │ ├── fips_prf_internal.c │ ├── fips_prf_openssl.c │ ├── md4-internal.c │ ├── md5-internal.c │ ├── md5.c │ ├── md5.h │ ├── md5_i.h │ ├── milenage.c │ ├── milenage.h │ ├── ms_funcs.c │ ├── ms_funcs.h │ ├── random.c │ ├── random.h │ ├── rc4.c │ ├── sha1-internal.c │ ├── sha1-pbkdf2.c │ ├── sha1-prf.c │ ├── sha1-tlsprf.c │ ├── sha1-tprf.c │ ├── sha1.c │ ├── sha1.h │ ├── sha1_i.h │ ├── sha256-internal.c │ ├── sha256-prf.c │ ├── sha256-tlsprf.c │ ├── sha256.c │ ├── sha256.h │ ├── sha256_i.h │ ├── tls.h │ ├── tls_gnutls.c │ ├── tls_internal.c │ ├── tls_none.c │ ├── tls_nss.c │ ├── tls_openssl.c │ └── tls_schannel.c ├── drivers │ ├── .gitignore │ ├── Makefile │ ├── android_drv.h │ ├── driver.h │ ├── driver_atheros.c │ ├── driver_bsd.c │ ├── driver_common.c │ ├── driver_hostap.c │ ├── driver_hostap.h │ ├── driver_macsec_qca.c │ ├── driver_madwifi.c │ ├── driver_ndis.c │ ├── driver_ndis.h │ ├── driver_ndis_.c │ ├── driver_nl80211.c │ ├── driver_none.c │ ├── driver_openbsd.c │ ├── driver_privsep.c │ ├── driver_roboswitch.c │ ├── driver_test.c │ ├── driver_wext.c │ ├── driver_wext.h │ ├── driver_wired.c │ ├── drivers.c │ ├── drivers.mak │ ├── drivers.mk │ ├── linux_ioctl.c │ ├── linux_ioctl.h │ ├── linux_wext.h │ ├── ndis_events.c │ ├── netlink.c │ ├── netlink.h │ ├── nl80211_copy.h │ ├── priv_netlink.h │ ├── rfkill.c │ └── rfkill.h ├── eap_common │ ├── Makefile │ ├── chap.c │ ├── chap.h │ ├── eap_common.c │ ├── eap_common.h │ ├── eap_defs.h │ ├── eap_eke_common.c │ ├── eap_eke_common.h │ ├── eap_fast_common.c │ ├── eap_fast_common.h │ ├── eap_gpsk_common.c │ ├── eap_gpsk_common.h │ ├── eap_ikev2_common.c │ ├── eap_ikev2_common.h │ ├── eap_pax_common.c │ ├── eap_pax_common.h │ ├── eap_peap_common.c │ ├── eap_peap_common.h │ ├── eap_psk_common.c │ ├── eap_psk_common.h │ ├── eap_pwd_common.c │ ├── eap_pwd_common.h │ ├── eap_sake_common.c │ ├── eap_sake_common.h │ ├── eap_sim_common.c │ ├── eap_sim_common.h │ ├── eap_tlv_common.h │ ├── eap_ttls.h │ ├── eap_wsc_common.c │ ├── eap_wsc_common.h │ ├── ikev2_common.c │ └── ikev2_common.h ├── eap_peer │ ├── Makefile │ ├── eap.c │ ├── eap.h │ ├── eap_aka.c │ ├── eap_config.h │ ├── eap_eke.c │ ├── eap_fast.c │ ├── eap_fast_pac.c │ ├── eap_fast_pac.h │ ├── eap_gpsk.c │ ├── eap_gtc.c │ ├── eap_i.h │ ├── eap_ikev2.c │ ├── eap_leap.c │ ├── eap_md5.c │ ├── eap_methods.c │ ├── eap_methods.h │ ├── eap_mschapv2.c │ ├── eap_otp.c │ ├── eap_pax.c │ ├── eap_peap.c │ ├── eap_proxy.h │ ├── eap_proxy_dummy.c │ ├── eap_psk.c │ ├── eap_pwd.c │ ├── eap_sake.c │ ├── eap_sim.c │ ├── eap_socket.c │ ├── eap_tls.c │ ├── eap_tls_common.c │ ├── eap_tls_common.h │ ├── eap_tnc.c │ ├── eap_ttls.c │ ├── eap_vendor_test.c │ ├── eap_wsc.c │ ├── ikev2.c │ ├── ikev2.h │ ├── mschapv2.c │ ├── mschapv2.h │ ├── tncc.c │ └── tncc.h ├── eap_server │ ├── Makefile │ ├── eap.h │ ├── eap_i.h │ ├── eap_methods.h │ ├── eap_server.c │ ├── eap_server_aka.c │ ├── eap_server_eke.c │ ├── eap_server_fast.c │ ├── eap_server_gpsk.c │ ├── eap_server_gtc.c │ ├── eap_server_identity.c │ ├── eap_server_ikev2.c │ ├── eap_server_md5.c │ ├── eap_server_methods.c │ ├── eap_server_mschapv2.c │ ├── eap_server_pax.c │ ├── eap_server_peap.c │ ├── eap_server_psk.c │ ├── eap_server_pwd.c │ ├── eap_server_sake.c │ ├── eap_server_sim.c │ ├── eap_server_tls.c │ ├── eap_server_tls_common.c │ ├── eap_server_tnc.c │ ├── eap_server_ttls.c │ ├── eap_server_vendor_test.c │ ├── eap_server_wsc.c │ ├── eap_sim_db.c │ ├── eap_sim_db.h │ ├── eap_tls_common.h │ ├── ikev2.c │ ├── ikev2.h │ ├── tncs.c │ └── tncs.h ├── eapol_auth │ ├── Makefile │ ├── eapol_auth_dump.c │ ├── eapol_auth_sm.c │ ├── eapol_auth_sm.h │ └── eapol_auth_sm_i.h ├── eapol_supp │ ├── Makefile │ ├── eapol_supp_sm.c │ └── eapol_supp_sm.h ├── l2_packet │ ├── Makefile │ ├── l2_packet.h │ ├── l2_packet_freebsd.c │ ├── l2_packet_linux.c │ ├── l2_packet_ndis.c │ ├── l2_packet_none.c │ ├── l2_packet_pcap.c │ ├── l2_packet_privsep.c │ └── l2_packet_winpcap.c ├── lib.rules ├── p2p │ ├── Makefile │ ├── p2p.c │ ├── p2p.h │ ├── p2p_build.c │ ├── p2p_dev_disc.c │ ├── p2p_go_neg.c │ ├── p2p_group.c │ ├── p2p_i.h │ ├── p2p_invitation.c │ ├── p2p_parse.c │ ├── p2p_pd.c │ ├── p2p_sd.c │ └── p2p_utils.c ├── pae │ ├── Makefile │ ├── ieee802_1x_cp.c │ ├── ieee802_1x_cp.h │ ├── ieee802_1x_kay.c │ ├── ieee802_1x_kay.h │ ├── ieee802_1x_kay_i.h │ ├── ieee802_1x_key.c │ ├── ieee802_1x_key.h │ ├── ieee802_1x_secy_ops.c │ └── ieee802_1x_secy_ops.h ├── radius │ ├── .gitignore │ ├── Makefile │ ├── radius.c │ ├── radius.h │ ├── radius_client.c │ ├── radius_client.h │ ├── radius_das.c │ ├── radius_das.h │ ├── radius_server.c │ └── radius_server.h ├── rsn_supp │ ├── Makefile │ ├── peerkey.c │ ├── peerkey.h │ ├── pmksa_cache.c │ ├── pmksa_cache.h │ ├── preauth.c │ ├── preauth.h │ ├── tdls.c │ ├── wpa.c │ ├── wpa.h │ ├── wpa_ft.c │ ├── wpa_i.h │ ├── wpa_ie.c │ └── wpa_ie.h ├── tls │ ├── .gitignore │ ├── Makefile │ ├── asn1.c │ ├── asn1.h │ ├── bignum.c │ ├── bignum.h │ ├── libtommath.c │ ├── pkcs1.c │ ├── pkcs1.h │ ├── pkcs5.c │ ├── pkcs5.h │ ├── pkcs8.c │ ├── pkcs8.h │ ├── rsa.c │ ├── rsa.h │ ├── tlsv1_client.c │ ├── tlsv1_client.h │ ├── tlsv1_client_i.h │ ├── tlsv1_client_read.c │ ├── tlsv1_client_write.c │ ├── tlsv1_common.c │ ├── tlsv1_common.h │ ├── tlsv1_cred.c │ ├── tlsv1_cred.h │ ├── tlsv1_record.c │ ├── tlsv1_record.h │ ├── tlsv1_server.c │ ├── tlsv1_server.h │ ├── tlsv1_server_i.h │ ├── tlsv1_server_read.c │ ├── tlsv1_server_write.c │ ├── x509v3.c │ └── x509v3.h ├── utils │ ├── .gitignore │ ├── Makefile │ ├── base64.c │ ├── base64.h │ ├── bitfield.c │ ├── bitfield.h │ ├── browser-android.c │ ├── browser-system.c │ ├── browser-wpadebug.c │ ├── browser.c │ ├── browser.h │ ├── build_config.h │ ├── common.c │ ├── common.h │ ├── edit.c │ ├── edit.h │ ├── edit_readline.c │ ├── edit_simple.c │ ├── eloop.c │ ├── eloop.h │ ├── eloop_win.c │ ├── ext_password.c │ ├── ext_password.h │ ├── ext_password_i.h │ ├── ext_password_test.c │ ├── http-utils.h │ ├── http_curl.c │ ├── includes.h │ ├── ip_addr.c │ ├── ip_addr.h │ ├── list.h │ ├── os.h │ ├── os_internal.c │ ├── os_none.c │ ├── os_unix.c │ ├── os_win32.c │ ├── pcsc_funcs.c │ ├── pcsc_funcs.h │ ├── platform.h │ ├── radiotap.c │ ├── radiotap.h │ ├── radiotap_iter.h │ ├── state_machine.h │ ├── trace.c │ ├── trace.h │ ├── utils_module_tests.c │ ├── uuid.c │ ├── uuid.h │ ├── wpa_debug.c │ ├── wpa_debug.h │ ├── wpabuf.c │ ├── wpabuf.h │ ├── xml-utils.c │ ├── xml-utils.h │ └── xml_libxml2.c └── wps │ ├── Makefile │ ├── http.h │ ├── http_client.c │ ├── http_client.h │ ├── http_server.c │ ├── http_server.h │ ├── httpread.c │ ├── httpread.h │ ├── ndef.c │ ├── upnp_xml.c │ ├── upnp_xml.h │ ├── wps.c │ ├── wps.h │ ├── wps_attr_build.c │ ├── wps_attr_parse.c │ ├── wps_attr_parse.h │ ├── wps_attr_process.c │ ├── wps_common.c │ ├── wps_defs.h │ ├── wps_dev_attr.c │ ├── wps_dev_attr.h │ ├── wps_enrollee.c │ ├── wps_er.c │ ├── wps_er.h │ ├── wps_er_ssdp.c │ ├── wps_i.h │ ├── wps_module_tests.c │ ├── wps_registrar.c │ ├── wps_upnp.c │ ├── wps_upnp.h │ ├── wps_upnp_ap.c │ ├── wps_upnp_event.c │ ├── wps_upnp_i.h │ ├── wps_upnp_ssdp.c │ ├── wps_upnp_web.c │ └── wps_validate.c ├── tests ├── .gitignore ├── Makefile ├── hwsim │ ├── README │ ├── auth_serv │ │ ├── as.conf │ │ ├── as2.conf │ │ ├── ca-incorrect.pem │ │ ├── ca.der │ │ ├── ca.pem │ │ ├── dh.conf │ │ ├── eap_user.conf │ │ ├── hlr_auc_gw.gsm │ │ ├── hlr_auc_gw.milenage_db │ │ ├── ocsp-server-cache.der │ │ ├── ocsp-server-cache.der-invalid │ │ ├── radius_clients.conf │ │ ├── radius_clients_ipv6.conf │ │ ├── server-eku-client-server.key │ │ ├── server-eku-client-server.pem │ │ ├── server-eku-client.key │ │ ├── server-eku-client.pem │ │ ├── server-expired.key │ │ ├── server-expired.pem │ │ ├── server-no-dnsname.key │ │ ├── server-no-dnsname.pem │ │ ├── server.key │ │ ├── server.pem │ │ ├── server.pkcs12 │ │ ├── user.key │ │ ├── user.pem │ │ └── user.pkcs12 │ ├── bss-1.conf │ ├── bss-2.conf │ ├── bss-3.conf │ ├── bss-ht40-1.conf │ ├── bss-ht40-2.conf │ ├── build.sh │ ├── check_kernel.py │ ├── dictionary.radius │ ├── example-hostapd.config │ ├── example-wpa_supplicant.config │ ├── hostapd.accept │ ├── hostapd.macaddr │ ├── hostapd.py │ ├── hostapd.vlan │ ├── hostapd.wpa_psk │ ├── hwsim.py │ ├── hwsim_utils.py │ ├── multi-bss-acs.conf │ ├── multi-bss.conf │ ├── netlink.py │ ├── nl80211.py │ ├── p2p0.conf │ ├── p2p1.conf │ ├── p2p2.conf │ ├── radius_das.py │ ├── run-all.sh │ ├── run-tests.py │ ├── start.sh │ ├── stop.sh │ ├── test_ap_acs.py │ ├── test_ap_ciphers.py │ ├── test_ap_config.py │ ├── test_ap_dynamic.py │ ├── test_ap_eap.py │ ├── test_ap_ft.py │ ├── test_ap_hs20.py │ ├── test_ap_ht.py │ ├── test_ap_open.py │ ├── test_ap_params.py │ ├── test_ap_pmf.py │ ├── test_ap_psk.py │ ├── test_ap_qosmap.py │ ├── test_ap_roam.py │ ├── test_ap_tdls.py │ ├── test_ap_vht.py │ ├── test_ap_vlan.py │ ├── test_ap_wps.py │ ├── test_autoscan.py │ ├── test_bgscan.py │ ├── test_cfg80211.py │ ├── test_connect_cmd.py │ ├── test_dfs.py │ ├── test_ext_password.py │ ├── test_gas.py │ ├── test_hapd_ctrl.py │ ├── test_ibss.py │ ├── test_ieee8021x.py │ ├── test_module_tests.py │ ├── test_monitor_interface.py │ ├── test_nfc_p2p.py │ ├── test_nfc_wps.py │ ├── test_offchannel_tx.py │ ├── test_p2p_autogo.py │ ├── test_p2p_channel.py │ ├── test_p2p_concurrency.py │ ├── test_p2p_device.py │ ├── test_p2p_discovery.py │ ├── test_p2p_grpform.py │ ├── test_p2p_invitation.py │ ├── test_p2p_messages.py │ ├── test_p2p_persistent.py │ ├── test_p2p_service.py │ ├── test_p2p_wifi_display.py │ ├── test_peerkey.py │ ├── test_pmksa_cache.py │ ├── test_radio_work.py │ ├── test_radius.py │ ├── test_sae.py │ ├── test_scan.py │ ├── test_ssid.py │ ├── test_sta_dynamic.py │ ├── test_tnc.py │ ├── test_wep.py │ ├── test_wext.py │ ├── test_wnm.py │ ├── test_wpas_ap.py │ ├── test_wpas_config.py │ ├── test_wpas_ctrl.py │ ├── tnc │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── hostap2_imc.c │ │ ├── hostap2_imv.c │ │ ├── hostap_imc.c │ │ ├── hostap_imv.c │ │ └── tnc_config │ ├── utils.py │ ├── vm │ │ ├── .gitignore │ │ ├── README │ │ ├── inside.sh │ │ ├── kernel-config │ │ ├── parallel-vm.sh │ │ ├── uevent.sh │ │ └── vm-run.sh │ ├── w1fi_logo.png │ ├── wlantest.py │ ├── wpasupplicant.py │ └── wps-wep-cred ├── test-aes.c ├── test-asn1.c ├── test-base64.c ├── test-https.c ├── test-list.c ├── test-md4.c ├── test-md5.c ├── test-milenage.c ├── test-ms_funcs.c ├── test-rc4.c ├── test-rsa-sig-ver.c ├── test-sha1.c ├── test-sha256.c ├── test-x509.c ├── test-x509v3.c ├── test_x509v3_nist.sh └── test_x509v3_nist2.sh ├── wlantest ├── Makefile ├── bip.c ├── bss.c ├── ccmp.c ├── crc32.c ├── ctrl.c ├── gcmp.c ├── inject.c ├── monitor.c ├── process.c ├── readpcap.c ├── rx_data.c ├── rx_eapol.c ├── rx_ip.c ├── rx_mgmt.c ├── rx_tdls.c ├── sta.c ├── test_vectors.c ├── tkip.c ├── wep.c ├── wired.c ├── wlantest.c ├── wlantest.h ├── wlantest_cli.c ├── wlantest_ctrl.h └── writepcap.c ├── wpa_supplicant ├── .config ├── .gitignore ├── Android.mk ├── ChangeLog ├── Makefile ├── README ├── README-HS20 ├── README-P2P ├── README-WPS ├── README-Windows.txt ├── android.config ├── ap.c ├── ap.h ├── autoscan.c ├── autoscan.h ├── autoscan_exponential.c ├── autoscan_periodic.c ├── bgscan.c ├── bgscan.h ├── bgscan_learn.c ├── bgscan_simple.c ├── blacklist.c ├── blacklist.h ├── bss.c ├── bss.h ├── config.c ├── config.h ├── config_file.c ├── config_none.c ├── config_ssid.h ├── config_winreg.c ├── ctrl_iface.c ├── ctrl_iface.h ├── ctrl_iface_named_pipe.c ├── ctrl_iface_udp.c ├── ctrl_iface_unix.c ├── dbus │ ├── .gitignore │ ├── Makefile │ ├── dbus-wpa_supplicant.conf │ ├── dbus_common.c │ ├── dbus_common.h │ ├── dbus_common_i.h │ ├── dbus_dict_helpers.c │ ├── dbus_dict_helpers.h │ ├── dbus_new.c │ ├── dbus_new.h │ ├── dbus_new_handlers.c │ ├── dbus_new_handlers.h │ ├── dbus_new_handlers_p2p.c │ ├── dbus_new_handlers_p2p.h │ ├── dbus_new_handlers_wps.c │ ├── dbus_new_helpers.c │ ├── dbus_new_helpers.h │ ├── dbus_new_introspect.c │ ├── dbus_old.c │ ├── dbus_old.h │ ├── dbus_old_handlers.c │ ├── dbus_old_handlers.h │ ├── dbus_old_handlers_wps.c │ ├── fi.epitest.hostap.WPASupplicant.service.in │ └── fi.w1.wpa_supplicant1.service.in ├── defconfig ├── doc │ └── docbook │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── eapol_test.sgml │ │ ├── wpa_background.sgml │ │ ├── wpa_cli.sgml │ │ ├── wpa_gui.sgml │ │ ├── wpa_passphrase.sgml │ │ ├── wpa_priv.sgml │ │ ├── wpa_supplicant.conf.sgml │ │ └── wpa_supplicant.sgml ├── driver_i.h ├── eap_proxy_dummy.mak ├── eap_proxy_dummy.mk ├── eap_register.c ├── eap_testing.txt ├── eapol_test.c ├── events.c ├── example.conf ├── examples │ ├── 60_wpa_supplicant │ ├── dbus-listen-preq.py │ ├── ieee8021x.conf │ ├── openCryptoki.conf │ ├── p2p-action-udhcp.sh │ ├── p2p-action.sh │ ├── p2p-nfc.py │ ├── p2p │ │ ├── p2p_connect.py │ │ ├── p2p_disconnect.py │ │ ├── p2p_find.py │ │ ├── p2p_flush.py │ │ ├── p2p_group_add.py │ │ ├── p2p_invite.py │ │ ├── p2p_listen.py │ │ └── p2p_stop_find.py │ ├── plaintext.conf │ ├── udhcpd-p2p.conf │ ├── wep.conf │ ├── wpa-psk-tkip.conf │ ├── wpa2-eap-ccmp.conf │ ├── wpas-dbus-new-getall.py │ ├── wpas-dbus-new-signals.py │ ├── wpas-dbus-new-wps.py │ ├── wpas-dbus-new.py │ ├── wpas-test.py │ ├── wps-ap-cli │ └── wps-nfc.py ├── gas_query.c ├── gas_query.h ├── hs20_supplicant.c ├── hs20_supplicant.h ├── ibss_rsn.c ├── ibss_rsn.h ├── interworking.c ├── interworking.h ├── main.c ├── main_none.c ├── main_winmain.c ├── main_winsvc.c ├── nfc_pw_token.c ├── nmake.mak ├── notify.c ├── notify.h ├── offchannel.c ├── offchannel.h ├── p2p_supplicant.c ├── p2p_supplicant.h ├── preauth_test.c ├── scan.c ├── scan.h ├── sme.c ├── sme.h ├── systemd │ ├── wpa_supplicant-nl80211.service.arg.in │ ├── wpa_supplicant-wired.service.arg.in │ ├── wpa_supplicant.service.arg.in │ └── wpa_supplicant.service.in ├── tests │ ├── link_test.c │ ├── test_eap_sim_common.c │ └── test_wpa.c ├── todo.txt ├── utils │ └── log2pcap.py ├── vs2005 │ ├── eapol_test │ │ └── eapol_test.vcproj │ ├── win_if_list │ │ └── win_if_list.vcproj │ ├── wpa_cli │ │ └── wpa_cli.vcproj │ ├── wpa_passphrase │ │ └── wpa_passphrase.vcproj │ ├── wpa_supplicant.sln │ ├── wpa_supplicant │ │ └── wpa_supplicant.vcproj │ └── wpasvc │ │ └── wpasvc.vcproj ├── wifi_display.c ├── wifi_display.h ├── win_example.reg ├── win_if_list.c ├── wnm_sta.c ├── wnm_sta.h ├── wpa_cli.c ├── wpa_gui-qt4 │ ├── .gitignore │ ├── addinterface.cpp │ ├── addinterface.h │ ├── eventhistory.cpp │ ├── eventhistory.h │ ├── eventhistory.ui │ ├── icons.qrc │ ├── icons │ │ ├── Makefile │ │ ├── README │ │ ├── ap.svg │ │ ├── group.svg │ │ ├── invitation.svg │ │ ├── laptop.svg │ │ └── wpa_gui.svg │ ├── icons_png.qrc │ ├── lang │ │ ├── .gitignore │ │ └── wpa_gui_de.ts │ ├── main.cpp │ ├── networkconfig.cpp │ ├── networkconfig.h │ ├── networkconfig.ui │ ├── peers.cpp │ ├── peers.h │ ├── peers.ui │ ├── scanresults.cpp │ ├── scanresults.h │ ├── scanresults.ui │ ├── signalbar.cpp │ ├── signalbar.h │ ├── stringquery.cpp │ ├── stringquery.h │ ├── userdatarequest.cpp │ ├── userdatarequest.h │ ├── userdatarequest.ui │ ├── wpa_gui.desktop │ ├── wpa_gui.pro │ ├── wpagui.cpp │ ├── wpagui.h │ ├── wpagui.ui │ └── wpamsg.h ├── wpa_passphrase.c ├── wpa_priv.c ├── wpa_supplicant.c ├── wpa_supplicant.conf ├── wpa_supplicant_conf.mk ├── wpa_supplicant_conf.sh ├── wpa_supplicant_i.h ├── wpa_supplicant_template.conf ├── wpas_glue.c ├── wpas_glue.h ├── wpas_kay.c ├── wpas_kay.h ├── wpas_module_tests.c ├── wps_supplicant.c └── wps_supplicant.h ├── wpadebug ├── AndroidManifest.xml ├── README ├── build.xml ├── project.properties ├── res │ ├── layout │ │ ├── cred_edit.xml │ │ └── main.xml │ └── raw │ │ ├── shell_commands.txt │ │ └── wpa_commands.txt └── src │ └── w1 │ └── fi │ └── wpadebug │ ├── CommandListActivity.java │ ├── DisplayMessageActivity.java │ ├── MainActivity.java │ ├── WifiReceiver.java │ ├── WpaCommandListActivity.java │ ├── WpaCredActivity.java │ ├── WpaCredEditActivity.java │ ├── WpaNfcActivity.java │ └── WpaWebViewActivity.java └── wpaspy ├── Makefile ├── setup.py ├── test.py ├── wpaspy.c └── wpaspy.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.d 3 | *.gcno 4 | *.gcda 5 | *.gcov 6 | *.pyc 7 | *~ 8 | .config 9 | tests/hwsim/logs 10 | wpaspy/build 11 | wpa_supplicant/eapol_test 12 | wpa_supplicant/nfc_pw_token 13 | wpa_supplicant/preauth_test 14 | wpa_supplicant/wpa_cli 15 | wpa_supplicant/wpa_passphrase 16 | wpa_supplicant/wpa_supplicant 17 | wpa_supplicant/wpa_priv 18 | wpa_supplicant/wpa_gui/Makefile 19 | wpa_supplicant/wpa_gui/wpa_gui 20 | wpa_supplicant/wpa_gui-qt4/Makefile 21 | wpa_supplicant/wpa_gui-qt4/wpa_gui 22 | hostapd/hostapd 23 | hostapd/hostapd_cli 24 | hostapd/hlr_auc_gw 25 | hostapd/nt_password_hash 26 | mac80211_hwsim/tools/hwsim_test 27 | wlantest/libwlantest.a 28 | wlantest/test_vectors 29 | wlantest/wlantest 30 | wlantest/wlantest_cli 31 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | ifneq ($(filter VER_0_8_X VER_2_1_DEVEL,$(WPA_SUPPLICANT_VERSION)),) 4 | # The order of the 2 Android.mks does matter! 5 | # TODO: Clean up the Android.mks, reset all the temporary variables at the 6 | # end of each Android.mk, so that one Android.mk doesn't depend on variables 7 | # set up in the other Android.mk. 8 | include $(LOCAL_PATH)/hostapd/Android.mk \ 9 | $(LOCAL_PATH)/wpa_supplicant/Android.mk 10 | endif 11 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | wpa_supplicant and hostapd 2 | -------------------------- 3 | 4 | Copyright (c) 2002-2012, Jouni Malinen and contributors 5 | All Rights Reserved. 6 | 7 | 8 | See the README file for the current license terms. 9 | 10 | This software was previously distributed under BSD/GPL v2 dual license 11 | terms that allowed either of those license alternatives to be 12 | selected. As of February 11, 2012, the project has chosen to use only 13 | the BSD license option for future distribution. As such, the GPL v2 14 | license option is no longer used. It should be noted that the BSD 15 | license option (the one with advertisement clause removed) is compatible 16 | with GPL and as such, does not prevent use of this software in projects 17 | that use GPL. 18 | 19 | Some of the files may still include pointers to GPL version 2 license 20 | terms. However, such copyright and license notifications are maintained 21 | only for attribution purposes and any distribution of this software 22 | after February 11, 2012 is no longer under the GPL v2 option. 23 | -------------------------------------------------------------------------------- /build_release: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ -z "$1" ]; then 6 | echo "build_release " 7 | exit 1 8 | fi 9 | 10 | TMP=tmp.build_release 11 | RELDIR=`pwd`/Release 12 | VER=$1 13 | NOW=`date +%Y-%m-%d` 14 | 15 | echo "Version: $VER - $NOW" 16 | 17 | DATEw=`head -n 3 wpa_supplicant/ChangeLog | tail -n 1 | sed "s/ .*//"` 18 | DATEh=`head -n 3 hostapd/ChangeLog | tail -n 1 | sed "s/ .*//"` 19 | 20 | if [ "$DATEw" != "$NOW" -o "$DATEh" != "$NOW" ]; then 21 | echo "NOTE! Date mismatch in ChangeLog: wpa_supplicant $DATEw hostapd $DATEh != $NOW" 22 | fi 23 | 24 | if [ -r $TMP ]; then 25 | echo "Temporary directory '$TMP' exists. Remove it before running this." 26 | exit 1 27 | fi 28 | 29 | mkdir $TMP 30 | mkdir -p $RELDIR 31 | 32 | git archive --format=tar --prefix=wpa-$VER/ HEAD \ 33 | README COPYING patches src wpa_supplicant hostapd hs20 | 34 | gzip > $RELDIR/wpa-$VER.tar.gz 35 | git archive --format=tar --prefix=hostapd-$VER/ HEAD \ 36 | README COPYING patches src hostapd | 37 | gzip > $RELDIR/hostapd-$VER.tar.gz 38 | git archive --format=tar --prefix=wpa_supplicant-$VER/ HEAD \ 39 | README COPYING patches src wpa_supplicant hs20/client | 40 | tar --directory=$TMP -xf - 41 | 42 | cd $TMP 43 | make -C wpa_supplicant-$VER/wpa_supplicant/doc/docbook man 44 | rm -f wpa_supplicant-$VER/wpa_supplicant/doc/docbook/manpage.{links,refs} 45 | tar czf $RELDIR/wpa_supplicant-$VER.tar.gz wpa_supplicant-$VER 46 | cd .. 47 | rm -r $TMP 48 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | doxygen.warnings 2 | hostapd.eps 3 | hostapd.png 4 | html 5 | latex 6 | p2p_arch.eps 7 | p2p_arch.png 8 | p2p_arch2.eps 9 | p2p_arch2.png 10 | p2p_sm.eps 11 | p2p_sm.png 12 | wpa_supplicant.eps 13 | wpa_supplicant.png 14 | wpa_supplicant-devel.pdf 15 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | all: docs 2 | 3 | %.eps: %.fig 4 | fig2dev -L eps $*.fig $*.eps 5 | 6 | %.png: %.fig 7 | fig2dev -L png -m 3 $*.fig | pngtopnm | pnmscale 0.4 | pnmtopng \ 8 | > $*.png 9 | 10 | %.png: %.dot 11 | dot $*.dot -Tpng -o $*.png 12 | 13 | %.eps: %.dot 14 | dot $*.dot -Tps -o $*.eps 15 | 16 | _wpa_supplicant.png: wpa_supplicant.png 17 | cp $< $@ 18 | 19 | docs-pics: wpa_supplicant.png wpa_supplicant.eps hostapd.png hostapd.eps p2p_sm.png p2p_sm.eps p2p_arch.png p2p_arch.eps p2p_arch2.png p2p_arch2.eps 20 | 21 | docs: docs-pics 22 | (cd ..; doxygen doc/doxygen.conf; cd doc) 23 | $(MAKE) -C latex 24 | cp latex/refman.pdf wpa_supplicant-devel.pdf 25 | 26 | html: docs-pics _wpa_supplicant.png 27 | (cd ..; doxygen doc/doxygen.conf; cd doc) 28 | 29 | clean: 30 | rm -f *~ 31 | rm -f wpa_supplicant.eps wpa_supplicant.png 32 | rm -f _wpa_supplicant.png 33 | rm -f hostapd.eps hostapd.png 34 | rm -f p2p_sm.eps p2p_sm.png 35 | rm -f p2p_arch.eps p2p_arch.png 36 | rm -f p2p_arch2.eps p2p_arch2.png 37 | rm -f doxygen.warnings 38 | rm -rf html latex 39 | rm -f wpa_supplicant-devel.pdf 40 | -------------------------------------------------------------------------------- /eap_example/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | eap_example 3 | libeap.so 4 | libeap.a 5 | -------------------------------------------------------------------------------- /eap_example/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDBzCCAnCgAwIBAgIJAIb4NS4TdLXUMA0GCSqGSIb3DQEBBQUAMGExCzAJBgNV 3 | BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMQ4wDAYDVQQKEwV3MS5maTEQMA4G 4 | A1UEAxMHVGVzdCBDQTEbMBkGCSqGSIb3DQEJARYMdGVzdGNhQHcxLmZpMB4XDTA3 5 | MTIwOTAzMTQzN1oXDTE3MTIwNjAzMTQzN1owYTELMAkGA1UEBhMCVVMxEzARBgNV 6 | BAgTCkNhbGlmb3JuaWExDjAMBgNVBAoTBXcxLmZpMRAwDgYDVQQDEwdUZXN0IENB 7 | MRswGQYJKoZIhvcNAQkBFgx0ZXN0Y2FAdzEuZmkwgZ8wDQYJKoZIhvcNAQEBBQAD 8 | gY0AMIGJAoGBAO6GoecRclnILh9FTvqnY/yUZmeJDgC+3/PQiicpMDhAzCkWAmi+ 9 | a1LSnqakNN/GdCy3q053TFLFEzhEHkhhRwY/zzj2vZIcFZESoUhr67CzCpcPmTGa 10 | AfOzsGPjaH6xYcaOR4RZMfXd/EKfAauHxj3LuCusLL5hK/FwxWhQJNJrAgMBAAGj 11 | gcYwgcMwHQYDVR0OBBYEFKhJuSLJ6JhcB/dRgB8j0h9mOlpKMIGTBgNVHSMEgYsw 12 | gYiAFKhJuSLJ6JhcB/dRgB8j0h9mOlpKoWWkYzBhMQswCQYDVQQGEwJVUzETMBEG 13 | A1UECBMKQ2FsaWZvcm5pYTEOMAwGA1UEChMFdzEuZmkxEDAOBgNVBAMTB1Rlc3Qg 14 | Q0ExGzAZBgkqhkiG9w0BCQEWDHRlc3RjYUB3MS5maYIJAIb4NS4TdLXUMAwGA1Ud 15 | EwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAuU+5Uerq+n8WgiIsiANT3wUoGe2Y 16 | cnoQi2nVjUHrivgMDufH0tgh1AVfc3wVNNREdGC136qr1KBNqalQx2rKZ76xeNqW 17 | sQa2LIC2wE7Q7LJsltUcUjPyZHGUhBqWjKsCvlonfNB6JHkEayTEvVvyupgzTsxW 18 | QuuRdZ0sNv/S8VI= 19 | -----END CERTIFICATE----- 20 | -------------------------------------------------------------------------------- /eap_example/eap_example.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Example application showing how EAP peer and server code from 3 | * wpa_supplicant/hostapd can be used as a library. This example program 4 | * initializes both an EAP server and an EAP peer entities and then runs 5 | * through an EAP-PEAP/MSCHAPv2 authentication. 6 | * Copyright (c) 2007, Jouni Malinen 7 | * 8 | * This software may be distributed under the terms of the BSD license. 9 | * See README for more details. 10 | */ 11 | 12 | #include "includes.h" 13 | 14 | #include "common.h" 15 | 16 | 17 | int eap_example_peer_init(void); 18 | void eap_example_peer_deinit(void); 19 | int eap_example_peer_step(void); 20 | 21 | int eap_example_server_init(void); 22 | void eap_example_server_deinit(void); 23 | int eap_example_server_step(void); 24 | 25 | 26 | int main(int argc, char *argv[]) 27 | { 28 | int res_s, res_p; 29 | 30 | wpa_debug_level = 0; 31 | 32 | if (eap_example_peer_init() < 0 || 33 | eap_example_server_init() < 0) 34 | return -1; 35 | 36 | do { 37 | printf("---[ server ]--------------------------------\n"); 38 | res_s = eap_example_server_step(); 39 | printf("---[ peer ]----------------------------------\n"); 40 | res_p = eap_example_peer_step(); 41 | } while (res_s || res_p); 42 | 43 | eap_example_peer_deinit(); 44 | eap_example_server_deinit(); 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /eap_example/server-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXAIBAAKBgQDToYuDPmjEWu+/Aj0RVWTSb07sX6dAkPnrTaUjZAG5AhjRqJWz 3 | zD50kFmVKi+R7GgS5tlGzLUtokdwjuSUAmz8tMXwIwmVeS0HluFDVSi94XbVRczE 4 | +nyoDigg1RGyy1mc3t5RG84bvNatq98OceJag4ngh8L8I4k1qTLRMlyBJwIDAQAB 5 | AoGAP+v0asDn/h8FeSkg7uJfIJyUNxsxNnRTuHnsXkMvrgTvICyOgw828hhDpqVm 6 | VuoUCVmG2Tatpsn0UBApBHezGRh0u1syWoGM8fiDvZmoYmhFe5FxKnftg3KNXhDf 7 | Agk4OxwNNPBXpQFQP+GNxh6Qs7FEkYHLRh/J7vC0+wp3UWECQQDzcTQZXqYPow5M 8 | uinL819HKfh1n2257w1HGvw8cMCiYbKRyR74Q18TJcxuEyEwnPrg5ZGpMPDKiIOU 9 | SlgAMLBXAkEA3oxBpRue1Kqb2+Fq6lhZ7PQiZC5F69upIb/wxbk8ByImEl1pUKFW 10 | rV+YoKujbnj77PmMq1+R0dFkT1ai3zDzsQJBAMa3CUgMMpFhEDMhYyzQJF36rI2W 11 | 7gJwV+5K4MqVXyktho3qFhWhKOKAYDcZ9mWwPjmGKzhocqVgecd6SAsfs1ECQA7r 12 | xHL3eRy1G6IQaQSxS8YxUCT7XUDFB3/1yITZOIcZ6QeOL8NyLceOA0OyflCn1+w5 13 | hw7uZ25z5Y/UNTNVquECQEgto3zPneEW06qkEnRz9EbLtWR3nRBS/QGrjOFNUuln 14 | pNhVUH4RB17Kk35xveUTz4U/Iw/WRfGNjFLHrtR/5xk= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /eap_example/server.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/eap_example/server.key -------------------------------------------------------------------------------- /eap_example/server.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC0zCCAjygAwIBAgIJAIb4NS4TdLXVMA0GCSqGSIb3DQEBBQUAMGExCzAJBgNV 3 | BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMQ4wDAYDVQQKEwV3MS5maTEQMA4G 4 | A1UEAxMHVGVzdCBDQTEbMBkGCSqGSIb3DQEJARYMdGVzdGNhQHcxLmZpMB4XDTA3 5 | MTIwOTAzMTUwOFoXDTE3MTIwNjAzMTUwOFoweTELMAkGA1UEBhMCVVMxEzARBgNV 6 | BAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xDjAMBgNVBAoT 7 | BXcxLmZpMRAwDgYDVQQDEwdUZXN0IEFTMRswGQYJKoZIhvcNAQkBFgx0ZXN0YXNA 8 | dzEuZmkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANOhi4M+aMRa778CPRFV 9 | ZNJvTuxfp0CQ+etNpSNkAbkCGNGolbPMPnSQWZUqL5HsaBLm2UbMtS2iR3CO5JQC 10 | bPy0xfAjCZV5LQeW4UNVKL3hdtVFzMT6fKgOKCDVEbLLWZze3lEbzhu81q2r3w5x 11 | 4lqDieCHwvwjiTWpMtEyXIEnAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4 12 | QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBRb 13 | xGTC3mPimgyGb5vYLLV5wyc9ITAfBgNVHSMEGDAWgBSoSbkiyeiYXAf3UYAfI9If 14 | ZjpaSjANBgkqhkiG9w0BAQUFAAOBgQA9wVGtroz/rsx1EeALJejW01SAr4kpTxoS 15 | WP6zuWFb+J/lJd7DeVM6/QBYAwZb0fB6nwSpJJCj6XDRZtN/yLeaTd/rCZrfom4Z 16 | 8gbkWMTXDn2Cea2VnCe5W0gK+4dIj5DD5CpPvgt4lYqlwN0WAih6twd7Q4x/tiiJ 17 | ejNQzlTHOg== 18 | -----END CERTIFICATE----- 19 | -------------------------------------------------------------------------------- /hostapd/config_file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / Configuration file parser 3 | * Copyright (c) 2003-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef CONFIG_FILE_H 10 | #define CONFIG_FILE_H 11 | 12 | struct hostapd_config * hostapd_config_read(const char *fname); 13 | int hostapd_set_iface(struct hostapd_config *conf, 14 | struct hostapd_bss_config *bss, char *field, 15 | char *value); 16 | 17 | #endif /* CONFIG_FILE_H */ 18 | -------------------------------------------------------------------------------- /hostapd/ctrl_iface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / UNIX domain socket -based control interface 3 | * Copyright (c) 2004, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef CTRL_IFACE_H 10 | #define CTRL_IFACE_H 11 | 12 | #ifndef CONFIG_NO_CTRL_IFACE 13 | int hostapd_ctrl_iface_init(struct hostapd_data *hapd); 14 | void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd); 15 | int hostapd_global_ctrl_iface_init(struct hapd_interfaces *interface); 16 | void hostapd_global_ctrl_iface_deinit(struct hapd_interfaces *interface); 17 | #else /* CONFIG_NO_CTRL_IFACE */ 18 | static inline int hostapd_ctrl_iface_init(struct hostapd_data *hapd) 19 | { 20 | return 0; 21 | } 22 | 23 | static inline void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd) 24 | { 25 | } 26 | 27 | static inline int 28 | hostapd_global_ctrl_iface_init(struct hapd_interfaces *interface) 29 | { 30 | return 0; 31 | } 32 | 33 | static inline void 34 | hostapd_global_ctrl_iface_deinit(struct hapd_interfaces *interface) 35 | { 36 | } 37 | #endif /* CONFIG_NO_CTRL_IFACE */ 38 | 39 | #endif /* CTRL_IFACE_H */ 40 | -------------------------------------------------------------------------------- /hostapd/eap_register.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EAP method registration 3 | * Copyright (c) 2004-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EAP_REGISTER_H 10 | #define EAP_REGISTER_H 11 | 12 | int eap_server_register_methods(void); 13 | 14 | #endif /* EAP_REGISTER_H */ 15 | -------------------------------------------------------------------------------- /hostapd/hapd_module_tests.c: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd module tests 3 | * Copyright (c) 2014, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "utils/includes.h" 10 | 11 | #include "utils/common.h" 12 | 13 | int hapd_module_tests(void) 14 | { 15 | wpa_printf(MSG_INFO, "hostapd module tests"); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /hostapd/hlr_auc_gw.milenage_db: -------------------------------------------------------------------------------- 1 | # Parameters for Milenage (Example algorithms for AKA). 2 | # The example Ki, OPc, and AMF values here are from 3GPP TS 35.208 v6.0.0 3 | # 4.3.20 Test Set 20. SQN is the last used SQN value. 4 | # These values can be used for both UMTS (EAP-AKA) and GSM (EAP-SIM) 5 | # authentication. In case of GSM/EAP-SIM, AMF and SQN values are not used, but 6 | # dummy values will need to be included in this file. 7 | 8 | # IMSI Ki OPc AMF SQN 9 | 232010000000000 90dca4eda45b53cf0f12d7c9c3bc6a89 cb9cccc4b9258e6dca4760379fb82581 61df 000000000000 10 | 11 | # These values are from Test Set 19 which has the AMF separation bit set to 1 12 | # and as such, is suitable for EAP-AKA' test. 13 | 555444333222111 5122250214c33e723a5dd523fc145fc0 981d464c7c52eb6e5036234984ad0bcf c3ab 16f3b3f70fc1 14 | -------------------------------------------------------------------------------- /hostapd/hostapd.accept: -------------------------------------------------------------------------------- 1 | # List of MAC addresses that are allowed to authenticate (IEEE 802.11) 2 | # with the AP. Optional VLAN ID can be assigned for clients based on the 3 | # MAC address if dynamic VLANs (hostapd.conf dynamic_vlan option) are used. 4 | 00:11:22:33:44:55 5 | 00:66:77:88:99:aa 6 | 00:00:22:33:44:55 1 7 | -------------------------------------------------------------------------------- /hostapd/hostapd.deny: -------------------------------------------------------------------------------- 1 | # List of MAC addresses that are not allowed to authenticate (IEEE 802.11) 2 | # with the AP. 3 | 00:20:30:40:50:60 4 | 00:ab:cd:ef:12:34 5 | 00:00:30:40:50:60 6 | -------------------------------------------------------------------------------- /hostapd/hostapd.eap_user_sqlite: -------------------------------------------------------------------------------- 1 | CREATE TABLE users( 2 | identity TEXT PRIMARY KEY, 3 | methods TEXT, 4 | password TEXT, 5 | remediation TEXT, 6 | phase2 INTEGER 7 | ); 8 | 9 | CREATE TABLE wildcards( 10 | identity TEXT PRIMARY KEY, 11 | methods TEXT 12 | ); 13 | 14 | INSERT INTO users(identity,methods,password,phase2) VALUES ('user','TTLS-MSCHAPV2','password',1); 15 | INSERT INTO users(identity,methods,password,phase2) VALUES ('DOMAIN\mschapv2 user','TTLS-MSCHAPV2','password',1); 16 | 17 | INSERT INTO wildcards(identity,methods) VALUES ('','TTLS,TLS'); 18 | INSERT INTO wildcards(identity,methods) VALUES ('0','AKA'); 19 | 20 | CREATE TABLE authlog( 21 | timestamp TEXT, 22 | session TEXT, 23 | nas_ip TEXT, 24 | username TEXT, 25 | note TEXT 26 | ); 27 | -------------------------------------------------------------------------------- /hostapd/hostapd.radius_clients: -------------------------------------------------------------------------------- 1 | # RADIUS client configuration for the RADIUS server 2 | 10.1.2.3 secret passphrase 3 | 192.168.1.0/24 another very secret passphrase 4 | 0.0.0.0/0 radius 5 | -------------------------------------------------------------------------------- /hostapd/hostapd.sim_db: -------------------------------------------------------------------------------- 1 | # Example GSM authentication triplet file for EAP-SIM authenticator 2 | # IMSI:Kc:SRES:RAND 3 | # IMSI: ASCII string (numbers) 4 | # Kc: hex, 8 octets 5 | # SRES: hex, 4 octets 6 | # RAND: hex, 16 octets 7 | 234567898765432:A0A1A2A3A4A5A6A7:D1D2D3D4:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 8 | 234567898765432:B0B1B2B3B4B5B6B7:E1E2E3E4:BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 9 | 234567898765432:C0C1C2C3C4C5C6C7:F1F2F3F4:CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 10 | -------------------------------------------------------------------------------- /hostapd/hostapd.vlan: -------------------------------------------------------------------------------- 1 | # VLAN ID to network interface mapping 2 | 1 vlan1 3 | 2 vlan2 4 | 3 vlan3 5 | 100 guest 6 | # Optional wildcard entry matching all VLAN IDs. The first # in the interface 7 | # name will be replaced with the VLAN ID. The network interfaces are created 8 | # (and removed) dynamically based on the use. 9 | * vlan# 10 | -------------------------------------------------------------------------------- /hostapd/hostapd.wpa_psk: -------------------------------------------------------------------------------- 1 | # List of WPA PSKs. Each line, except for empty lines and lines starting 2 | # with #, must contain a MAC address and PSK separated with a space. 3 | # Special MAC address 00:00:00:00:00:00 can be used to configure PSKs that 4 | # anyone can use. PSK can be configured as an ASCII passphrase of 8..63 5 | # characters or as a 256-bit hex PSK (64 hex digits). 6 | 00:00:00:00:00:00 secret passphrase 7 | 00:11:22:33:44:55 another passphrase 8 | 00:22:33:44:55:66 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef 9 | 00:00:00:00:00:00 another passphrase for all STAs 10 | -------------------------------------------------------------------------------- /hostapd/logwatch/README: -------------------------------------------------------------------------------- 1 | Logwatch is a utility for analyzing system logs and provide a human 2 | readable summary. This directory has a configuration file and a log 3 | analyzer script for parsing hostapd system log entries for logwatch. 4 | These files can be installed by copying them to following locations: 5 | 6 | /etc/log.d/conf/services/hostapd.conf 7 | /etc/log.d/scripts/services/hostapd 8 | 9 | More information about logwatch is available from http://www.logwatch.org/ 10 | -------------------------------------------------------------------------------- /hostapd/logwatch/hostapd.conf: -------------------------------------------------------------------------------- 1 | # Logwatch configuration for hostapd 2 | # 3 | # Copyright 2005 Henrik Brix Andersen 4 | # Distributed under the terms of the GNU General Public License v2 5 | # Alternatively, this file may be distributed under the terms of the BSD License 6 | 7 | Title = "hostapd" 8 | LogFile = messages 9 | *OnlyService = hostapd 10 | *RemoveHeaders 11 | -------------------------------------------------------------------------------- /hostapd/nt_password_hash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd - Plaintext password to NtPasswordHash 3 | * Copyright (c) 2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "crypto/ms_funcs.h" 13 | 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | unsigned char password_hash[16]; 18 | size_t i; 19 | char *password, buf[64], *pos; 20 | 21 | if (argc > 1) 22 | password = argv[1]; 23 | else { 24 | if (fgets(buf, sizeof(buf), stdin) == NULL) { 25 | printf("Failed to read password\n"); 26 | return 1; 27 | } 28 | buf[sizeof(buf) - 1] = '\0'; 29 | pos = buf; 30 | while (*pos != '\0') { 31 | if (*pos == '\r' || *pos == '\n') { 32 | *pos = '\0'; 33 | break; 34 | } 35 | pos++; 36 | } 37 | password = buf; 38 | } 39 | 40 | if (nt_password_hash((u8 *) password, strlen(password), password_hash)) 41 | return -1; 42 | for (i = 0; i < sizeof(password_hash); i++) 43 | printf("%02x", password_hash[i]); 44 | printf("\n"); 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /hostapd/wired.conf: -------------------------------------------------------------------------------- 1 | ##### hostapd configuration file ############################################## 2 | # Empty lines and lines starting with # are ignored 3 | 4 | # Example configuration file for wired authenticator. See hostapd.conf for 5 | # more details. 6 | 7 | interface=eth0 8 | driver=wired 9 | logger_stdout=-1 10 | logger_stdout_level=1 11 | debug=2 12 | dump_file=/tmp/hostapd.dump 13 | 14 | ieee8021x=1 15 | eap_reauth_period=3600 16 | 17 | use_pae_group_addr=1 18 | 19 | 20 | ##### RADIUS configuration #################################################### 21 | # for IEEE 802.1X with external Authentication Server, IEEE 802.11 22 | # authentication with external ACL for MAC addresses, and accounting 23 | 24 | # The own IP address of the access point (used as NAS-IP-Address) 25 | own_ip_addr=127.0.0.1 26 | 27 | # Optional NAS-Identifier string for RADIUS messages. When used, this should be 28 | # a unique to the NAS within the scope of the RADIUS server. For example, a 29 | # fully qualified domain name can be used here. 30 | nas_identifier=ap.example.com 31 | 32 | # RADIUS authentication server 33 | auth_server_addr=127.0.0.1 34 | auth_server_port=1812 35 | auth_server_shared_secret=radius 36 | 37 | # RADIUS accounting server 38 | acct_server_addr=127.0.0.1 39 | acct_server_port=1813 40 | acct_server_shared_secret=radius 41 | -------------------------------------------------------------------------------- /hs20/client/devdetail.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 13 8 | 9 | 10 | 21 11 | MS-CHAP-V2 12 | 13 | 14 | 18 15 | 16 | 17 | 23 18 | 19 | 20 | 50 21 | 22 | 23 | false 24 | 020102030405 25 | 310026000000000 26 | imei:490123456789012 27 | http://localhost:12345/ 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 0 38 | 0 39 | 0 40 | 41 | MobilePhone 42 | Manufacturer 43 | 1.0 44 | 1.0 45 | 1.0 46 | false 47 | 48 | -------------------------------------------------------------------------------- /hs20/client/devinfo.xml: -------------------------------------------------------------------------------- 1 | 2 | urn:Example:HS20-station:123456 3 | Manufacturer 4 | HS20-station 5 | 1.2 6 | en 7 | 8 | -------------------------------------------------------------------------------- /hs20/server/Makefile: -------------------------------------------------------------------------------- 1 | all: hs20_spp_server 2 | 3 | ifndef CC 4 | CC=gcc 5 | endif 6 | 7 | ifndef LDO 8 | LDO=$(CC) 9 | endif 10 | 11 | ifndef CFLAGS 12 | CFLAGS = -MMD -O2 -Wall -g 13 | endif 14 | 15 | CFLAGS += -I../../src/utils 16 | CFLAGS += -I../../src/crypto 17 | 18 | LIBS += -lsqlite3 19 | 20 | # Using glibc < 2.17 requires -lrt for clock_gettime() 21 | LIBS += -lrt 22 | 23 | OBJS=spp_server.o 24 | OBJS += hs20_spp_server.o 25 | OBJS += ../../src/utils/xml-utils.o 26 | OBJS += ../../src/utils/base64.o 27 | OBJS += ../../src/utils/common.o 28 | OBJS += ../../src/utils/os_unix.o 29 | OBJS += ../../src/utils/wpa_debug.o 30 | OBJS += ../../src/crypto/md5-internal.o 31 | CFLAGS += $(shell xml2-config --cflags) 32 | LIBS += $(shell xml2-config --libs) 33 | OBJS += ../../src/utils/xml_libxml2.o 34 | 35 | hs20_spp_server: $(OBJS) 36 | $(LDO) $(LDFLAGS) -o hs20_spp_server $(OBJS) $(LIBS) 37 | 38 | clean: 39 | rm -f core *~ *.o *.d hs20_spp_server 40 | rm -f ../../src/utils/*.o 41 | rm -f ../../src/utils/*.d 42 | rm -f ../../src/crypto/*.o 43 | rm -f ../../src/crypto/*.d 44 | 45 | -include $(OBJS:%.o=%.d) 46 | -------------------------------------------------------------------------------- /hs20/server/ca/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in server-client server server-revoked user ocsp; do 4 | rm -f $i.csr $i.key $i.pem 5 | done 6 | 7 | rm -f openssl.cnf.tmp 8 | rm -r demoCA 9 | rm -f ca.pem logo.asn1 logo.der server.der ocsp-server-cache.der 10 | #rm -r rootCA 11 | -------------------------------------------------------------------------------- /hs20/server/ca/est-csrattrs.cnf: -------------------------------------------------------------------------------- 1 | asn1 = SEQUENCE:attrs 2 | 3 | [attrs] 4 | #oid1 = OID:challengePassword 5 | attr1 = SEQUENCE:extreq 6 | oid2 = OID:sha256WithRSAEncryption 7 | 8 | [extreq] 9 | oid = OID:extensionRequest 10 | vals = SET:extreqvals 11 | 12 | [extreqvals] 13 | 14 | oid1 = OID:macAddress 15 | #oid2 = OID:imei 16 | #oid3 = OID:meid 17 | #oid4 = OID:DevId 18 | -------------------------------------------------------------------------------- /hs20/server/ca/est-csrattrs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | openssl asn1parse -genconf est-csrattrs.cnf -out est-csrattrs.der -oid hs20.oid 4 | base64 est-csrattrs.der > est-attrs.b64 5 | -------------------------------------------------------------------------------- /hs20/server/ca/hs20.oid: -------------------------------------------------------------------------------- 1 | 1.3.6.1.1.1.1.22 macAddress 2 | 1.2.840.113549.1.9.14 extensionRequest 3 | 1.3.6.1.4.1.40808.1.1.1 id-wfa-hotspot-friendlyName 4 | 1.3.6.1.4.1.40808.1.1.2 id-kp-HS2.0Auth 5 | 1.3.6.1.4.1.40808.1.1.3 imei 6 | 1.3.6.1.4.1.40808.1.1.4 meid 7 | 1.3.6.1.4.1.40808.1.1.5 DevId 8 | -------------------------------------------------------------------------------- /hs20/server/ca/ocsp-req.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in *.pem; do 4 | echo "===[ $i ]===================" 5 | openssl ocsp -text -CAfile ca.pem -verify_other demoCA/cacert.pem -trust_other -issuer demoCA/cacert.pem -cert $i -url http://localhost:8888/ 6 | 7 | # openssl ocsp -text -CAfile rootCA/cacert.pem -issuer demoCA/cacert.pem -cert $i -url http://localhost:8888/ 8 | 9 | # openssl ocsp -text -CAfile rootCA/cacert.pem -verify_other demoCA/cacert.pem -trust_other -issuer demoCA/cacert.pem -cert $i -url http://localhost:8888/ 10 | # openssl ocsp -text -CAfile rootCA/cacert.pem -VAfile ca.pem -trust_other -issuer demoCA/cacert.pem -cert $i -url http://localhost:8888/ 11 | done 12 | -------------------------------------------------------------------------------- /hs20/server/ca/ocsp-responder-ica.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | openssl ocsp -index demoCA/index.txt -port 8888 -nmin 5 -rsigner demoCA/cacert.pem -rkey demoCA/private/cakey-plain.pem -CA demoCA/cacert.pem -resp_no_certs -text 4 | -------------------------------------------------------------------------------- /hs20/server/ca/ocsp-responder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | openssl ocsp -index demoCA/index.txt -port 8888 -nmin 5 -rsigner ocsp.pem -rkey ocsp.key -CA demoCA/cacert.pem -text 4 | -------------------------------------------------------------------------------- /hs20/server/ca/ocsp-update-cache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | openssl ocsp \ 4 | -no_nonce \ 5 | -CAfile ca.pem \ 6 | -verify_other demoCA/cacert.pem \ 7 | -issuer demoCA/cacert.pem \ 8 | -cert server.pem \ 9 | -url http://localhost:8888/ \ 10 | -respout ocsp-server-cache.der 11 | -------------------------------------------------------------------------------- /hs20/server/ca/w1fi_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/hs20/server/ca/w1fi_logo.png -------------------------------------------------------------------------------- /hs20/server/spp_server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hotspot 2.0 SPP server 3 | * Copyright (c) 2012-2013, Qualcomm Atheros, Inc. 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef SPP_SERVER_H 10 | #define SPP_SERVER_H 11 | 12 | struct hs20_svc { 13 | const void *ctx; 14 | struct xml_node_ctx *xml; 15 | char *root_dir; 16 | FILE *debug_log; 17 | sqlite3 *db; 18 | const char *addr; 19 | }; 20 | 21 | 22 | void debug_print(struct hs20_svc *ctx, int print, const char *fmt, ...) 23 | __attribute__ ((format (printf, 3, 4))); 24 | void debug_dump_node(struct hs20_svc *ctx, const char *title, xml_node_t *node); 25 | 26 | xml_node_t * hs20_spp_server_process(struct hs20_svc *ctx, xml_node_t *node, 27 | const char *auth_user, 28 | const char *auth_realm, int dmacc); 29 | int hs20_spp_server_init(struct hs20_svc *ctx); 30 | void hs20_spp_server_deinit(struct hs20_svc *ctx); 31 | 32 | #endif /* SPP_SERVER_H */ 33 | -------------------------------------------------------------------------------- /hs20/server/sql.txt: -------------------------------------------------------------------------------- 1 | CREATE TABLE eventlog( 2 | user TEXT, 3 | realm TEXT, 4 | sessionid TEXT COLLATE NOCASE, 5 | timestamp TEXT, 6 | notes TEXT, 7 | dump TEXT, 8 | addr TEXT 9 | ); 10 | 11 | CREATE TABLE sessions( 12 | timestamp TEXT, 13 | id TEXT COLLATE NOCASE, 14 | user TEXT, 15 | realm TEXT, 16 | password TEXT, 17 | machine_managed BOOLEAN, 18 | operation INTEGER, 19 | type TEXT, 20 | pps TEXT, 21 | redirect_uri TEXT, 22 | devinfo TEXT, 23 | devdetail TEXT, 24 | cert TEXT, 25 | cert_pem TEXT 26 | ); 27 | 28 | CREATE index sessions_id_index ON sessions(id); 29 | 30 | CREATE TABLE osu_config( 31 | realm TEXT, 32 | field TEXT, 33 | value TEXT 34 | ); 35 | 36 | CREATE TABLE users( 37 | identity TEXT PRIMARY KEY, 38 | methods TEXT, 39 | password TEXT, 40 | machine_managed BOOLEAN, 41 | remediation TEXT, 42 | phase2 INTEGER, 43 | realm TEXT, 44 | policy TEXT, 45 | devinfo TEXT, 46 | devdetail TEXT, 47 | pps TEXT, 48 | fetch_pps INTEGER, 49 | osu_user TEXT, 50 | osu_password TEXT, 51 | shared INTEGER, 52 | cert TEXT, 53 | cert_pem TEXT 54 | ); 55 | 56 | CREATE TABLE wildcards( 57 | identity TEXT PRIMARY KEY, 58 | methods TEXT 59 | ); 60 | -------------------------------------------------------------------------------- /hs20/server/www/add-free.php: -------------------------------------------------------------------------------- 1 | query("SELECT rowid,* FROM sessions WHERE id='$id'")->fetch(); 18 | if ($row == false) { 19 | die("Session not found"); 20 | } 21 | 22 | $uri = $row['redirect_uri']; 23 | $rowid = $row['rowid']; 24 | $realm = $row['realm']; 25 | 26 | $row = $db->query("SELECT value FROM osu_config WHERE realm='$realm' AND field='free_account'")->fetch(); 27 | if (!$row || strlen($row['value']) == 0) { 28 | die("Free account disabled"); 29 | } 30 | 31 | $user = $row['value']; 32 | 33 | $row = $db->query("SELECT password FROM users WHERE identity='$user' AND realm='$realm'")->fetch(); 34 | if (!$row) 35 | die("Free account not found"); 36 | 37 | $pw = $row['password']; 38 | 39 | if (!$db->exec("UPDATE sessions SET user='$user', password='$pw', realm='$realm', machine_managed='1' WHERE rowid=$rowid")) { 40 | die("Failed to update session database"); 41 | } 42 | 43 | $db->exec("INSERT INTO eventlog(user,realm,sessionid,timestamp,notes) " . 44 | "VALUES ('$user', '$realm', '$id', " . 45 | "strftime('%Y-%m-%d %H:%M:%f','now'), " . 46 | "'completed user input response for a new PPS MO')"); 47 | 48 | header("Location: $uri", true, 302); 49 | 50 | ?> 51 | -------------------------------------------------------------------------------- /hs20/server/www/cert-enroll.php: -------------------------------------------------------------------------------- 1 | query("SELECT rowid,* FROM sessions WHERE id='$id'")->fetch(); 18 | if ($row == false) { 19 | die("Session not found"); 20 | } 21 | 22 | $uri = $row['redirect_uri']; 23 | $rowid = $row['rowid']; 24 | $realm = $row['realm']; 25 | 26 | $user = sha1(mt_rand()); 27 | 28 | if (!$db->exec("UPDATE sessions SET user='$user', type='cert' WHERE rowid=$rowid")) { 29 | die("Failed to update session database"); 30 | } 31 | 32 | $db->exec("INSERT INTO eventlog(user,realm,sessionid,timestamp,notes) " . 33 | "VALUES ('', '$realm', '$id', " . 34 | "strftime('%Y-%m-%d %H:%M:%f','now'), " . 35 | "'completed user input response for client certificate enrollment')"); 36 | 37 | header("Location: $uri", true, 302); 38 | 39 | ?> 40 | -------------------------------------------------------------------------------- /hs20/server/www/config.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /hs20/server/www/free-remediation.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hotspot 2.0 - public and free hotspot - remediation 4 | 5 | 6 | 7 |

Hotspot 2.0 - public and free hotspot

8 | 9 |

Terms and conditions have changed. You need to accept the new terms 10 | to continue using this network.

11 | 12 |

Terms and conditions..

13 | 14 | Accept
\n"; 16 | ?> 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /hs20/server/www/free.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hotspot 2.0 - public and free hotspot 4 | 5 | 6 | 7 | Hotspot 2.0 - public and free hotspot\n"; 12 | 13 | echo "
\n"; 14 | echo "\n"; 15 | 16 | ?> 17 | 18 |

Terms and conditions..

19 | 20 |
21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /hs20/server/www/redirect.php: -------------------------------------------------------------------------------- 1 | query("SELECT rowid,* FROM sessions WHERE id='$id'")->fetch(); 16 | if ($row == false) { 17 | die("Session not found"); 18 | } 19 | 20 | $uri = $row['redirect_uri']; 21 | 22 | header("Location: $uri", true, 302); 23 | 24 | $user = $row['user']; 25 | $realm = $row['realm']; 26 | 27 | $db->exec("INSERT INTO eventlog(user,realm,sessionid,timestamp,notes) " . 28 | "VALUES ('$user', '$realm', '$id', " . 29 | "strftime('%Y-%m-%d %H:%M:%f','now'), " . 30 | "'redirected after user input')"); 31 | 32 | ?> 33 | -------------------------------------------------------------------------------- /hs20/server/www/remediation.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hotspot 2.0 subscription remediation 4 | 5 | 6 | 7 | \n"; 10 | 11 | echo "Complete user subscription remediation
\n"; 12 | 13 | ?> 14 | 15 | This will provide a new machine-generated password. 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /hs20/server/www/signup.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hotspot 2.0 signup 4 | 5 | 6 | 7 | query("SELECT realm FROM sessions WHERE id='$id'")->fetch(); 19 | if ($row == false) { 20 | die("Session not found"); 21 | } 22 | $realm = $row['realm']; 23 | 24 | echo "

Sign up for a subscription - $realm

\n"; 25 | 26 | $row = $db->query("SELECT value FROM osu_config WHERE realm='$realm' AND field='free_account'")->fetch(); 27 | if ($row && strlen($row['value']) > 0) { 28 | echo "

Sign up for free access

\n"; 29 | } 30 | 31 | echo "
\n"; 32 | echo "\n"; 33 | ?> 34 | Select a username and password. Leave password empty to get automatically 35 | generated and machine managed password.
36 | Username:
37 | Password:
38 | 39 |
40 | 41 | Enroll a client certificate

\n" 43 | ?> 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /mac80211_hwsim/tests/0001-wpa2-psk/hostapd.conf: -------------------------------------------------------------------------------- 1 | interface=wlan0 2 | driver=nl80211 3 | 4 | hw_mode=g 5 | channel=1 6 | ssid=mac80211 test 7 | 8 | wpa=2 9 | wpa_key_mgmt=WPA-PSK 10 | wpa_pairwise=CCMP 11 | wpa_passphrase=12345678 12 | -------------------------------------------------------------------------------- /mac80211_hwsim/tests/0001-wpa2-psk/test.txt: -------------------------------------------------------------------------------- 1 | # WPA2-Personal (PSK) with CCMP, AP and single client 2 | 3 | modprobe mac80211_hwsim 4 | 5 | hostapd hostapd.conf 6 | 7 | wpa_supplicant -Dwext -iwlan1 -c wpa_supplicant.conf 8 | -------------------------------------------------------------------------------- /mac80211_hwsim/tests/0001-wpa2-psk/wpa_supplicant.conf: -------------------------------------------------------------------------------- 1 | ctrl_interface=/var/run/wpa_supplicant 2 | 3 | network={ 4 | ssid="mac80211 test" 5 | psk="12345678" 6 | key_mgmt=WPA-PSK 7 | proto=WPA2 8 | pairwise=CCMP 9 | group=CCMP 10 | } 11 | -------------------------------------------------------------------------------- /mac80211_hwsim/tests/0002-vlan/hostapd.accept: -------------------------------------------------------------------------------- 1 | 02:00:00:00:01:00 1 2 | 02:00:00:00:02:00 2 3 | -------------------------------------------------------------------------------- /mac80211_hwsim/tests/0002-vlan/hostapd.conf: -------------------------------------------------------------------------------- 1 | interface=wlan0 2 | driver=nl80211 3 | 4 | hw_mode=g 5 | channel=1 6 | ssid=mac80211 test 7 | 8 | dynamic_vlan=2 9 | vlan_file=hostapd.vlan 10 | 11 | macaddr_acl=0 12 | accept_mac_file=hostapd.accept 13 | -------------------------------------------------------------------------------- /mac80211_hwsim/tests/0002-vlan/hostapd.vlan: -------------------------------------------------------------------------------- 1 | * vlan# 2 | -------------------------------------------------------------------------------- /mac80211_hwsim/tests/0002-vlan/test.txt: -------------------------------------------------------------------------------- 1 | # Plaintext connection, two clients, different VLANs 2 | 3 | modprobe mac80211_hwsim radios=3 4 | 5 | hostapd hostapd.conf 6 | 7 | ifconfig wlan1 up 8 | iwconfig wlan1 essid "mac80211 test" 9 | 10 | ifconfig wlan2 up 11 | iwconfig wlan2 essid "mac80211 test" 12 | 13 | # Expected results: 14 | # STA1(wlan1) is bound to vlan1 15 | # STA2(wlan2) is bound to vlan2 16 | -------------------------------------------------------------------------------- /mac80211_hwsim/tools/Makefile: -------------------------------------------------------------------------------- 1 | all: hwsim_test 2 | 3 | ifndef CC 4 | CC=gcc 5 | endif 6 | 7 | ifndef CFLAGS 8 | CFLAGS = -O2 -Wall -g 9 | endif 10 | 11 | hwsim_test: hwsim_test.o 12 | 13 | clean: 14 | rm -rf *.o 15 | rm -rf hwsim_test 16 | -------------------------------------------------------------------------------- /radius_example/.gitignore: -------------------------------------------------------------------------------- 1 | *.d 2 | radius_example 3 | -------------------------------------------------------------------------------- /radius_example/Makefile: -------------------------------------------------------------------------------- 1 | ALL=radius_example 2 | 3 | all: $(ALL) 4 | 5 | ifndef CC 6 | CC=gcc 7 | endif 8 | 9 | ifndef LDO 10 | LDO=$(CC) 11 | endif 12 | 13 | ifndef CFLAGS 14 | CFLAGS = -MMD -O2 -Wall -g 15 | endif 16 | 17 | CFLAGS += -I. 18 | CFLAGS += -I../src 19 | CFLAGS += -I../src/utils 20 | 21 | LIBS = ../src/radius/libradius.a 22 | LIBS += ../src/crypto/libcrypto.a 23 | LIBS += ../src/utils/libutils.a 24 | LLIBS = -lrt 25 | 26 | ../src/utils/libutils.a: 27 | $(MAKE) -C ../src/utils 28 | 29 | ../src/crypto/libcrypto.a: 30 | $(MAKE) -C ../src/crypto 31 | 32 | ../src/radius/libradius.a: 33 | $(MAKE) -C ../src/radius 34 | 35 | #CLAGS += -DCONFIG_IPV6 36 | 37 | OBJS_ex = radius_example.o 38 | 39 | radius_example: $(OBJS_ex) $(LIBS) 40 | $(LDO) $(LDFLAGS) -o radius_example $(OBJS_ex) $(LIBS) $(LLIBS) 41 | 42 | clean: 43 | $(MAKE) -C ../src clean 44 | rm -f core *~ *.o *.d $(ALL) 45 | 46 | -include $(OBJS:%.o=%.d) 47 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | SUBDIRS=ap common crypto drivers eapol_auth eapol_supp eap_common eap_peer eap_server l2_packet p2p pae radius rsn_supp tls utils wps 2 | 3 | all: 4 | for d in $(SUBDIRS); do [ -d $$d ] && $(MAKE) -C $$d; done 5 | 6 | clean: 7 | for d in $(SUBDIRS); do [ -d $$d ] && $(MAKE) -C $$d clean; done 8 | rm -f *~ 9 | 10 | install: 11 | for d in $(SUBDIRS); do [ -d $$d ] && $(MAKE) -C $$d install; done 12 | -------------------------------------------------------------------------------- /src/ap/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/ap/accounting.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / RADIUS Accounting 3 | * Copyright (c) 2002-2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef ACCOUNTING_H 10 | #define ACCOUNTING_H 11 | 12 | #ifdef CONFIG_NO_ACCOUNTING 13 | static inline void accounting_sta_get_id(struct hostapd_data *hapd, 14 | struct sta_info *sta) 15 | { 16 | } 17 | 18 | static inline void accounting_sta_start(struct hostapd_data *hapd, 19 | struct sta_info *sta) 20 | { 21 | } 22 | 23 | static inline void accounting_sta_stop(struct hostapd_data *hapd, 24 | struct sta_info *sta) 25 | { 26 | } 27 | 28 | static inline int accounting_init(struct hostapd_data *hapd) 29 | { 30 | return 0; 31 | } 32 | 33 | static inline void accounting_deinit(struct hostapd_data *hapd) 34 | { 35 | } 36 | #else /* CONFIG_NO_ACCOUNTING */ 37 | void accounting_sta_get_id(struct hostapd_data *hapd, struct sta_info *sta); 38 | void accounting_sta_start(struct hostapd_data *hapd, struct sta_info *sta); 39 | void accounting_sta_stop(struct hostapd_data *hapd, struct sta_info *sta); 40 | int accounting_init(struct hostapd_data *hapd); 41 | void accounting_deinit(struct hostapd_data *hapd); 42 | #endif /* CONFIG_NO_ACCOUNTING */ 43 | 44 | #endif /* ACCOUNTING_H */ 45 | -------------------------------------------------------------------------------- /src/ap/acs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ACS - Automatic Channel Selection module 3 | * Copyright (c) 2011, Atheros Communications 4 | * Copyright (c) 2013, Qualcomm Atheros, Inc. 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #ifndef ACS_H 11 | #define ACS_H 12 | 13 | #ifdef CONFIG_ACS 14 | 15 | enum hostapd_chan_status acs_init(struct hostapd_iface *iface); 16 | 17 | #else /* CONFIG_ACS */ 18 | 19 | static inline enum hostapd_chan_status acs_init(struct hostapd_iface *iface) 20 | { 21 | wpa_printf(MSG_ERROR, "ACS was disabled on your build, rebuild hostapd with CONFIG_ACS=y or set channel"); 22 | return HOSTAPD_CHAN_INVALID; 23 | } 24 | 25 | #endif /* CONFIG_ACS */ 26 | 27 | #endif /* ACS_H */ 28 | -------------------------------------------------------------------------------- /src/ap/ap_mlme.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / IEEE 802.11 MLME 3 | * Copyright 2003, Jouni Malinen 4 | * Copyright 2003-2004, Instant802 Networks, Inc. 5 | * Copyright 2005-2006, Devicescape Software, Inc. 6 | * 7 | * This software may be distributed under the terms of the BSD license. 8 | * See README for more details. 9 | */ 10 | 11 | #ifndef MLME_H 12 | #define MLME_H 13 | 14 | void mlme_authenticate_indication(struct hostapd_data *hapd, 15 | struct sta_info *sta); 16 | 17 | void mlme_deauthenticate_indication(struct hostapd_data *hapd, 18 | struct sta_info *sta, u16 reason_code); 19 | 20 | void mlme_associate_indication(struct hostapd_data *hapd, 21 | struct sta_info *sta); 22 | 23 | void mlme_reassociate_indication(struct hostapd_data *hapd, 24 | struct sta_info *sta); 25 | 26 | void mlme_disassociate_indication(struct hostapd_data *hapd, 27 | struct sta_info *sta, u16 reason_code); 28 | 29 | void mlme_michaelmicfailure_indication(struct hostapd_data *hapd, 30 | const u8 *addr); 31 | 32 | void mlme_deletekeys_request(struct hostapd_data *hapd, struct sta_info *sta); 33 | 34 | #endif /* MLME_H */ 35 | -------------------------------------------------------------------------------- /src/ap/authsrv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Authentication server setup 3 | * Copyright (c) 2002-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef AUTHSRV_H 10 | #define AUTHSRV_H 11 | 12 | int authsrv_init(struct hostapd_data *hapd); 13 | void authsrv_deinit(struct hostapd_data *hapd); 14 | 15 | #endif /* AUTHSRV_H */ 16 | -------------------------------------------------------------------------------- /src/ap/beacon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / IEEE 802.11 Management: Beacon and Probe Request/Response 3 | * Copyright (c) 2002-2004, Instant802 Networks, Inc. 4 | * Copyright (c) 2005-2006, Devicescape Software, Inc. 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #ifndef BEACON_H 11 | #define BEACON_H 12 | 13 | struct ieee80211_mgmt; 14 | 15 | void handle_probe_req(struct hostapd_data *hapd, 16 | const struct ieee80211_mgmt *mgmt, size_t len, 17 | int ssi_signal); 18 | int ieee802_11_set_beacon(struct hostapd_data *hapd); 19 | int ieee802_11_set_beacons(struct hostapd_iface *iface); 20 | int ieee802_11_update_beacons(struct hostapd_iface *iface); 21 | int ieee802_11_build_ap_params(struct hostapd_data *hapd, 22 | struct wpa_driver_ap_params *params); 23 | void ieee802_11_free_ap_params(struct wpa_driver_ap_params *params); 24 | 25 | #endif /* BEACON_H */ 26 | -------------------------------------------------------------------------------- /src/ap/ctrl_iface_ap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Control interface for shared AP commands 3 | * Copyright (c) 2004-2013, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef CTRL_IFACE_AP_H 10 | #define CTRL_IFACE_AP_H 11 | 12 | int hostapd_ctrl_iface_sta_first(struct hostapd_data *hapd, 13 | char *buf, size_t buflen); 14 | int hostapd_ctrl_iface_sta(struct hostapd_data *hapd, const char *txtaddr, 15 | char *buf, size_t buflen); 16 | int hostapd_ctrl_iface_sta_next(struct hostapd_data *hapd, const char *txtaddr, 17 | char *buf, size_t buflen); 18 | int hostapd_ctrl_iface_deauthenticate(struct hostapd_data *hapd, 19 | const char *txtaddr); 20 | int hostapd_ctrl_iface_disassociate(struct hostapd_data *hapd, 21 | const char *txtaddr); 22 | int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf, 23 | size_t buflen); 24 | int hostapd_parse_csa_settings(const char *pos, 25 | struct csa_settings *settings); 26 | 27 | 28 | #endif /* CTRL_IFACE_AP_H */ 29 | -------------------------------------------------------------------------------- /src/ap/dfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DFS - Dynamic Frequency Selection 3 | * Copyright (c) 2002-2013, Jouni Malinen 4 | * Copyright (c) 2013, Qualcomm Atheros, Inc. 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | #ifndef DFS_H 10 | #define DFS_H 11 | 12 | int hostapd_handle_dfs(struct hostapd_iface *iface); 13 | 14 | int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq, 15 | int ht_enabled, int chan_offset, int chan_width, 16 | int cf1, int cf2); 17 | int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq, 18 | int ht_enabled, 19 | int chan_offset, int chan_width, 20 | int cf1, int cf2); 21 | int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq, 22 | int ht_enabled, 23 | int chan_offset, int chan_width, int cf1, int cf2); 24 | int hostapd_is_dfs_required(struct hostapd_iface *iface); 25 | 26 | #endif /* DFS_H */ 27 | -------------------------------------------------------------------------------- /src/ap/hs20.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hotspot 2.0 AP ANQP processing 3 | * Copyright (c) 2011-2013, Qualcomm Atheros, Inc. 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef HS20_H 10 | #define HS20_H 11 | 12 | struct hostapd_data; 13 | 14 | u8 * hostapd_eid_hs20_indication(struct hostapd_data *hapd, u8 *eid); 15 | u8 * hostapd_eid_osen(struct hostapd_data *hapd, u8 *eid); 16 | int hs20_send_wnm_notification(struct hostapd_data *hapd, const u8 *addr, 17 | u8 osu_method, const char *url); 18 | int hs20_send_wnm_notification_deauth_req(struct hostapd_data *hapd, 19 | const u8 *addr, 20 | const struct wpabuf *payload); 21 | 22 | #endif /* HS20_H */ 23 | -------------------------------------------------------------------------------- /src/ap/iapp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / IEEE 802.11F-2003 Inter-Access Point Protocol (IAPP) 3 | * Copyright (c) 2002-2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef IAPP_H 10 | #define IAPP_H 11 | 12 | struct iapp_data; 13 | 14 | #ifdef CONFIG_IAPP 15 | 16 | void iapp_new_station(struct iapp_data *iapp, struct sta_info *sta); 17 | struct iapp_data * iapp_init(struct hostapd_data *hapd, const char *iface); 18 | void iapp_deinit(struct iapp_data *iapp); 19 | 20 | #else /* CONFIG_IAPP */ 21 | 22 | static inline void iapp_new_station(struct iapp_data *iapp, 23 | struct sta_info *sta) 24 | { 25 | } 26 | 27 | static inline struct iapp_data * iapp_init(struct hostapd_data *hapd, 28 | const char *iface) 29 | { 30 | return NULL; 31 | } 32 | 33 | static inline void iapp_deinit(struct iapp_data *iapp) 34 | { 35 | } 36 | 37 | #endif /* CONFIG_IAPP */ 38 | 39 | #endif /* IAPP_H */ 40 | -------------------------------------------------------------------------------- /src/ap/ieee802_11_auth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / IEEE 802.11 authentication (ACL) 3 | * Copyright (c) 2003-2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef IEEE802_11_AUTH_H 10 | #define IEEE802_11_AUTH_H 11 | 12 | enum { 13 | HOSTAPD_ACL_REJECT = 0, 14 | HOSTAPD_ACL_ACCEPT = 1, 15 | HOSTAPD_ACL_PENDING = 2, 16 | HOSTAPD_ACL_ACCEPT_TIMEOUT = 3 17 | }; 18 | 19 | int hostapd_allowed_address(struct hostapd_data *hapd, const u8 *addr, 20 | const u8 *msg, size_t len, u32 *session_timeout, 21 | u32 *acct_interim_interval, int *vlan_id, 22 | struct hostapd_sta_wpa_psk_short **psk, 23 | char **identity, char **radius_cui); 24 | int hostapd_acl_init(struct hostapd_data *hapd); 25 | void hostapd_acl_deinit(struct hostapd_data *hapd); 26 | void hostapd_free_psk_list(struct hostapd_sta_wpa_psk_short *psk); 27 | 28 | #endif /* IEEE802_11_AUTH_H */ 29 | -------------------------------------------------------------------------------- /src/ap/p2p_hostapd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / P2P integration 3 | * Copyright (c) 2009-2010, Atheros Communications 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef P2P_HOSTAPD_H 10 | #define P2P_HOSTAPD_H 11 | 12 | #ifdef CONFIG_P2P 13 | 14 | int hostapd_p2p_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, 15 | char *buf, size_t buflen); 16 | int hostapd_p2p_set_noa(struct hostapd_data *hapd, u8 count, int start, 17 | int duration); 18 | void hostapd_p2p_non_p2p_sta_connected(struct hostapd_data *hapd); 19 | void hostapd_p2p_non_p2p_sta_disconnected(struct hostapd_data *hapd); 20 | 21 | 22 | #else /* CONFIG_P2P */ 23 | 24 | static inline int hostapd_p2p_get_mib_sta(struct hostapd_data *hapd, 25 | struct sta_info *sta, 26 | char *buf, size_t buflen) 27 | { 28 | return 0; 29 | } 30 | 31 | #endif /* CONFIG_P2P */ 32 | 33 | u8 * hostapd_eid_p2p_manage(struct hostapd_data *hapd, u8 *eid); 34 | 35 | #endif /* P2P_HOSTAPD_H */ 36 | -------------------------------------------------------------------------------- /src/ap/preauth_auth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd - Authenticator for IEEE 802.11i RSN pre-authentication 3 | * Copyright (c) 2004-2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef PREAUTH_H 10 | #define PREAUTH_H 11 | 12 | #ifdef CONFIG_RSN_PREAUTH 13 | 14 | int rsn_preauth_iface_init(struct hostapd_data *hapd); 15 | void rsn_preauth_iface_deinit(struct hostapd_data *hapd); 16 | void rsn_preauth_finished(struct hostapd_data *hapd, struct sta_info *sta, 17 | int success); 18 | void rsn_preauth_send(struct hostapd_data *hapd, struct sta_info *sta, 19 | u8 *buf, size_t len); 20 | void rsn_preauth_free_station(struct hostapd_data *hapd, struct sta_info *sta); 21 | 22 | #else /* CONFIG_RSN_PREAUTH */ 23 | 24 | static inline int rsn_preauth_iface_init(struct hostapd_data *hapd) 25 | { 26 | return 0; 27 | } 28 | 29 | static inline void rsn_preauth_iface_deinit(struct hostapd_data *hapd) 30 | { 31 | } 32 | 33 | static inline void rsn_preauth_finished(struct hostapd_data *hapd, 34 | struct sta_info *sta, 35 | int success) 36 | { 37 | } 38 | 39 | static inline void rsn_preauth_send(struct hostapd_data *hapd, 40 | struct sta_info *sta, 41 | u8 *buf, size_t len) 42 | { 43 | } 44 | 45 | static inline void rsn_preauth_free_station(struct hostapd_data *hapd, 46 | struct sta_info *sta) 47 | { 48 | } 49 | 50 | #endif /* CONFIG_RSN_PREAUTH */ 51 | 52 | #endif /* PREAUTH_H */ 53 | -------------------------------------------------------------------------------- /src/ap/tkip_countermeasures.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / TKIP countermeasures 3 | * Copyright (c) 2002-2012, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef TKIP_COUNTERMEASURES_H 10 | #define TKIP_COUNTERMEASURES_H 11 | 12 | int michael_mic_failure(struct hostapd_data *hapd, const u8 *addr, int local); 13 | void ieee80211_tkip_countermeasures_deinit(struct hostapd_data *hapd); 14 | 15 | #endif /* TKIP_COUNTERMEASURES_H */ 16 | -------------------------------------------------------------------------------- /src/ap/vlan_init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / VLAN initialization 3 | * Copyright 2003, Instant802 Networks, Inc. 4 | * Copyright 2005, Devicescape Software, Inc. 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #ifndef VLAN_INIT_H 11 | #define VLAN_INIT_H 12 | 13 | #ifndef CONFIG_NO_VLAN 14 | int vlan_init(struct hostapd_data *hapd); 15 | void vlan_deinit(struct hostapd_data *hapd); 16 | struct hostapd_vlan * vlan_add_dynamic(struct hostapd_data *hapd, 17 | struct hostapd_vlan *vlan, 18 | int vlan_id); 19 | int vlan_remove_dynamic(struct hostapd_data *hapd, int vlan_id); 20 | int vlan_setup_encryption_dyn(struct hostapd_data *hapd, 21 | struct hostapd_ssid *mssid, 22 | const char *dyn_vlan); 23 | #else /* CONFIG_NO_VLAN */ 24 | static inline int vlan_init(struct hostapd_data *hapd) 25 | { 26 | return 0; 27 | } 28 | 29 | static inline void vlan_deinit(struct hostapd_data *hapd) 30 | { 31 | } 32 | 33 | static inline struct hostapd_vlan * vlan_add_dynamic(struct hostapd_data *hapd, 34 | struct hostapd_vlan *vlan, 35 | int vlan_id) 36 | { 37 | return NULL; 38 | } 39 | 40 | static inline int vlan_remove_dynamic(struct hostapd_data *hapd, int vlan_id) 41 | { 42 | return -1; 43 | } 44 | 45 | static inline int vlan_setup_encryption_dyn(struct hostapd_data *hapd, 46 | struct hostapd_ssid *mssid, 47 | const char *dyn_vlan) 48 | { 49 | return -1; 50 | } 51 | #endif /* CONFIG_NO_VLAN */ 52 | 53 | #endif /* VLAN_INIT_H */ 54 | -------------------------------------------------------------------------------- /src/ap/vlan_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / VLAN netlink api 3 | * Copyright (c) 2012, Michael Braun 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef VLAN_UTIL_H 10 | #define VLAN_UTIL_H 11 | 12 | int vlan_add(const char *if_name, int vid, const char *vlan_if_name); 13 | int vlan_rem(const char *if_name); 14 | 15 | #endif /* VLAN_UTIL_H */ 16 | -------------------------------------------------------------------------------- /src/ap/wmm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / WMM (Wi-Fi Multimedia) 3 | * Copyright 2002-2003, Instant802 Networks, Inc. 4 | * Copyright 2005-2006, Devicescape Software, Inc. 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #ifndef WME_H 11 | #define WME_H 12 | 13 | struct ieee80211_mgmt; 14 | struct wmm_tspec_element; 15 | 16 | u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid); 17 | int hostapd_eid_wmm_valid(struct hostapd_data *hapd, const u8 *eid, 18 | size_t len); 19 | void hostapd_wmm_action(struct hostapd_data *hapd, 20 | const struct ieee80211_mgmt *mgmt, size_t len); 21 | int wmm_process_tspec(struct wmm_tspec_element *tspec); 22 | 23 | #endif /* WME_H */ 24 | -------------------------------------------------------------------------------- /src/ap/wnm_ap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IEEE 802.11v WNM related functions and structures 3 | * Copyright (c) 2011-2013, Qualcomm Atheros, Inc. 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef WNM_AP_H 10 | #define WNM_AP_H 11 | 12 | struct sta_info; 13 | 14 | int ieee802_11_rx_wnm_action_ap(struct hostapd_data *hapd, 15 | const struct ieee80211_mgmt *mgmt, size_t len); 16 | int wnm_send_disassoc_imminent(struct hostapd_data *hapd, 17 | struct sta_info *sta, int disassoc_timer); 18 | int wnm_send_ess_disassoc_imminent(struct hostapd_data *hapd, 19 | struct sta_info *sta, const char *url, 20 | int disassoc_timer); 21 | 22 | #endif /* WNM_AP_H */ 23 | -------------------------------------------------------------------------------- /src/ap/wpa_auth_glue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd / WPA authenticator glue code 3 | * Copyright (c) 2002-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef WPA_AUTH_GLUE_H 10 | #define WPA_AUTH_GLUE_H 11 | 12 | int hostapd_setup_wpa(struct hostapd_data *hapd); 13 | void hostapd_reconfig_wpa(struct hostapd_data *hapd); 14 | void hostapd_deinit_wpa(struct hostapd_data *hapd); 15 | 16 | #endif /* WPA_AUTH_GLUE_H */ 17 | -------------------------------------------------------------------------------- /src/ap/wpa_auth_ie.h: -------------------------------------------------------------------------------- 1 | /* 2 | * hostapd - WPA/RSN IE and KDE definitions 3 | * Copyright (c) 2004-2007, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef WPA_AUTH_IE_H 10 | #define WPA_AUTH_IE_H 11 | 12 | struct wpa_eapol_ie_parse { 13 | const u8 *wpa_ie; 14 | size_t wpa_ie_len; 15 | const u8 *rsn_ie; 16 | size_t rsn_ie_len; 17 | const u8 *pmkid; 18 | const u8 *gtk; 19 | size_t gtk_len; 20 | const u8 *mac_addr; 21 | size_t mac_addr_len; 22 | #ifdef CONFIG_PEERKEY 23 | const u8 *smk; 24 | size_t smk_len; 25 | const u8 *nonce; 26 | size_t nonce_len; 27 | const u8 *lifetime; 28 | size_t lifetime_len; 29 | const u8 *error; 30 | size_t error_len; 31 | #endif /* CONFIG_PEERKEY */ 32 | #ifdef CONFIG_IEEE80211W 33 | const u8 *igtk; 34 | size_t igtk_len; 35 | #endif /* CONFIG_IEEE80211W */ 36 | #ifdef CONFIG_IEEE80211R 37 | const u8 *mdie; 38 | size_t mdie_len; 39 | const u8 *ftie; 40 | size_t ftie_len; 41 | #endif /* CONFIG_IEEE80211R */ 42 | #ifdef CONFIG_P2P 43 | const u8 *ip_addr_req; 44 | const u8 *ip_addr_alloc; 45 | #endif /* CONFIG_P2P */ 46 | 47 | const u8 *osen; 48 | size_t osen_len; 49 | }; 50 | 51 | int wpa_parse_kde_ies(const u8 *buf, size_t len, 52 | struct wpa_eapol_ie_parse *ie); 53 | u8 * wpa_add_kde(u8 *pos, u32 kde, const u8 *data, size_t data_len, 54 | const u8 *data2, size_t data2_len); 55 | int wpa_auth_gen_wpa_ie(struct wpa_authenticator *wpa_auth); 56 | 57 | #endif /* WPA_AUTH_IE_H */ 58 | -------------------------------------------------------------------------------- /src/common/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/common/gas.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generic advertisement service (GAS) (IEEE 802.11u) 3 | * Copyright (c) 2009, Atheros Communications 4 | * Copyright (c) 2011-2012, Qualcomm Atheros 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #ifndef GAS_H 11 | #define GAS_H 12 | 13 | struct wpabuf * gas_build_initial_req(u8 dialog_token, size_t size); 14 | struct wpabuf * gas_build_comeback_req(u8 dialog_token); 15 | struct wpabuf * gas_build_initial_resp(u8 dialog_token, u16 status_code, 16 | u16 comeback_delay, size_t size); 17 | struct wpabuf * gas_anqp_build_initial_req(u8 dialog_token, size_t size); 18 | struct wpabuf * gas_anqp_build_initial_resp(u8 dialog_token, u16 status_code, 19 | u16 comeback_delay, size_t size); 20 | struct wpabuf * gas_anqp_build_initial_resp_buf(u8 dialog_token, 21 | u16 status_code, 22 | u16 comeback_delay, 23 | struct wpabuf *payload); 24 | struct wpabuf * gas_anqp_build_comeback_resp(u8 dialog_token, u16 status_code, 25 | u8 frag_id, u8 more, 26 | u16 comeback_delay, size_t size); 27 | struct wpabuf * gas_anqp_build_comeback_resp_buf(u8 dialog_token, 28 | u16 status_code, 29 | u8 frag_id, u8 more, 30 | u16 comeback_delay, 31 | struct wpabuf *payload); 32 | void gas_anqp_set_len(struct wpabuf *buf); 33 | 34 | u8 * gas_anqp_add_element(struct wpabuf *buf, u16 info_id); 35 | void gas_anqp_set_element_len(struct wpabuf *buf, u8 *len_pos); 36 | 37 | #endif /* GAS_H */ 38 | -------------------------------------------------------------------------------- /src/common/qca-vendor-attr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Qualcomm Atheros vendor specific attribute definitions 3 | * Copyright (c) 2014, Qualcomm Atheros, Inc. 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef QCA_VENDOR_ATTR_H 10 | #define QCA_VENDOR_ATTR_H 11 | 12 | /* 13 | * This file defines some of the attributes used with Qualcomm Atheros OUI 14 | * 00:13:74 in a way that is not suitable for qca-vendor.h, e.g., due to 15 | * compiler dependencies. 16 | */ 17 | 18 | struct qca_avoid_freq_range { 19 | u32 start_freq; 20 | u32 end_freq; 21 | } __attribute__ ((packed)); 22 | 23 | struct qca_avoid_freq_list { 24 | u32 count; 25 | struct qca_avoid_freq_range range[0]; 26 | } __attribute__ ((packed)); 27 | 28 | #endif /* QCA_VENDOR_ATTR_H */ 29 | -------------------------------------------------------------------------------- /src/common/version.h: -------------------------------------------------------------------------------- 1 | #ifndef VERSION_H 2 | #define VERSION_H 3 | 4 | #ifndef VERSION_STR_POSTFIX 5 | #define VERSION_STR_POSTFIX "" 6 | #endif /* VERSION_STR_POSTFIX */ 7 | 8 | #define VERSION_STR "2.2-devel" VERSION_STR_POSTFIX 9 | 10 | #endif /* VERSION_H */ 11 | -------------------------------------------------------------------------------- /src/common/wpa_helpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_supplicant ctrl_iface helpers 3 | * Copyright (c) 2010-2011, Atheros Communications, Inc. 4 | * Copyright (c) 2011-2012, Qualcomm Atheros, Inc. 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #ifndef WPA_HELPERS_H 11 | #define WPA_HELPERS_H 12 | 13 | int wpa_command(const char *ifname, const char *cmd); 14 | int wpa_command_resp(const char *ifname, const char *cmd, 15 | char *resp, size_t resp_size); 16 | int get_wpa_status(const char *ifname, const char *field, char *obuf, 17 | size_t obuf_size); 18 | 19 | struct wpa_ctrl * open_wpa_mon(const char *ifname); 20 | int wait_ip_addr(const char *ifname, int timeout); 21 | int get_wpa_cli_event(struct wpa_ctrl *mon, 22 | const char *event, char *buf, size_t buf_size); 23 | int get_wpa_cli_event2(struct wpa_ctrl *mon, 24 | const char *event, const char *event2, 25 | char *buf, size_t buf_size); 26 | 27 | int add_network(const char *ifname); 28 | int set_network(const char *ifname, int id, const char *field, 29 | const char *value); 30 | int set_network_quoted(const char *ifname, int id, const char *field, 31 | const char *value); 32 | int add_cred(const char *ifname); 33 | int set_cred(const char *ifname, int id, const char *field, const char *value); 34 | int set_cred_quoted(const char *ifname, int id, const char *field, 35 | const char *value); 36 | 37 | #endif /* WPA_HELPERS_H */ 38 | -------------------------------------------------------------------------------- /src/crypto/.gitignore: -------------------------------------------------------------------------------- 1 | libcrypto.a 2 | -------------------------------------------------------------------------------- /src/crypto/Makefile: -------------------------------------------------------------------------------- 1 | all: libcrypto.a 2 | 3 | clean: 4 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov libcrypto.a 5 | 6 | install: 7 | @echo Nothing to be made. 8 | 9 | 10 | include ../lib.rules 11 | 12 | CFLAGS += -DCONFIG_CRYPTO_INTERNAL 13 | CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT 14 | CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER 15 | #CFLAGS += -DALL_DH_GROUPS 16 | CFLAGS += -DCONFIG_SHA256 17 | 18 | LIB_OBJS= \ 19 | aes-cbc.o \ 20 | aes-ccm.o \ 21 | aes-ctr.o \ 22 | aes-eax.o \ 23 | aes-encblock.o \ 24 | aes-gcm.o \ 25 | aes-internal.o \ 26 | aes-internal-dec.o \ 27 | aes-internal-enc.o \ 28 | aes-omac1.o \ 29 | aes-unwrap.o \ 30 | aes-wrap.o \ 31 | des-internal.o \ 32 | dh_group5.o \ 33 | dh_groups.o \ 34 | md4-internal.o \ 35 | md5.o \ 36 | md5-internal.o \ 37 | milenage.o \ 38 | ms_funcs.o \ 39 | rc4.o \ 40 | sha1.o \ 41 | sha1-internal.o \ 42 | sha1-pbkdf2.o \ 43 | sha1-prf.o \ 44 | sha1-tlsprf.o \ 45 | sha1-tprf.o \ 46 | sha256.o \ 47 | sha256-prf.o \ 48 | sha256-tlsprf.o \ 49 | sha256-internal.o 50 | 51 | LIB_OBJS += crypto_internal.o 52 | LIB_OBJS += crypto_internal-cipher.o 53 | LIB_OBJS += crypto_internal-modexp.o 54 | LIB_OBJS += crypto_internal-rsa.o 55 | LIB_OBJS += tls_internal.o 56 | LIB_OBJS += fips_prf_internal.o 57 | LIB_OBJS += random.o 58 | 59 | 60 | libcrypto.a: $(LIB_OBJS) 61 | $(AR) crT $@ $? 62 | 63 | -include $(OBJS:%.o=%.d) 64 | -------------------------------------------------------------------------------- /src/crypto/aes-ctr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AES-128 CTR 3 | * 4 | * Copyright (c) 2003-2007, Jouni Malinen 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #include "includes.h" 11 | 12 | #include "common.h" 13 | #include "aes.h" 14 | #include "aes_wrap.h" 15 | 16 | /** 17 | * aes_128_ctr_encrypt - AES-128 CTR mode encryption 18 | * @key: Key for encryption (16 bytes) 19 | * @nonce: Nonce for counter mode (16 bytes) 20 | * @data: Data to encrypt in-place 21 | * @data_len: Length of data in bytes 22 | * Returns: 0 on success, -1 on failure 23 | */ 24 | int aes_128_ctr_encrypt(const u8 *key, const u8 *nonce, 25 | u8 *data, size_t data_len) 26 | { 27 | void *ctx; 28 | size_t j, len, left = data_len; 29 | int i; 30 | u8 *pos = data; 31 | u8 counter[AES_BLOCK_SIZE], buf[AES_BLOCK_SIZE]; 32 | 33 | ctx = aes_encrypt_init(key, 16); 34 | if (ctx == NULL) 35 | return -1; 36 | os_memcpy(counter, nonce, AES_BLOCK_SIZE); 37 | 38 | while (left > 0) { 39 | aes_encrypt(ctx, counter, buf); 40 | 41 | len = (left < AES_BLOCK_SIZE) ? left : AES_BLOCK_SIZE; 42 | for (j = 0; j < len; j++) 43 | pos[j] ^= buf[j]; 44 | pos += len; 45 | left -= len; 46 | 47 | for (i = AES_BLOCK_SIZE - 1; i >= 0; i--) { 48 | counter[i]++; 49 | if (counter[i]) 50 | break; 51 | } 52 | } 53 | aes_encrypt_deinit(ctx); 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /src/crypto/aes-encblock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * AES encrypt_block 3 | * 4 | * Copyright (c) 2003-2007, Jouni Malinen 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #include "includes.h" 11 | 12 | #include "common.h" 13 | #include "aes.h" 14 | #include "aes_wrap.h" 15 | 16 | /** 17 | * aes_128_encrypt_block - Perform one AES 128-bit block operation 18 | * @key: Key for AES 19 | * @in: Input data (16 bytes) 20 | * @out: Output of the AES block operation (16 bytes) 21 | * Returns: 0 on success, -1 on failure 22 | */ 23 | int aes_128_encrypt_block(const u8 *key, const u8 *in, u8 *out) 24 | { 25 | void *ctx; 26 | ctx = aes_encrypt_init(key, 16); 27 | if (ctx == NULL) 28 | return -1; 29 | aes_encrypt(ctx, in, out); 30 | aes_encrypt_deinit(ctx); 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /src/crypto/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AES functions 3 | * Copyright (c) 2003-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef AES_H 10 | #define AES_H 11 | 12 | #define AES_BLOCK_SIZE 16 13 | 14 | void * aes_encrypt_init(const u8 *key, size_t len); 15 | void aes_encrypt(void *ctx, const u8 *plain, u8 *crypt); 16 | void aes_encrypt_deinit(void *ctx); 17 | void * aes_decrypt_init(const u8 *key, size_t len); 18 | void aes_decrypt(void *ctx, const u8 *crypt, u8 *plain); 19 | void aes_decrypt_deinit(void *ctx); 20 | 21 | #endif /* AES_H */ 22 | -------------------------------------------------------------------------------- /src/crypto/crypto_internal-modexp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Crypto wrapper for internal crypto implementation - modexp 3 | * Copyright (c) 2006-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "tls/bignum.h" 13 | #include "crypto.h" 14 | 15 | 16 | int crypto_mod_exp(const u8 *base, size_t base_len, 17 | const u8 *power, size_t power_len, 18 | const u8 *modulus, size_t modulus_len, 19 | u8 *result, size_t *result_len) 20 | { 21 | struct bignum *bn_base, *bn_exp, *bn_modulus, *bn_result; 22 | int ret = -1; 23 | 24 | bn_base = bignum_init(); 25 | bn_exp = bignum_init(); 26 | bn_modulus = bignum_init(); 27 | bn_result = bignum_init(); 28 | 29 | if (bn_base == NULL || bn_exp == NULL || bn_modulus == NULL || 30 | bn_result == NULL) 31 | goto error; 32 | 33 | if (bignum_set_unsigned_bin(bn_base, base, base_len) < 0 || 34 | bignum_set_unsigned_bin(bn_exp, power, power_len) < 0 || 35 | bignum_set_unsigned_bin(bn_modulus, modulus, modulus_len) < 0) 36 | goto error; 37 | 38 | if (bignum_exptmod(bn_base, bn_exp, bn_modulus, bn_result) < 0) 39 | goto error; 40 | 41 | ret = bignum_get_unsigned_bin(bn_result, result, result_len); 42 | 43 | error: 44 | bignum_deinit(bn_base); 45 | bignum_deinit(bn_exp); 46 | bignum_deinit(bn_modulus); 47 | bignum_deinit(bn_result); 48 | return ret; 49 | } 50 | -------------------------------------------------------------------------------- /src/crypto/crypto_none.c: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant / Empty template functions for crypto wrapper 3 | * Copyright (c) 2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "crypto.h" 13 | 14 | 15 | int md4_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) 16 | { 17 | return 0; 18 | } 19 | 20 | 21 | void des_encrypt(const u8 *clear, const u8 *key, u8 *cypher) 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /src/crypto/des_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DES and 3DES-EDE ciphers 3 | * Copyright (c) 2006-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef DES_I_H 10 | #define DES_I_H 11 | 12 | struct des3_key_s { 13 | u32 ek[3][32]; 14 | u32 dk[3][32]; 15 | }; 16 | 17 | void des_key_setup(const u8 *key, u32 *ek, u32 *dk); 18 | void des_block_encrypt(const u8 *plain, const u32 *ek, u8 *crypt); 19 | void des_block_decrypt(const u8 *crypt, const u32 *dk, u8 *plain); 20 | 21 | void des3_key_setup(const u8 *key, struct des3_key_s *dkey); 22 | void des3_encrypt(const u8 *plain, const struct des3_key_s *key, u8 *crypt); 23 | void des3_decrypt(const u8 *crypt, const struct des3_key_s *key, u8 *plain); 24 | 25 | #endif /* DES_I_H */ 26 | -------------------------------------------------------------------------------- /src/crypto/dh_group5.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Diffie-Hellman group 5 operations 3 | * Copyright (c) 2009, 2012, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "dh_groups.h" 13 | #include "dh_group5.h" 14 | 15 | 16 | void * dh5_init(struct wpabuf **priv, struct wpabuf **publ) 17 | { 18 | *publ = dh_init(dh_groups_get(5), priv); 19 | if (*publ == NULL) 20 | return NULL; 21 | return (void *) 1; 22 | } 23 | 24 | 25 | void * dh5_init_fixed(const struct wpabuf *priv, const struct wpabuf *publ) 26 | { 27 | return (void *) 1; 28 | } 29 | 30 | 31 | struct wpabuf * dh5_derive_shared(void *ctx, const struct wpabuf *peer_public, 32 | const struct wpabuf *own_private) 33 | { 34 | return dh_derive_shared(peer_public, own_private, dh_groups_get(5)); 35 | } 36 | 37 | 38 | void dh5_free(void *ctx) 39 | { 40 | } 41 | -------------------------------------------------------------------------------- /src/crypto/dh_group5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Diffie-Hellman group 5 operations 3 | * Copyright (c) 2009, 2012, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef DH_GROUP5_H 10 | #define DH_GROUP5_H 11 | 12 | void * dh5_init(struct wpabuf **priv, struct wpabuf **publ); 13 | void * dh5_init_fixed(const struct wpabuf *priv, const struct wpabuf *publ); 14 | struct wpabuf * dh5_derive_shared(void *ctx, const struct wpabuf *peer_public, 15 | const struct wpabuf *own_private); 16 | void dh5_free(void *ctx); 17 | 18 | #endif /* DH_GROUP5_H */ 19 | -------------------------------------------------------------------------------- /src/crypto/dh_groups.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Diffie-Hellman groups 3 | * Copyright (c) 2007, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef DH_GROUPS_H 10 | #define DH_GROUPS_H 11 | 12 | struct dh_group { 13 | int id; 14 | const u8 *generator; 15 | size_t generator_len; 16 | const u8 *prime; 17 | size_t prime_len; 18 | const u8 *order; 19 | size_t order_len; 20 | unsigned int safe_prime:1; 21 | }; 22 | 23 | const struct dh_group * dh_groups_get(int id); 24 | struct wpabuf * dh_init(const struct dh_group *dh, struct wpabuf **priv); 25 | struct wpabuf * dh_derive_shared(const struct wpabuf *peer_public, 26 | const struct wpabuf *own_private, 27 | const struct dh_group *dh); 28 | 29 | #endif /* DH_GROUPS_H */ 30 | -------------------------------------------------------------------------------- /src/crypto/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MD5 hash implementation and interface functions 3 | * Copyright (c) 2003-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef MD5_H 10 | #define MD5_H 11 | 12 | #define MD5_MAC_LEN 16 13 | 14 | int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem, 15 | const u8 *addr[], const size_t *len, u8 *mac); 16 | int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len, 17 | u8 *mac); 18 | 19 | #endif /* MD5_H */ 20 | -------------------------------------------------------------------------------- /src/crypto/md5_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MD5 internal definitions 3 | * Copyright (c) 2003-2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef MD5_I_H 10 | #define MD5_I_H 11 | 12 | struct MD5Context { 13 | u32 buf[4]; 14 | u32 bits[2]; 15 | u8 in[64]; 16 | }; 17 | 18 | void MD5Init(struct MD5Context *context); 19 | void MD5Update(struct MD5Context *context, unsigned char const *buf, 20 | unsigned len); 21 | void MD5Final(unsigned char digest[16], struct MD5Context *context); 22 | 23 | #endif /* MD5_I_H */ 24 | -------------------------------------------------------------------------------- /src/crypto/milenage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * UMTS AKA - Milenage algorithm (3GPP TS 35.205, .206, .207, .208) 3 | * Copyright (c) 2006-2007 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef MILENAGE_H 10 | #define MILENAGE_H 11 | 12 | void milenage_generate(const u8 *opc, const u8 *amf, const u8 *k, 13 | const u8 *sqn, const u8 *_rand, u8 *autn, u8 *ik, 14 | u8 *ck, u8 *res, size_t *res_len); 15 | int milenage_auts(const u8 *opc, const u8 *k, const u8 *_rand, const u8 *auts, 16 | u8 *sqn); 17 | int gsm_milenage(const u8 *opc, const u8 *k, const u8 *_rand, u8 *sres, 18 | u8 *kc); 19 | int milenage_check(const u8 *opc, const u8 *k, const u8 *sqn, const u8 *_rand, 20 | const u8 *autn, u8 *ik, u8 *ck, u8 *res, size_t *res_len, 21 | u8 *auts); 22 | int milenage_f1(const u8 *opc, const u8 *k, const u8 *_rand, 23 | const u8 *sqn, const u8 *amf, u8 *mac_a, u8 *mac_s); 24 | int milenage_f2345(const u8 *opc, const u8 *k, const u8 *_rand, 25 | u8 *res, u8 *ck, u8 *ik, u8 *ak, u8 *akstar); 26 | 27 | #endif /* MILENAGE_H */ 28 | -------------------------------------------------------------------------------- /src/crypto/random.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Random number generator 3 | * Copyright (c) 2010-2011, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef RANDOM_H 10 | #define RANDOM_H 11 | 12 | #ifdef CONFIG_NO_RANDOM_POOL 13 | #define random_init(e) do { } while (0) 14 | #define random_deinit() do { } while (0) 15 | #define random_add_randomness(b, l) do { } while (0) 16 | #define random_get_bytes(b, l) os_get_random((b), (l)) 17 | #define random_pool_ready() 1 18 | #define random_mark_pool_ready() do { } while (0) 19 | #else /* CONFIG_NO_RANDOM_POOL */ 20 | void random_init(const char *entropy_file); 21 | void random_deinit(void); 22 | void random_add_randomness(const void *buf, size_t len); 23 | int random_get_bytes(void *buf, size_t len); 24 | int random_pool_ready(void); 25 | void random_mark_pool_ready(void); 26 | #endif /* CONFIG_NO_RANDOM_POOL */ 27 | 28 | #endif /* RANDOM_H */ 29 | -------------------------------------------------------------------------------- /src/crypto/rc4.c: -------------------------------------------------------------------------------- 1 | /* 2 | * RC4 stream cipher 3 | * Copyright (c) 2002-2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "crypto.h" 13 | 14 | #define S_SWAP(a,b) do { u8 t = S[a]; S[a] = S[b]; S[b] = t; } while(0) 15 | 16 | int rc4_skip(const u8 *key, size_t keylen, size_t skip, 17 | u8 *data, size_t data_len) 18 | { 19 | u32 i, j, k; 20 | u8 S[256], *pos; 21 | size_t kpos; 22 | 23 | /* Setup RC4 state */ 24 | for (i = 0; i < 256; i++) 25 | S[i] = i; 26 | j = 0; 27 | kpos = 0; 28 | for (i = 0; i < 256; i++) { 29 | j = (j + S[i] + key[kpos]) & 0xff; 30 | kpos++; 31 | if (kpos >= keylen) 32 | kpos = 0; 33 | S_SWAP(i, j); 34 | } 35 | 36 | /* Skip the start of the stream */ 37 | i = j = 0; 38 | for (k = 0; k < skip; k++) { 39 | i = (i + 1) & 0xff; 40 | j = (j + S[i]) & 0xff; 41 | S_SWAP(i, j); 42 | } 43 | 44 | /* Apply RC4 to data */ 45 | pos = data; 46 | for (k = 0; k < data_len; k++) { 47 | i = (i + 1) & 0xff; 48 | j = (j + S[i]) & 0xff; 49 | S_SWAP(i, j); 50 | *pos++ ^= S[(S[i] + S[j]) & 0xff]; 51 | } 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /src/crypto/sha1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SHA1 hash implementation and interface functions 3 | * Copyright (c) 2003-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef SHA1_H 10 | #define SHA1_H 11 | 12 | #define SHA1_MAC_LEN 20 13 | 14 | int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem, 15 | const u8 *addr[], const size_t *len, u8 *mac); 16 | int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len, 17 | u8 *mac); 18 | int sha1_prf(const u8 *key, size_t key_len, const char *label, 19 | const u8 *data, size_t data_len, u8 *buf, size_t buf_len); 20 | int sha1_t_prf(const u8 *key, size_t key_len, const char *label, 21 | const u8 *seed, size_t seed_len, u8 *buf, size_t buf_len); 22 | int __must_check tls_prf_sha1_md5(const u8 *secret, size_t secret_len, 23 | const char *label, const u8 *seed, 24 | size_t seed_len, u8 *out, size_t outlen); 25 | int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len, 26 | int iterations, u8 *buf, size_t buflen); 27 | #endif /* SHA1_H */ 28 | -------------------------------------------------------------------------------- /src/crypto/sha1_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SHA1 internal definitions 3 | * Copyright (c) 2003-2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef SHA1_I_H 10 | #define SHA1_I_H 11 | 12 | struct SHA1Context { 13 | u32 state[5]; 14 | u32 count[2]; 15 | unsigned char buffer[64]; 16 | }; 17 | 18 | void SHA1Init(struct SHA1Context *context); 19 | void SHA1Update(struct SHA1Context *context, const void *data, u32 len); 20 | void SHA1Final(unsigned char digest[20], struct SHA1Context *context); 21 | void SHA1Transform(u32 state[5], const unsigned char buffer[64]); 22 | 23 | #endif /* SHA1_I_H */ 24 | -------------------------------------------------------------------------------- /src/crypto/sha256.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SHA256 hash implementation and interface functions 3 | * Copyright (c) 2003-2013, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef SHA256_H 10 | #define SHA256_H 11 | 12 | #define SHA256_MAC_LEN 32 13 | 14 | int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, 15 | const u8 *addr[], const size_t *len, u8 *mac); 16 | int hmac_sha256(const u8 *key, size_t key_len, const u8 *data, 17 | size_t data_len, u8 *mac); 18 | void sha256_prf(const u8 *key, size_t key_len, const char *label, 19 | const u8 *data, size_t data_len, u8 *buf, size_t buf_len); 20 | void sha256_prf_bits(const u8 *key, size_t key_len, const char *label, 21 | const u8 *data, size_t data_len, u8 *buf, 22 | size_t buf_len_bits); 23 | void tls_prf_sha256(const u8 *secret, size_t secret_len, 24 | const char *label, const u8 *seed, size_t seed_len, 25 | u8 *out, size_t outlen); 26 | 27 | #endif /* SHA256_H */ 28 | -------------------------------------------------------------------------------- /src/crypto/sha256_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SHA-256 internal definitions 3 | * Copyright (c) 2003-2011, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef SHA256_I_H 10 | #define SHA256_I_H 11 | 12 | #define SHA256_BLOCK_SIZE 64 13 | 14 | struct sha256_state { 15 | u64 length; 16 | u32 state[8], curlen; 17 | u8 buf[SHA256_BLOCK_SIZE]; 18 | }; 19 | 20 | void sha256_init(struct sha256_state *md); 21 | int sha256_process(struct sha256_state *md, const unsigned char *in, 22 | unsigned long inlen); 23 | int sha256_done(struct sha256_state *md, unsigned char *out); 24 | 25 | #endif /* SHA256_I_H */ 26 | -------------------------------------------------------------------------------- /src/drivers/.gitignore: -------------------------------------------------------------------------------- 1 | build.wpa_supplicant 2 | build.hostapd 3 | -------------------------------------------------------------------------------- /src/drivers/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | rm -f build.wpa_supplicant build.hostapd 7 | 8 | install: 9 | @echo Nothing to be made. 10 | -------------------------------------------------------------------------------- /src/drivers/linux_ioctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Linux ioctl helper functions for driver wrappers 3 | * Copyright (c) 2002-2010, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef LINUX_IOCTL_H 10 | #define LINUX_IOCTL_H 11 | 12 | int linux_set_iface_flags(int sock, const char *ifname, int dev_up); 13 | int linux_iface_up(int sock, const char *ifname); 14 | int linux_get_ifhwaddr(int sock, const char *ifname, u8 *addr); 15 | int linux_set_ifhwaddr(int sock, const char *ifname, const u8 *addr); 16 | int linux_br_add(int sock, const char *brname); 17 | int linux_br_del(int sock, const char *brname); 18 | int linux_br_add_if(int sock, const char *brname, const char *ifname); 19 | int linux_br_del_if(int sock, const char *brname, const char *ifname); 20 | int linux_br_get(char *brname, const char *ifname); 21 | 22 | #endif /* LINUX_IOCTL_H */ 23 | -------------------------------------------------------------------------------- /src/drivers/linux_wext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Driver interaction with generic Linux Wireless Extensions 3 | * Copyright (c) 2003-2011, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef LINUX_WEXT_H 10 | #define LINUX_WEXT_H 11 | 12 | #ifndef ANDROID 13 | 14 | /* 15 | * Avoid including other kernel header to avoid conflicts with C library 16 | * headers. 17 | */ 18 | #define _LINUX_TYPES_H 19 | #define _LINUX_SOCKET_H 20 | #define _LINUX_IF_H 21 | 22 | #include 23 | #include 24 | typedef __uint32_t __u32; 25 | typedef __int32_t __s32; 26 | typedef __uint16_t __u16; 27 | typedef __int16_t __s16; 28 | typedef __uint8_t __u8; 29 | #ifndef __user 30 | #define __user 31 | #endif /* __user */ 32 | 33 | #endif /* ANDROID */ 34 | 35 | #include 36 | 37 | #ifndef IW_ENCODE_ALG_PMK 38 | #define IW_ENCODE_ALG_PMK 4 39 | #endif 40 | 41 | #ifndef IW_ENC_CAPA_4WAY_HANDSHAKE 42 | #define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010 43 | #endif 44 | 45 | #endif /* LINUX_WEXT_H */ 46 | -------------------------------------------------------------------------------- /src/drivers/netlink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Netlink helper functions for driver wrappers 3 | * Copyright (c) 2002-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef NETLINK_H 10 | #define NETLINK_H 11 | 12 | struct netlink_data; 13 | struct ifinfomsg; 14 | 15 | struct netlink_config { 16 | void *ctx; 17 | void (*newlink_cb)(void *ctx, struct ifinfomsg *ifi, u8 *buf, 18 | size_t len); 19 | void (*dellink_cb)(void *ctx, struct ifinfomsg *ifi, u8 *buf, 20 | size_t len); 21 | }; 22 | 23 | struct netlink_data * netlink_init(struct netlink_config *cfg); 24 | void netlink_deinit(struct netlink_data *netlink); 25 | int netlink_send_oper_ifla(struct netlink_data *netlink, int ifindex, 26 | int linkmode, int operstate); 27 | 28 | #endif /* NETLINK_H */ 29 | -------------------------------------------------------------------------------- /src/drivers/rfkill.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Linux rfkill helper functions for driver wrappers 3 | * Copyright (c) 2010, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef RFKILL_H 10 | #define RFKILL_H 11 | 12 | struct rfkill_data; 13 | 14 | struct rfkill_config { 15 | void *ctx; 16 | char ifname[IFNAMSIZ]; 17 | void (*blocked_cb)(void *ctx); 18 | void (*unblocked_cb)(void *ctx); 19 | }; 20 | 21 | struct rfkill_data * rfkill_init(struct rfkill_config *cfg); 22 | void rfkill_deinit(struct rfkill_data *rfkill); 23 | int rfkill_is_blocked(struct rfkill_data *rfkill); 24 | 25 | #endif /* RFKILL_H */ 26 | -------------------------------------------------------------------------------- /src/eap_common/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/eap_common/chap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * CHAP-MD5 (RFC 1994) 3 | * Copyright (c) 2007-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "crypto/crypto.h" 13 | #include "chap.h" 14 | 15 | int chap_md5(u8 id, const u8 *secret, size_t secret_len, const u8 *challenge, 16 | size_t challenge_len, u8 *response) 17 | { 18 | const u8 *addr[3]; 19 | size_t len[3]; 20 | 21 | addr[0] = &id; 22 | len[0] = 1; 23 | addr[1] = secret; 24 | len[1] = secret_len; 25 | addr[2] = challenge; 26 | len[2] = challenge_len; 27 | return md5_vector(3, addr, len, response); 28 | } 29 | -------------------------------------------------------------------------------- /src/eap_common/chap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CHAP-MD5 (RFC 1994) 3 | * Copyright (c) 2007-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef CHAP_H 10 | #define CHAP_H 11 | 12 | #define CHAP_MD5_LEN 16 13 | 14 | int chap_md5(u8 id, const u8 *secret, size_t secret_len, const u8 *challenge, 15 | size_t challenge_len, u8 *response); 16 | 17 | #endif /* CHAP_H */ 18 | -------------------------------------------------------------------------------- /src/eap_common/eap_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EAP common peer/server definitions 3 | * Copyright (c) 2004-2012, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EAP_COMMON_H 10 | #define EAP_COMMON_H 11 | 12 | #include "wpabuf.h" 13 | 14 | int eap_hdr_len_valid(const struct wpabuf *msg, size_t min_payload); 15 | const u8 * eap_hdr_validate(int vendor, EapType eap_type, 16 | const struct wpabuf *msg, size_t *plen); 17 | struct wpabuf * eap_msg_alloc(int vendor, EapType type, size_t payload_len, 18 | u8 code, u8 identifier); 19 | void eap_update_len(struct wpabuf *msg); 20 | u8 eap_get_id(const struct wpabuf *msg); 21 | EapType eap_get_type(const struct wpabuf *msg); 22 | 23 | #endif /* EAP_COMMON_H */ 24 | -------------------------------------------------------------------------------- /src/eap_common/eap_ikev2_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EAP-IKEv2 definitions 3 | * Copyright (c) 2007, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EAP_IKEV2_COMMON_H 10 | #define EAP_IKEV2_COMMON_H 11 | 12 | #ifdef CCNS_PL 13 | /* incorrect bit order */ 14 | #define IKEV2_FLAGS_LENGTH_INCLUDED 0x01 15 | #define IKEV2_FLAGS_MORE_FRAGMENTS 0x02 16 | #define IKEV2_FLAGS_ICV_INCLUDED 0x04 17 | #else /* CCNS_PL */ 18 | #define IKEV2_FLAGS_LENGTH_INCLUDED 0x80 19 | #define IKEV2_FLAGS_MORE_FRAGMENTS 0x40 20 | #define IKEV2_FLAGS_ICV_INCLUDED 0x20 21 | #endif /* CCNS_PL */ 22 | 23 | #define IKEV2_FRAGMENT_SIZE 1400 24 | 25 | struct ikev2_keys; 26 | 27 | int eap_ikev2_derive_keymat(int prf, struct ikev2_keys *keys, 28 | const u8 *i_nonce, size_t i_nonce_len, 29 | const u8 *r_nonce, size_t r_nonce_len, 30 | u8 *keymat); 31 | struct wpabuf * eap_ikev2_build_frag_ack(u8 id, u8 code); 32 | int eap_ikev2_validate_icv(int integ_alg, struct ikev2_keys *keys, 33 | int initiator, const struct wpabuf *msg, 34 | const u8 *pos, const u8 *end); 35 | 36 | #endif /* EAP_IKEV2_COMMON_H */ 37 | -------------------------------------------------------------------------------- /src/eap_common/eap_peap_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EAP-PEAP common routines 3 | * Copyright (c) 2008-2011, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EAP_PEAP_COMMON_H 10 | #define EAP_PEAP_COMMON_H 11 | 12 | int peap_prfplus(int version, const u8 *key, size_t key_len, 13 | const char *label, const u8 *seed, size_t seed_len, 14 | u8 *buf, size_t buf_len); 15 | 16 | #endif /* EAP_PEAP_COMMON_H */ 17 | -------------------------------------------------------------------------------- /src/eap_common/eap_wsc_common.c: -------------------------------------------------------------------------------- 1 | /* 2 | * EAP-WSC common routines for Wi-Fi Protected Setup 3 | * Copyright (c) 2007, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "eap_defs.h" 13 | #include "eap_common.h" 14 | #include "wps/wps.h" 15 | #include "eap_wsc_common.h" 16 | 17 | struct wpabuf * eap_wsc_build_frag_ack(u8 id, u8 code) 18 | { 19 | struct wpabuf *msg; 20 | 21 | msg = eap_msg_alloc(EAP_VENDOR_WFA, EAP_VENDOR_TYPE_WSC, 2, code, id); 22 | if (msg == NULL) { 23 | wpa_printf(MSG_ERROR, "EAP-WSC: Failed to allocate memory for " 24 | "FRAG_ACK"); 25 | return NULL; 26 | } 27 | 28 | wpa_printf(MSG_DEBUG, "EAP-WSC: Send WSC/FRAG_ACK"); 29 | wpabuf_put_u8(msg, WSC_FRAG_ACK); /* Op-Code */ 30 | wpabuf_put_u8(msg, 0); /* Flags */ 31 | 32 | return msg; 33 | } 34 | -------------------------------------------------------------------------------- /src/eap_common/eap_wsc_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EAP-WSC definitions for Wi-Fi Protected Setup 3 | * Copyright (c) 2007, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EAP_WSC_COMMON_H 10 | #define EAP_WSC_COMMON_H 11 | 12 | #define EAP_VENDOR_TYPE_WSC 1 13 | 14 | #define WSC_FLAGS_MF 0x01 15 | #define WSC_FLAGS_LF 0x02 16 | 17 | #define WSC_ID_REGISTRAR "WFA-SimpleConfig-Registrar-1-0" 18 | #define WSC_ID_REGISTRAR_LEN 30 19 | #define WSC_ID_ENROLLEE "WFA-SimpleConfig-Enrollee-1-0" 20 | #define WSC_ID_ENROLLEE_LEN 29 21 | 22 | #define WSC_FRAGMENT_SIZE 1400 23 | 24 | 25 | struct wpabuf * eap_wsc_build_frag_ack(u8 id, u8 code); 26 | 27 | #endif /* EAP_WSC_COMMON_H */ 28 | -------------------------------------------------------------------------------- /src/eap_peer/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.so *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | if ls *.so >/dev/null 2>&1; then \ 9 | install -d $(DESTDIR)$(LIBDIR)/wpa_supplicant && \ 10 | cp *.so $(DESTDIR)$(LIBDIR)/wpa_supplicant \ 11 | ; fi 12 | -------------------------------------------------------------------------------- /src/eap_peer/eap_proxy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EAP proxy definitions 3 | * Copyright (c) 2011-2013 Qualcomm Atheros, Inc. 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EAP_PROXY_H 10 | #define EAP_PROXY_H 11 | 12 | struct eap_proxy_sm; 13 | struct eapol_callbacks; 14 | struct eap_sm; 15 | struct eap_peer_config; 16 | 17 | enum eap_proxy_status { 18 | EAP_PROXY_FAILURE = 0x00, 19 | EAP_PROXY_SUCCESS 20 | }; 21 | 22 | struct eap_proxy_sm * 23 | eap_proxy_init(void *eapol_ctx, struct eapol_callbacks *eapol_cb, 24 | void *msg_ctx); 25 | 26 | void eap_proxy_deinit(struct eap_proxy_sm *eap_proxy); 27 | 28 | int eap_proxy_key_available(struct eap_proxy_sm *sm); 29 | 30 | const u8 * eap_proxy_get_eapKeyData(struct eap_proxy_sm *sm, size_t *len); 31 | 32 | struct wpabuf * eap_proxy_get_eapRespData(struct eap_proxy_sm *sm); 33 | 34 | int eap_proxy_sm_step(struct eap_proxy_sm *sm, struct eap_sm *eap_sm); 35 | 36 | enum eap_proxy_status 37 | eap_proxy_packet_update(struct eap_proxy_sm *eap_proxy, u8 *eapReqData, 38 | int eapReqDataLen); 39 | 40 | int eap_proxy_sm_get_status(struct eap_proxy_sm *sm, char *buf, size_t buflen, 41 | int verbose); 42 | 43 | int eap_proxy_get_imsi(struct eap_proxy_sm *eap_proxy, char *imsi_buf, 44 | size_t *imsi_len); 45 | 46 | int eap_proxy_notify_config(struct eap_proxy_sm *sm, 47 | struct eap_peer_config *config); 48 | 49 | #endif /* EAP_PROXY_H */ 50 | -------------------------------------------------------------------------------- /src/eap_peer/mschapv2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MSCHAPV2 (RFC 2759) 3 | * Copyright (c) 2004-2008, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef MSCHAPV2_H 10 | #define MSCHAPV2_H 11 | 12 | #define MSCHAPV2_CHAL_LEN 16 13 | #define MSCHAPV2_NT_RESPONSE_LEN 24 14 | #define MSCHAPV2_AUTH_RESPONSE_LEN 20 15 | #define MSCHAPV2_MASTER_KEY_LEN 16 16 | 17 | const u8 * mschapv2_remove_domain(const u8 *username, size_t *len); 18 | int mschapv2_derive_response(const u8 *username, size_t username_len, 19 | const u8 *password, size_t password_len, 20 | int pwhash, 21 | const u8 *auth_challenge, 22 | const u8 *peer_challenge, 23 | u8 *nt_response, u8 *auth_response, 24 | u8 *master_key); 25 | int mschapv2_verify_auth_response(const u8 *auth_response, 26 | const u8 *buf, size_t buf_len); 27 | 28 | #endif /* MSCHAPV2_H */ 29 | -------------------------------------------------------------------------------- /src/eap_peer/tncc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EAP-TNC - TNCC (IF-IMC and IF-TNCCS) 3 | * Copyright (c) 2007, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef TNCC_H 10 | #define TNCC_H 11 | 12 | struct tncc_data; 13 | 14 | struct tncc_data * tncc_init(void); 15 | void tncc_deinit(struct tncc_data *tncc); 16 | void tncc_init_connection(struct tncc_data *tncc); 17 | size_t tncc_total_send_len(struct tncc_data *tncc); 18 | u8 * tncc_copy_send_buf(struct tncc_data *tncc, u8 *pos); 19 | char * tncc_if_tnccs_start(struct tncc_data *tncc); 20 | char * tncc_if_tnccs_end(void); 21 | 22 | enum tncc_process_res { 23 | TNCCS_PROCESS_ERROR = -1, 24 | TNCCS_PROCESS_OK_NO_RECOMMENDATION = 0, 25 | TNCCS_RECOMMENDATION_ERROR, 26 | TNCCS_RECOMMENDATION_ALLOW, 27 | TNCCS_RECOMMENDATION_NONE, 28 | TNCCS_RECOMMENDATION_ISOLATE 29 | }; 30 | 31 | enum tncc_process_res tncc_process_if_tnccs(struct tncc_data *tncc, 32 | const u8 *msg, size_t len); 33 | 34 | struct wpabuf * tncc_process_soh_request(int ver, const u8 *data, size_t len); 35 | 36 | #endif /* TNCC_H */ 37 | -------------------------------------------------------------------------------- /src/eap_server/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/eap_server/tncs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EAP-TNC - TNCS (IF-IMV, IF-TNCCS, and IF-TNCCS-SOH) 3 | * Copyright (c) 2007-2008, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef TNCS_H 10 | #define TNCS_H 11 | 12 | struct tncs_data; 13 | 14 | struct tncs_data * tncs_init(void); 15 | void tncs_deinit(struct tncs_data *tncs); 16 | void tncs_init_connection(struct tncs_data *tncs); 17 | size_t tncs_total_send_len(struct tncs_data *tncs); 18 | u8 * tncs_copy_send_buf(struct tncs_data *tncs, u8 *pos); 19 | char * tncs_if_tnccs_start(struct tncs_data *tncs); 20 | char * tncs_if_tnccs_end(void); 21 | 22 | enum tncs_process_res { 23 | TNCCS_PROCESS_ERROR = -1, 24 | TNCCS_PROCESS_OK_NO_RECOMMENDATION = 0, 25 | TNCCS_RECOMMENDATION_ERROR, 26 | TNCCS_RECOMMENDATION_ALLOW, 27 | TNCCS_RECOMMENDATION_NONE, 28 | TNCCS_RECOMMENDATION_ISOLATE, 29 | TNCCS_RECOMMENDATION_NO_ACCESS, 30 | TNCCS_RECOMMENDATION_NO_RECOMMENDATION 31 | }; 32 | 33 | enum tncs_process_res tncs_process_if_tnccs(struct tncs_data *tncs, 34 | const u8 *msg, size_t len); 35 | 36 | int tncs_global_init(void); 37 | void tncs_global_deinit(void); 38 | 39 | struct wpabuf * tncs_build_soh_request(void); 40 | struct wpabuf * tncs_process_soh(const u8 *soh_tlv, size_t soh_tlv_len, 41 | int *failure); 42 | 43 | #endif /* TNCS_H */ 44 | -------------------------------------------------------------------------------- /src/eapol_auth/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/eapol_supp/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/l2_packet/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/lib.rules: -------------------------------------------------------------------------------- 1 | ifndef CC 2 | CC=gcc 3 | endif 4 | 5 | ifndef CFLAGS 6 | CFLAGS = -MMD -O2 -Wall -g 7 | endif 8 | 9 | CFLAGS += -I.. -I../utils 10 | 11 | 12 | Q=@ 13 | E=echo 14 | ifeq ($(V), 1) 15 | Q= 16 | E=true 17 | endif 18 | 19 | %.o: %.c 20 | $(Q)$(CC) -c -o $@ $(CFLAGS) $< 21 | @$(E) " CC " $< 22 | -------------------------------------------------------------------------------- /src/p2p/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/pae/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/pae/ieee802_1x_key.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IEEE 802.1X-2010 Key Hierarchy 3 | * Copyright (c) 2013, Qualcomm Atheros, Inc. 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef IEEE802_1X_KEY_H 10 | #define IEEE802_1X_KEY_H 11 | 12 | int ieee802_1x_cak_128bits_aes_cmac(const u8 *msk, const u8 *mac1, 13 | const u8 *mac2, u8 *cak); 14 | int ieee802_1x_ckn_128bits_aes_cmac(const u8 *msk, const u8 *mac1, 15 | const u8 *mac2, const u8 *sid, 16 | size_t sid_bytes, u8 *ckn); 17 | int ieee802_1x_kek_128bits_aes_cmac(const u8 *cak, const u8 *ckn, 18 | size_t ckn_bytes, u8 *kek); 19 | int ieee802_1x_ick_128bits_aes_cmac(const u8 *cak, const u8 *ckn, 20 | size_t ckn_bytes, u8 *ick); 21 | int ieee802_1x_icv_128bits_aes_cmac(const u8 *ick, const u8 *msg, 22 | size_t msg_bytes, u8 *icv); 23 | int ieee802_1x_sak_128bits_aes_cmac(const u8 *cak, const u8 *ctx, 24 | size_t ctx_bytes, u8 *sak); 25 | 26 | #endif /* IEEE802_1X_KEY_H */ 27 | -------------------------------------------------------------------------------- /src/radius/.gitignore: -------------------------------------------------------------------------------- 1 | libradius.a 2 | -------------------------------------------------------------------------------- /src/radius/Makefile: -------------------------------------------------------------------------------- 1 | all: libradius.a 2 | 3 | clean: 4 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov libradius.a 5 | 6 | install: 7 | @echo Nothing to be made. 8 | 9 | 10 | include ../lib.rules 11 | 12 | CFLAGS += -DCONFIG_IPV6 13 | 14 | LIB_OBJS= \ 15 | radius.o \ 16 | radius_client.o \ 17 | radius_server.o 18 | 19 | libradius.a: $(LIB_OBJS) 20 | $(AR) crT $@ $? 21 | 22 | -include $(OBJS:%.o=%.d) 23 | -------------------------------------------------------------------------------- /src/radius/radius_das.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RADIUS Dynamic Authorization Server (DAS) 3 | * Copyright (c) 2012, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef RADIUS_DAS_H 10 | #define RADIUS_DAS_H 11 | 12 | struct radius_das_data; 13 | 14 | enum radius_das_res { 15 | RADIUS_DAS_SUCCESS, 16 | RADIUS_DAS_NAS_MISMATCH, 17 | RADIUS_DAS_SESSION_NOT_FOUND 18 | }; 19 | 20 | struct radius_das_attrs { 21 | /* NAS identification attributes */ 22 | const u8 *nas_ip_addr; 23 | const u8 *nas_identifier; 24 | size_t nas_identifier_len; 25 | const u8 *nas_ipv6_addr; 26 | 27 | /* Session identification attributes */ 28 | const u8 *sta_addr; 29 | const u8 *user_name; 30 | size_t user_name_len; 31 | const u8 *acct_session_id; 32 | size_t acct_session_id_len; 33 | const u8 *cui; 34 | size_t cui_len; 35 | }; 36 | 37 | struct radius_das_conf { 38 | int port; 39 | const u8 *shared_secret; 40 | size_t shared_secret_len; 41 | const struct hostapd_ip_addr *client_addr; 42 | unsigned int time_window; 43 | int require_event_timestamp; 44 | void *ctx; 45 | enum radius_das_res (*disconnect)(void *ctx, 46 | struct radius_das_attrs *attr); 47 | }; 48 | 49 | struct radius_das_data * 50 | radius_das_init(struct radius_das_conf *conf); 51 | 52 | void radius_das_deinit(struct radius_das_data *data); 53 | 54 | #endif /* RADIUS_DAS_H */ 55 | -------------------------------------------------------------------------------- /src/rsn_supp/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/tls/.gitignore: -------------------------------------------------------------------------------- 1 | libtls.a 2 | -------------------------------------------------------------------------------- /src/tls/Makefile: -------------------------------------------------------------------------------- 1 | all: libtls.a 2 | 3 | clean: 4 | rm -f *~ *.o *.d libtls.a 5 | 6 | install: 7 | @echo Nothing to be made. 8 | 9 | 10 | include ../lib.rules 11 | 12 | CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH 13 | CFLAGS += -DCONFIG_CRYPTO_INTERNAL 14 | CFLAGS += -DCONFIG_TLSV11 15 | CFLAGS += -DCONFIG_TLSV12 16 | 17 | LIB_OBJS= \ 18 | asn1.o \ 19 | bignum.o \ 20 | pkcs1.o \ 21 | pkcs5.o \ 22 | pkcs8.o \ 23 | rsa.o \ 24 | tlsv1_client.o \ 25 | tlsv1_client_read.o \ 26 | tlsv1_client_write.o \ 27 | tlsv1_common.o \ 28 | tlsv1_cred.o \ 29 | tlsv1_record.o \ 30 | tlsv1_server.o \ 31 | tlsv1_server_read.o \ 32 | tlsv1_server_write.o \ 33 | x509v3.o 34 | 35 | 36 | libtls.a: $(LIB_OBJS) 37 | $(AR) crT $@ $? 38 | 39 | -include $(OBJS:%.o=%.d) 40 | -------------------------------------------------------------------------------- /src/tls/bignum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Big number math 3 | * Copyright (c) 2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef BIGNUM_H 10 | #define BIGNUM_H 11 | 12 | struct bignum; 13 | 14 | struct bignum * bignum_init(void); 15 | void bignum_deinit(struct bignum *n); 16 | size_t bignum_get_unsigned_bin_len(struct bignum *n); 17 | int bignum_get_unsigned_bin(const struct bignum *n, u8 *buf, size_t *len); 18 | int bignum_set_unsigned_bin(struct bignum *n, const u8 *buf, size_t len); 19 | int bignum_cmp(const struct bignum *a, const struct bignum *b); 20 | int bignum_cmp_d(const struct bignum *a, unsigned long b); 21 | int bignum_add(const struct bignum *a, const struct bignum *b, 22 | struct bignum *c); 23 | int bignum_sub(const struct bignum *a, const struct bignum *b, 24 | struct bignum *c); 25 | int bignum_mul(const struct bignum *a, const struct bignum *b, 26 | struct bignum *c); 27 | int bignum_mulmod(const struct bignum *a, const struct bignum *b, 28 | const struct bignum *c, struct bignum *d); 29 | int bignum_exptmod(const struct bignum *a, const struct bignum *b, 30 | const struct bignum *c, struct bignum *d); 31 | 32 | #endif /* BIGNUM_H */ 33 | -------------------------------------------------------------------------------- /src/tls/pkcs1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PKCS #1 (RSA Encryption) 3 | * Copyright (c) 2006-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef PKCS1_H 10 | #define PKCS1_H 11 | 12 | struct crypto_public_key; 13 | struct asn1_oid; 14 | 15 | int pkcs1_encrypt(int block_type, struct crypto_rsa_key *key, 16 | int use_private, const u8 *in, size_t inlen, 17 | u8 *out, size_t *outlen); 18 | int pkcs1_v15_private_key_decrypt(struct crypto_rsa_key *key, 19 | const u8 *in, size_t inlen, 20 | u8 *out, size_t *outlen); 21 | int pkcs1_decrypt_public_key(struct crypto_rsa_key *key, 22 | const u8 *crypt, size_t crypt_len, 23 | u8 *plain, size_t *plain_len); 24 | int pkcs1_v15_sig_ver(struct crypto_public_key *pk, 25 | const u8 *s, size_t s_len, 26 | const struct asn1_oid *hash_alg, 27 | const u8 *hash, size_t hash_len); 28 | 29 | #endif /* PKCS1_H */ 30 | -------------------------------------------------------------------------------- /src/tls/pkcs5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PKCS #5 (Password-based Encryption) 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef PKCS5_H 10 | #define PKCS5_H 11 | 12 | u8 * pkcs5_decrypt(const u8 *enc_alg, size_t enc_alg_len, 13 | const u8 *enc_data, size_t enc_data_len, 14 | const char *passwd, size_t *data_len); 15 | 16 | #endif /* PKCS5_H */ 17 | -------------------------------------------------------------------------------- /src/tls/pkcs8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PKCS #8 (Private-key information syntax) 3 | * Copyright (c) 2006-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef PKCS8_H 10 | #define PKCS8_H 11 | 12 | struct crypto_private_key * pkcs8_key_import(const u8 *buf, size_t len); 13 | struct crypto_private_key * 14 | pkcs8_enc_key_import(const u8 *buf, size_t len, const char *passwd); 15 | 16 | #endif /* PKCS8_H */ 17 | -------------------------------------------------------------------------------- /src/tls/rsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RSA 3 | * Copyright (c) 2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef RSA_H 10 | #define RSA_H 11 | 12 | struct crypto_rsa_key; 13 | 14 | struct crypto_rsa_key * 15 | crypto_rsa_import_public_key(const u8 *buf, size_t len); 16 | struct crypto_rsa_key * 17 | crypto_rsa_import_public_key_parts(const u8 *n, size_t n_len, 18 | const u8 *e, size_t e_len); 19 | struct crypto_rsa_key * 20 | crypto_rsa_import_private_key(const u8 *buf, size_t len); 21 | size_t crypto_rsa_get_modulus_len(struct crypto_rsa_key *key); 22 | int crypto_rsa_exptmod(const u8 *in, size_t inlen, u8 *out, size_t *outlen, 23 | struct crypto_rsa_key *key, int use_private); 24 | void crypto_rsa_free(struct crypto_rsa_key *key); 25 | 26 | #endif /* RSA_H */ 27 | -------------------------------------------------------------------------------- /src/tls/tlsv1_cred.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TLSv1 credentials 3 | * Copyright (c) 2006-2007, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef TLSV1_CRED_H 10 | #define TLSV1_CRED_H 11 | 12 | struct tlsv1_credentials { 13 | struct x509_certificate *trusted_certs; 14 | struct x509_certificate *cert; 15 | struct crypto_private_key *key; 16 | 17 | /* Diffie-Hellman parameters */ 18 | u8 *dh_p; /* prime */ 19 | size_t dh_p_len; 20 | u8 *dh_g; /* generator */ 21 | size_t dh_g_len; 22 | }; 23 | 24 | 25 | struct tlsv1_credentials * tlsv1_cred_alloc(void); 26 | void tlsv1_cred_free(struct tlsv1_credentials *cred); 27 | int tlsv1_set_ca_cert(struct tlsv1_credentials *cred, const char *cert, 28 | const u8 *cert_blob, size_t cert_blob_len, 29 | const char *path); 30 | int tlsv1_set_cert(struct tlsv1_credentials *cred, const char *cert, 31 | const u8 *cert_blob, size_t cert_blob_len); 32 | int tlsv1_set_private_key(struct tlsv1_credentials *cred, 33 | const char *private_key, 34 | const char *private_key_passwd, 35 | const u8 *private_key_blob, 36 | size_t private_key_blob_len); 37 | int tlsv1_set_dhparams(struct tlsv1_credentials *cred, const char *dh_file, 38 | const u8 *dh_blob, size_t dh_blob_len); 39 | 40 | #endif /* TLSV1_CRED_H */ 41 | -------------------------------------------------------------------------------- /src/utils/.gitignore: -------------------------------------------------------------------------------- 1 | libutils.a 2 | -------------------------------------------------------------------------------- /src/utils/Makefile: -------------------------------------------------------------------------------- 1 | all: libutils.a 2 | 3 | clean: 4 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov libutils.a 5 | 6 | install: 7 | @echo Nothing to be made. 8 | 9 | 10 | include ../lib.rules 11 | 12 | #CFLAGS += -DWPA_TRACE 13 | CFLAGS += -DCONFIG_IPV6 14 | CFLAGS += -DCONFIG_DEBUG_FILE 15 | 16 | LIB_OBJS= \ 17 | base64.o \ 18 | bitfield.o \ 19 | common.o \ 20 | ip_addr.o \ 21 | radiotap.o \ 22 | trace.o \ 23 | uuid.o \ 24 | wpa_debug.o \ 25 | wpabuf.o 26 | 27 | # Pick correct OS wrapper implementation 28 | LIB_OBJS += os_unix.o 29 | 30 | # Pick correct event loop implementation 31 | LIB_OBJS += eloop.o 32 | 33 | # Pick correct edit implementation 34 | LIB_OBJS += edit.o 35 | 36 | #LIB_OBJS += pcsc_funcs.o 37 | 38 | libutils.a: $(LIB_OBJS) 39 | $(AR) crT $@ $? 40 | 41 | -include $(OBJS:%.o=%.d) 42 | -------------------------------------------------------------------------------- /src/utils/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Base64 encoding/decoding (RFC1341) 3 | * Copyright (c) 2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef BASE64_H 10 | #define BASE64_H 11 | 12 | unsigned char * base64_encode(const unsigned char *src, size_t len, 13 | size_t *out_len); 14 | unsigned char * base64_decode(const unsigned char *src, size_t len, 15 | size_t *out_len); 16 | 17 | #endif /* BASE64_H */ 18 | -------------------------------------------------------------------------------- /src/utils/bitfield.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Bitfield 3 | * Copyright (c) 2013, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef BITFIELD_H 10 | #define BITFIELD_H 11 | 12 | struct bitfield; 13 | 14 | struct bitfield * bitfield_alloc(size_t max_bits); 15 | void bitfield_free(struct bitfield *bf); 16 | void bitfield_set(struct bitfield *bf, size_t bit); 17 | void bitfield_clear(struct bitfield *bf, size_t bit); 18 | int bitfield_is_set(struct bitfield *bf, size_t bit); 19 | int bitfield_get_first_zero(struct bitfield *bf); 20 | 21 | #endif /* BITFIELD_H */ 22 | -------------------------------------------------------------------------------- /src/utils/browser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hotspot 2.0 client - Web browser 3 | * Copyright (c) 2013, Qualcomm Atheros, Inc. 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef BROWSER_H 10 | #define BROWSER_H 11 | 12 | #ifdef CONFIG_NO_BROWSER 13 | static inline int hs20_web_browser(const char *url) 14 | { 15 | return -1; 16 | } 17 | #else /* CONFIG_NO_BROWSER */ 18 | int hs20_web_browser(const char *url); 19 | #endif /* CONFIG_NO_BROWSER */ 20 | 21 | #endif /* BROWSER_H */ 22 | -------------------------------------------------------------------------------- /src/utils/edit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Command line editing and history 3 | * Copyright (c) 2010, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EDIT_H 10 | #define EDIT_H 11 | 12 | int edit_init(void (*cmd_cb)(void *ctx, char *cmd), 13 | void (*eof_cb)(void *ctx), 14 | char ** (*completion_cb)(void *ctx, const char *cmd, int pos), 15 | void *ctx, const char *history_file, const char *ps); 16 | void edit_deinit(const char *history_file, 17 | int (*filter_cb)(void *ctx, const char *cmd)); 18 | void edit_clear_line(void); 19 | void edit_redraw(void); 20 | 21 | #endif /* EDIT_H */ 22 | -------------------------------------------------------------------------------- /src/utils/ext_password.h: -------------------------------------------------------------------------------- 1 | /* 2 | * External password backend 3 | * Copyright (c) 2012, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EXT_PASSWORD_H 10 | #define EXT_PASSWORD_H 11 | 12 | struct ext_password_data; 13 | 14 | #ifdef CONFIG_EXT_PASSWORD 15 | 16 | struct ext_password_data * ext_password_init(const char *backend, 17 | const char *params); 18 | void ext_password_deinit(struct ext_password_data *data); 19 | 20 | struct wpabuf * ext_password_get(struct ext_password_data *data, 21 | const char *name); 22 | void ext_password_free(struct wpabuf *pw); 23 | 24 | #else /* CONFIG_EXT_PASSWORD */ 25 | 26 | #define ext_password_init(b, p) ((void *) 1) 27 | #define ext_password_deinit(d) do { } while (0) 28 | #define ext_password_get(d, n) (NULL) 29 | #define ext_password_free(p) do { } while (0) 30 | 31 | #endif /* CONFIG_EXT_PASSWORD */ 32 | 33 | #endif /* EXT_PASSWORD_H */ 34 | -------------------------------------------------------------------------------- /src/utils/ext_password_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * External password backend - internal definitions 3 | * Copyright (c) 2012, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EXT_PASSWORD_I_H 10 | #define EXT_PASSWORD_I_H 11 | 12 | #include "ext_password.h" 13 | 14 | struct ext_password_backend { 15 | const char *name; 16 | void * (*init)(const char *params); 17 | void (*deinit)(void *ctx); 18 | struct wpabuf * (*get)(void *ctx, const char *name); 19 | }; 20 | 21 | struct wpabuf * ext_password_alloc(size_t len); 22 | 23 | #endif /* EXT_PASSWORD_I_H */ 24 | -------------------------------------------------------------------------------- /src/utils/includes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_supplicant/hostapd - Default include files 3 | * Copyright (c) 2005-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | * 8 | * This header file is included into all C files so that commonly used header 9 | * files can be selected with OS specific ifdef blocks in one place instead of 10 | * having to have OS/C library specific selection in many files. 11 | */ 12 | 13 | #ifndef INCLUDES_H 14 | #define INCLUDES_H 15 | 16 | /* Include possible build time configuration before including anything else */ 17 | #include "build_config.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #ifndef _WIN32_WCE 24 | #ifndef CONFIG_TI_COMPILER 25 | #include 26 | #include 27 | #endif /* CONFIG_TI_COMPILER */ 28 | #include 29 | #endif /* _WIN32_WCE */ 30 | #include 31 | 32 | #ifndef CONFIG_TI_COMPILER 33 | #ifndef _MSC_VER 34 | #include 35 | #endif /* _MSC_VER */ 36 | #endif /* CONFIG_TI_COMPILER */ 37 | 38 | #ifndef CONFIG_NATIVE_WINDOWS 39 | #ifndef CONFIG_TI_COMPILER 40 | #include 41 | #include 42 | #include 43 | #ifndef __vxworks 44 | #include 45 | #include 46 | #endif /* __vxworks */ 47 | #endif /* CONFIG_TI_COMPILER */ 48 | #endif /* CONFIG_NATIVE_WINDOWS */ 49 | 50 | #endif /* INCLUDES_H */ 51 | -------------------------------------------------------------------------------- /src/utils/ip_addr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IP address processing 3 | * Copyright (c) 2003-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "ip_addr.h" 13 | 14 | const char * hostapd_ip_txt(const struct hostapd_ip_addr *addr, char *buf, 15 | size_t buflen) 16 | { 17 | if (buflen == 0 || addr == NULL) 18 | return NULL; 19 | 20 | if (addr->af == AF_INET) { 21 | os_strlcpy(buf, inet_ntoa(addr->u.v4), buflen); 22 | } else { 23 | buf[0] = '\0'; 24 | } 25 | #ifdef CONFIG_IPV6 26 | if (addr->af == AF_INET6) { 27 | if (inet_ntop(AF_INET6, &addr->u.v6, buf, buflen) == NULL) 28 | buf[0] = '\0'; 29 | } 30 | #endif /* CONFIG_IPV6 */ 31 | 32 | return buf; 33 | } 34 | 35 | 36 | int hostapd_parse_ip_addr(const char *txt, struct hostapd_ip_addr *addr) 37 | { 38 | #ifndef CONFIG_NATIVE_WINDOWS 39 | if (inet_aton(txt, &addr->u.v4)) { 40 | addr->af = AF_INET; 41 | return 0; 42 | } 43 | 44 | #ifdef CONFIG_IPV6 45 | if (inet_pton(AF_INET6, txt, &addr->u.v6) > 0) { 46 | addr->af = AF_INET6; 47 | return 0; 48 | } 49 | #endif /* CONFIG_IPV6 */ 50 | #endif /* CONFIG_NATIVE_WINDOWS */ 51 | 52 | return -1; 53 | } 54 | -------------------------------------------------------------------------------- /src/utils/ip_addr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IP address processing 3 | * Copyright (c) 2003-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef IP_ADDR_H 10 | #define IP_ADDR_H 11 | 12 | struct hostapd_ip_addr { 13 | int af; /* AF_INET / AF_INET6 */ 14 | union { 15 | struct in_addr v4; 16 | #ifdef CONFIG_IPV6 17 | struct in6_addr v6; 18 | #endif /* CONFIG_IPV6 */ 19 | u8 max_len[16]; 20 | } u; 21 | }; 22 | 23 | const char * hostapd_ip_txt(const struct hostapd_ip_addr *addr, char *buf, 24 | size_t buflen); 25 | int hostapd_parse_ip_addr(const char *txt, struct hostapd_ip_addr *addr); 26 | 27 | #endif /* IP_ADDR_H */ 28 | -------------------------------------------------------------------------------- /src/utils/pcsc_funcs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant / PC/SC smartcard interface for USIM, GSM SIM 3 | * Copyright (c) 2004-2006, 2012, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef PCSC_FUNCS_H 10 | #define PCSC_FUNCS_H 11 | 12 | #ifdef PCSC_FUNCS 13 | struct scard_data * scard_init(const char *reader); 14 | void scard_deinit(struct scard_data *scard); 15 | 16 | int scard_set_pin(struct scard_data *scard, const char *pin); 17 | int scard_get_imsi(struct scard_data *scard, char *imsi, size_t *len); 18 | int scard_get_mnc_len(struct scard_data *scard); 19 | int scard_gsm_auth(struct scard_data *scard, const unsigned char *_rand, 20 | unsigned char *sres, unsigned char *kc); 21 | int scard_umts_auth(struct scard_data *scard, const unsigned char *_rand, 22 | const unsigned char *autn, 23 | unsigned char *res, size_t *res_len, 24 | unsigned char *ik, unsigned char *ck, unsigned char *auts); 25 | int scard_get_pin_retry_counter(struct scard_data *scard); 26 | int scard_supports_umts(struct scard_data *scard); 27 | 28 | #else /* PCSC_FUNCS */ 29 | 30 | #define scard_init(r) NULL 31 | #define scard_deinit(s) do { } while (0) 32 | #define scard_set_pin(s, p) -1 33 | #define scard_get_imsi(s, i, l) -1 34 | #define scard_get_mnc_len(s) -1 35 | #define scard_gsm_auth(s, r, s2, k) -1 36 | #define scard_umts_auth(s, r, a, r2, rl, i, c, a2) -1 37 | #define scard_get_pin_retry_counter(s) -1 38 | #define scard_supports_umts(s) 0 39 | 40 | #endif /* PCSC_FUNCS */ 41 | 42 | #endif /* PCSC_FUNCS_H */ 43 | -------------------------------------------------------------------------------- /src/utils/platform.h: -------------------------------------------------------------------------------- 1 | #ifndef PLATFORM_H 2 | #define PLATFORM_H 3 | 4 | #include "includes.h" 5 | #include "common.h" 6 | 7 | #define le16_to_cpu le_to_host16 8 | #define le32_to_cpu le_to_host32 9 | 10 | #define get_unaligned(p) \ 11 | ({ \ 12 | struct packed_dummy_struct { \ 13 | typeof(*(p)) __val; \ 14 | } __attribute__((packed)) *__ptr = (void *) (p); \ 15 | \ 16 | __ptr->__val; \ 17 | }) 18 | #define get_unaligned_le16(p) le16_to_cpu(get_unaligned((uint16_t *)(p))) 19 | #define get_unaligned_le32(p) le32_to_cpu(get_unaligned((uint32_t *)(p))) 20 | 21 | #endif /* PLATFORM_H */ 22 | -------------------------------------------------------------------------------- /src/utils/uuid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Universally Unique IDentifier (UUID) 3 | * Copyright (c) 2008, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "uuid.h" 13 | 14 | int uuid_str2bin(const char *str, u8 *bin) 15 | { 16 | const char *pos; 17 | u8 *opos; 18 | 19 | pos = str; 20 | opos = bin; 21 | 22 | if (hexstr2bin(pos, opos, 4)) 23 | return -1; 24 | pos += 8; 25 | opos += 4; 26 | 27 | if (*pos++ != '-' || hexstr2bin(pos, opos, 2)) 28 | return -1; 29 | pos += 4; 30 | opos += 2; 31 | 32 | if (*pos++ != '-' || hexstr2bin(pos, opos, 2)) 33 | return -1; 34 | pos += 4; 35 | opos += 2; 36 | 37 | if (*pos++ != '-' || hexstr2bin(pos, opos, 2)) 38 | return -1; 39 | pos += 4; 40 | opos += 2; 41 | 42 | if (*pos++ != '-' || hexstr2bin(pos, opos, 6)) 43 | return -1; 44 | 45 | return 0; 46 | } 47 | 48 | 49 | int uuid_bin2str(const u8 *bin, char *str, size_t max_len) 50 | { 51 | int len; 52 | len = os_snprintf(str, max_len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-" 53 | "%02x%02x-%02x%02x%02x%02x%02x%02x", 54 | bin[0], bin[1], bin[2], bin[3], 55 | bin[4], bin[5], bin[6], bin[7], 56 | bin[8], bin[9], bin[10], bin[11], 57 | bin[12], bin[13], bin[14], bin[15]); 58 | if (len < 0 || (size_t) len >= max_len) 59 | return -1; 60 | return 0; 61 | } 62 | 63 | 64 | int is_nil_uuid(const u8 *uuid) 65 | { 66 | int i; 67 | for (i = 0; i < UUID_LEN; i++) 68 | if (uuid[i]) 69 | return 0; 70 | return 1; 71 | } 72 | -------------------------------------------------------------------------------- /src/utils/uuid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Universally Unique IDentifier (UUID) 3 | * Copyright (c) 2008, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef UUID_H 10 | #define UUID_H 11 | 12 | #define UUID_LEN 16 13 | 14 | int uuid_str2bin(const char *str, u8 *bin); 15 | int uuid_bin2str(const u8 *bin, char *str, size_t max_len); 16 | int is_nil_uuid(const u8 *uuid); 17 | 18 | #endif /* UUID_H */ 19 | -------------------------------------------------------------------------------- /src/wps/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | @echo Nothing to be made. 3 | 4 | clean: 5 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 6 | 7 | install: 8 | @echo Nothing to be made. 9 | -------------------------------------------------------------------------------- /src/wps/http.h: -------------------------------------------------------------------------------- 1 | /* 2 | * HTTP for WPS 3 | * Copyright (c) 2000-2003 Intel Corporation 4 | * Copyright (c) 2006-2007 Sony Corporation 5 | * Copyright (c) 2008-2009 Atheros Communications 6 | * Copyright (c) 2009, Jouni Malinen 7 | * 8 | * See wps_upnp.c for more details on licensing and code history. 9 | */ 10 | 11 | #ifndef HTTP_H 12 | #define HTTP_H 13 | 14 | enum http_reply_code { 15 | HTTP_OK = 200, 16 | HTTP_BAD_REQUEST = 400, 17 | UPNP_INVALID_ACTION = 401, 18 | UPNP_INVALID_ARGS = 402, 19 | HTTP_NOT_FOUND = 404, 20 | HTTP_PRECONDITION_FAILED = 412, 21 | HTTP_INTERNAL_SERVER_ERROR = 500, 22 | HTTP_UNIMPLEMENTED = 501, 23 | UPNP_ACTION_FAILED = 501, 24 | UPNP_ARG_VALUE_INVALID = 600, 25 | UPNP_ARG_VALUE_OUT_OF_RANGE = 601, 26 | UPNP_OUT_OF_MEMORY = 603 27 | }; 28 | 29 | #endif /* HTTP_H */ 30 | -------------------------------------------------------------------------------- /src/wps/http_client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * http_client - HTTP client 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef HTTP_CLIENT_H 10 | #define HTTP_CLIENT_H 11 | 12 | struct http_client; 13 | 14 | enum http_client_event { 15 | HTTP_CLIENT_FAILED, 16 | HTTP_CLIENT_TIMEOUT, 17 | HTTP_CLIENT_OK, 18 | HTTP_CLIENT_INVALID_REPLY, 19 | }; 20 | 21 | char * http_client_url_parse(const char *url, struct sockaddr_in *dst, 22 | char **path); 23 | struct http_client * http_client_addr(struct sockaddr_in *dst, 24 | struct wpabuf *req, size_t max_response, 25 | void (*cb)(void *ctx, 26 | struct http_client *c, 27 | enum http_client_event event), 28 | void *cb_ctx); 29 | struct http_client * http_client_url(const char *url, 30 | struct wpabuf *req, size_t max_response, 31 | void (*cb)(void *ctx, 32 | struct http_client *c, 33 | enum http_client_event event), 34 | void *cb_ctx); 35 | void http_client_free(struct http_client *c); 36 | struct wpabuf * http_client_get_body(struct http_client *c); 37 | char * http_client_get_hdr_line(struct http_client *c, const char *tag); 38 | char * http_link_update(char *url, const char *base); 39 | 40 | #endif /* HTTP_CLIENT_H */ 41 | -------------------------------------------------------------------------------- /src/wps/http_server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * http_server - HTTP server 3 | * Copyright (c) 2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef HTTP_SERVER_H 10 | #define HTTP_SERVER_H 11 | 12 | struct http_server; 13 | struct http_request; 14 | 15 | void http_request_deinit(struct http_request *req); 16 | void http_request_send(struct http_request *req, struct wpabuf *resp); 17 | void http_request_send_and_deinit(struct http_request *req, 18 | struct wpabuf *resp); 19 | enum httpread_hdr_type http_request_get_type(struct http_request *req); 20 | char * http_request_get_uri(struct http_request *req); 21 | char * http_request_get_hdr(struct http_request *req); 22 | char * http_request_get_data(struct http_request *req); 23 | char * http_request_get_hdr_line(struct http_request *req, const char *tag); 24 | struct sockaddr_in * http_request_get_cli_addr(struct http_request *req); 25 | 26 | struct http_server * http_server_init(struct in_addr *addr, int port, 27 | void (*cb)(void *ctx, 28 | struct http_request *req), 29 | void *cb_ctx); 30 | void http_server_deinit(struct http_server *srv); 31 | int http_server_get_port(struct http_server *srv); 32 | 33 | #endif /* HTTP_SERVER_H */ 34 | -------------------------------------------------------------------------------- /src/wps/upnp_xml.h: -------------------------------------------------------------------------------- 1 | /* 2 | * UPnP XML helper routines 3 | * Copyright (c) 2000-2003 Intel Corporation 4 | * Copyright (c) 2006-2007 Sony Corporation 5 | * Copyright (c) 2008-2009 Atheros Communications 6 | * Copyright (c) 2009, Jouni Malinen 7 | * 8 | * See wps_upnp.c for more details on licensing and code history. 9 | */ 10 | 11 | #ifndef UPNP_XML_H 12 | #define UPNP_XML_H 13 | 14 | #include "http.h" 15 | 16 | void xml_data_encode(struct wpabuf *buf, const char *data, int len); 17 | void xml_add_tagged_data(struct wpabuf *buf, const char *tag, 18 | const char *data); 19 | int xml_next_tag(const char *in, const char **out, 20 | const char **out_tagname, const char **end); 21 | char * xml_get_first_item(const char *doc, const char *item); 22 | struct wpabuf * xml_get_base64_item(const char *data, const char *name, 23 | enum http_reply_code *ret); 24 | 25 | #endif /* UPNP_XML_H */ 26 | -------------------------------------------------------------------------------- /src/wps/wps_upnp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * UPnP WPS Device 3 | * Copyright (c) 2000-2003 Intel Corporation 4 | * Copyright (c) 2006-2007 Sony Corporation 5 | * Copyright (c) 2008-2009 Atheros Communications 6 | * Copyright (c) 2009, Jouni Malinen 7 | * 8 | * See wps_upnp.c for more details on licensing and code history. 9 | */ 10 | 11 | #ifndef WPS_UPNP_H 12 | #define WPS_UPNP_H 13 | 14 | struct upnp_wps_device_sm; 15 | struct wps_context; 16 | struct wps_data; 17 | 18 | struct upnp_wps_peer { 19 | struct wps_data *wps; 20 | }; 21 | 22 | enum upnp_wps_wlanevent_type { 23 | UPNP_WPS_WLANEVENT_TYPE_PROBE = 1, 24 | UPNP_WPS_WLANEVENT_TYPE_EAP = 2 25 | }; 26 | 27 | struct upnp_wps_device_ctx { 28 | int (*rx_req_put_wlan_response)( 29 | void *priv, enum upnp_wps_wlanevent_type ev_type, 30 | const u8 *mac_addr, const struct wpabuf *msg, 31 | enum wps_msg_type msg_type); 32 | 33 | char *ap_pin; 34 | }; 35 | 36 | struct upnp_wps_device_sm * 37 | upnp_wps_device_init(struct upnp_wps_device_ctx *ctx, struct wps_context *wps, 38 | void *priv, char *net_if); 39 | void upnp_wps_device_deinit(struct upnp_wps_device_sm *sm, void *priv); 40 | 41 | int upnp_wps_device_send_wlan_event(struct upnp_wps_device_sm *sm, 42 | const u8 from_mac_addr[ETH_ALEN], 43 | enum upnp_wps_wlanevent_type ev_type, 44 | const struct wpabuf *msg); 45 | int upnp_wps_subscribers(struct upnp_wps_device_sm *sm); 46 | int upnp_wps_set_ap_pin(struct upnp_wps_device_sm *sm, const char *ap_pin); 47 | 48 | #endif /* WPS_UPNP_H */ 49 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | test-aes 2 | test-asn1 3 | test-base64 4 | test-https 5 | test-list 6 | test-md4 7 | test-md5 8 | test-milenage 9 | test-ms_funcs 10 | test-printf 11 | test-rc4 12 | test-sha1 13 | test-sha256 14 | test-x509 15 | test-x509v3 16 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/as.conf: -------------------------------------------------------------------------------- 1 | driver=none 2 | radius_server_clients=auth_serv/radius_clients.conf 3 | radius_server_acct_port=1813 4 | eap_server=1 5 | eap_user_file=auth_serv/eap_user.conf 6 | 7 | interface=as 8 | ctrl_interface=/var/run/hostapd 9 | ctrl_interface_group=admin 10 | 11 | ca_cert=auth_serv/ca.pem 12 | server_cert=auth_serv/server.pem 13 | private_key=auth_serv/server.key 14 | ocsp_stapling_response=auth_serv/ocsp-server-cache.der 15 | server_id=server.w1.fi 16 | eap_sim_db=unix:/tmp/hlr_auc_gw.sock 17 | dh_file=auth_serv/dh.conf 18 | pac_opaque_encr_key=000102030405060708090a0b0c0d0e0f 19 | eap_fast_a_id=101112131415161718191a1b1c1d1e1f 20 | eap_fast_a_id_info=test server 21 | eap_sim_aka_result_ind=1 22 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/as2.conf: -------------------------------------------------------------------------------- 1 | driver=none 2 | radius_server_clients=auth_serv/radius_clients.conf 3 | radius_server_auth_port=1814 4 | eap_server=1 5 | eap_user_file=auth_serv/eap_user.conf 6 | 7 | interface=as2 8 | ctrl_interface=/var/run/hostapd 9 | ctrl_interface_group=admin 10 | 11 | ca_cert=auth_serv/ca.pem 12 | server_cert=auth_serv/server.pem 13 | private_key=auth_serv/server.key 14 | ocsp_stapling_response=auth_serv/ocsp-server-cache.der 15 | server_id=server2.w1.fi 16 | eap_sim_db=unix:/tmp/hlr_auc_gw.sock db=LOGDIR/hostapd.db 17 | dh_file=auth_serv/dh.conf 18 | pac_opaque_encr_key=000102030405060708090a0b0c0d0e0f 19 | eap_fast_a_id=101112131415161718191a1b1c1d1e1f 20 | eap_fast_a_id_info=test server2 21 | eap_sim_aka_result_ind=1 22 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/ca.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/tests/hwsim/auth_serv/ca.der -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/dh.conf: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIGHAoGBAP3V8IHq3H2DUlYywsvjYNuS17eCdt0mJo6/os6PHqdhgkMrPxF9u4Gr 3 | qKXq9e6GqmZYdjta30N3FkXaV924BJ0xOqb2TntiKg4u50/l6hSUneWt6UFBaizd 4 | XrqjNFIme/5RXMZ7RglXliBpCepAaFLMcKhOS4ulUyYYHSy+oqRjAgEC 5 | -----END DH PARAMETERS----- 6 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/hlr_auc_gw.gsm: -------------------------------------------------------------------------------- 1 | # Test triplets generated with GSM-Milenage using 2 | # Ki = 90dca4eda45b53cf0f12d7c9c3bc6a89 3 | # OPc = cb9cccc4b9258e6dca4760379fb82581 4 | 5 | # GSM authentication triplet file for EAP-SIM authenticator 6 | # IMSI:Kc:SRES:RAND 7 | # IMSI: ASCII string (numbers) 8 | # Kc: hex, 8 octets 9 | # SRES: hex, 4 octets 10 | # RAND: hex, 16 octets 11 | 12 | 232010000000001:79747302dd684291:fbe55c44:d29b2f51f1fd20304ad0c447b4dcdc37 13 | 232010000000001:2f2eaa1d83e43813:6e2e3ea3:e19a8e96255b88e8a8be104637d165b2 14 | 232010000000001:b7c935bfb51f2c5a:257581f5:8079c338eb4195d0fe2d46b357979054 15 | 232010000000001:bc93df6af0412a69:dae1faa0:a48b8e2a59b8bed468ea3d57ef9ee118 16 | 232010000000001:626db3b0e9e321c3:a3e33208:38e7e65d0c0ef82185d1697410f2b31a 17 | 232010000000001:df3cab53d00c622e:0b785f5d:d8a4a9efe1689d232468f316d2a84270 18 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/hlr_auc_gw.milenage_db: -------------------------------------------------------------------------------- 1 | # Parameters for Milenage (Example algorithms for AKA). 2 | # The example Ki, OPc, and AMF values here are from 3GPP TS 35.208 v6.0.0 3 | # 4.3.20 Test Set 20. SQN is the last used SQN value. 4 | # These values can be used for both UMTS (EAP-AKA) and GSM (EAP-SIM) 5 | # authentication. In case of GSM/EAP-SIM, AMF and SQN values are not used, but 6 | # dummy values will need to be included in this file. 7 | 8 | # IMSI Ki OPc AMF SQN 9 | 232010000000000 90dca4eda45b53cf0f12d7c9c3bc6a89 cb9cccc4b9258e6dca4760379fb82581 61df 000000000000 10 | 11 | # These values are from Test Set 19 which has the AMF separation bit set to 1 12 | # and as such, is suitable for EAP-AKA' test. 13 | 555444333222111 5122250214c33e723a5dd523fc145fc0 981d464c7c52eb6e5036234984ad0bcf c3ab 16f3b3f70fc1 14 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/ocsp-server-cache.der: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/tests/hwsim/auth_serv/ocsp-server-cache.der -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/ocsp-server-cache.der-invalid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/tests/hwsim/auth_serv/ocsp-server-cache.der-invalid -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/radius_clients.conf: -------------------------------------------------------------------------------- 1 | 0.0.0.0/0 radius 2 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/radius_clients_ipv6.conf: -------------------------------------------------------------------------------- 1 | ::1 radius 2 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/server-eku-client-server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMowHv0TagIoUZoO 3 | qR5yfudayMsMfoqZgY0FswmwqYbnrkT64Mfu8xi0MWXjBW9mTuPkhYGbR39ftRYr 4 | sFmRnMVV09PKLIHO8CeoVN4OT9jwEb0LEFY4Jt+pOpUVk6YW7dIetLXAqGGOrhAE 5 | /eYmykoNkEu5rMmU8rFrl2tgJOq9AgMBAAECgYAdONdBvIyVwz4IBhZrUCEHTxe2 6 | QRgI8CbJOwmlXOMjnFiTn67dNqvr5h89mpIuh5rfVSf2k3rB7hM+IRJb36/Ik7qg 7 | GdktPSEIK/ktUcfofVLaLn+ehG7vXhkkB6juBR7jaXDZRBPvFM+TCtirlaZ5sQ0u 8 | TbSw7m9NcFD2APxgAQJBAPIoCxZCJGpMvh+5ta8EJQVQKhJeMWmDlUQvscKTauWb 9 | aTz0z+OMBGpZH7DWCTww4+/3fjqZt/TURuPSh0ZcACUCQQDVvyPTO3h3R5fig/zV 10 | NV8E0/dCYH6kwsFk0AUIRbMHdaN3sEHWszKG9nTNyPyHhDo8i9jguSjkb9MwdgR7 11 | BJC5AkBB6/bAs3bYXVXwqwyzvWwamy0o3O2UrNaIvnck4h7arMkkZ/zkFCzriqGe 12 | 8VWIRkL3A6ggadJzWwqFYL2kwMzlAkEAhfEdFgUyXCy09PEYwtKLFI9vZlzpf327 13 | it0ACksDAS2qnhoJZ+0rQH+4eiv0c0dc5wwLf+cHxP5+LOQHsr8NoQJAcsRe+KyX 14 | G0TLKZg/J5E+zJMH6M19BZ4BC32UIMTJWe1xzp+9XrCWflagRJMJ+DOWtHzu/Opo 15 | Ty4OiT0uZUxcMw== 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/server-eku-client.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKOZ6eLhF2A7cDQa 3 | dFxG47i9u6rJ8+77EjCgacN0OIA6uiNSx8Fqz7rdQePSaTWkpmBsMR+FvVZsewlj 4 | zadRa4RAkHd+l2h7OLXEFTt0NzQounri14RTeHZNFre43wly54cmdCwEysXOKfW0 5 | ztso60VHQo/tiFqjI0mbe7w54QFTAgMBAAECgYAngwCtvtc6cqCCtPDtaGGPOKOe 6 | d+/mA9U80UE551POBGD4LwH3gKhy5QUI1MR8JCvalca3akF0IfcFKYl9o3hnsZ73 7 | 3wGzxM8BEf9wEVtVC2CTRVoIupleaEk3j8dgaUs/O54WkmAoHF1avXAMSGOUDxCO 8 | Ggpn2tei78Csdj78IQJBANF7a7RaJsXh6xMI7hlrVrUsIbBvsBo1wbbGCwNRvgzL 9 | I1mq1O+Go7Aao0pDK7sOUa86j6ECZ5pzqcdPaF22tJ8CQQDH7kTy6ERBbLFxs/Wd 10 | YLDEh1GIGyGW10tuJTOl2R1TKSBXRzPAeI+jcC+AC00238p4MO899WOVeLvaERZa 11 | IuLNAkAtlxXGp4Qett9JQj1HbPPu9A7U7km+OorRM2K8MzMQZ7lmz2YORxgiwHlf 12 | NSU0TZZ7c1xE51gS5i9CAEcvdg7zAkAKIZfa20xCKHjhcyYaIIE0pErMY9uS4jwP 13 | S9FPMS5cPXRHF/OWaEWXGaM+kNQL2NFQv+IPuLSgKWsThNQmIyhtAkEAiQq1HdN7 14 | 3l8YhUuJtxg7nrh2s0V4UcSNOZxVf/85AKrTu1IfjdwmXFeoRB/y9Ef4h1bcXgzj 15 | clIVhie7r0JNLw== 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/server-expired.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANA7a4aeP7QOYEhU 3 | Tcbci7lrddDkYPChQwuv+cR3aRGEUr6efXG0qoAf6+bAN95J9IVDrk1S8+swc67m 4 | GAQUj8JjMKQM6/XWy/SvHU/WOkN4FDLe5YilNL6rmqSj3muE43iTHBwpx/xrzGjX 5 | 7sBd1z2RiIFWulQRnk7ogIPgbMrxAgMBAAECgYEArWSNSO+FRD2kVxY8HZeQkbm1 6 | xVgmkLj3x0elx79XMkrpS+lVs9UpFL+ABAmTe/pBLqcJAUJN8k3KRp066krk2QyQ 7 | uilRkugON0vBJzLse9HryXilx0aWEVl3xZBKu1E3G4mcCl2LoPaASCZtjQXd/XCd 8 | zdBR24qe123ofMpIo0ECQQDooUnHsruInBX9bRP11xXs7bI5298ZLCWHFAhGa/Tb 9 | KvVXkXnzPVYhRi2w0Leqb0lht/4GX9MB06xcHs5TLvltAkEA5SasURCjxXc7svGJ 10 | yP1s779DxYWoEBvGiRPygtyO40cnkOuupXKLaSkSuNUGag+6UxNzxGSUx9aiadse 11 | oxOJFQJAL6y2SSXZBxMt8oUDPTO6O5cvGmp0G12Px1IUrBH92VjBdRPMUUw1tZYD 12 | USRFL7mk6VDiz32d6dbukOaDVErhNQJASwnoAb/WMXLDHO0VtriudLAIbGVBTM0b 13 | rYXXs1yweeKyJTXYghtJZc1qcRZpPFAcLto+3cAmLG6vzsRPew2JpQJBAN8krD5c 14 | RYAGuXtslPkH7BWypJXI+K3brZkKBiyXVB/fbwnpXI1KTbzeBSly60JrjuymY9+X 15 | NKs5A4HSiCtQjSk= 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/server-no-dnsname.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANv8D6FIh2iGxJ56 3 | +Bgod22jWA/bvmvUQ0PEuhc3m6j/lqJzFBMcrhkPgVQ1EGSU42RlvpsLFtKekph3 4 | h+KamfwdVwyKDUwhL65n12Nh65FbWC+tZ2Zl5IMHymo2peYg9lyZJ9tj5YbYK3wd 5 | kESBIiF3CgMFw+tjYbNMMsCHhzpHAgMBAAECgYEAu0p2MDWk+4xKGDfPxBmn3JOG 6 | ZTIMhJeakTcLzLqOb6rzn+lkPQVdAH8f+AaZp1jP5OlvB2fAjZ9uZhrWeUpxMA3a 7 | TTEJqvttF1R+PjQ7hxWByPf+cFtPfJnXmJg8DuCBpc4TbPd0MMqtu37K9m41iO7K 8 | H5Lj6J+wp4lhv1Y4oaECQQDv0bvCgrGpSMLHigsdVcsFyjZr25+9y1J2Gnm1Hm/Z 9 | dbUtS9cOihYh8qh3YyGAKS5psCVzdeMXGKDN05pOhEGxAkEA6tO8Bhh+YA/oG+pl 10 | Ps9W9XjWwBCByVI+Hub6/Y9NcWckmBP+41DN1Oi7cKsSyMJ74WD5r+QYqS258tC6 11 | YDsBdwJBAJ8OEWN+XuqRsW26Joj8P7zFUrbSYO32Dej6wkHXwAMQSGuUYzvnZap6 12 | UDVub+eaaIf8JbqgM088LFqWvz7YBOECQHBlN7GTN6my812pKxyNEQoc9GypefVq 13 | L+GKnMeQN3j37UP9DhqvKlWlr1GWED+XFsQhLmFJw6P2BvJ5hTtaArECQHBSy14H 14 | 6K7lnk1UNaz4By9MOJPbHkKUl1FCrwtQ1UhJsur1pUCbud2thz4YXQh3NyJ3X0m0 15 | G3R+tt7p2kJzdlU= 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALqgd1UiFIVVZZtk 3 | LK3tm91lMcnaYFDOONY03Oi8G54w5xLjU2zJ7UgDeYFpmM6KuHdHNkXPxuDxex5x 4 | iVT3AcwiraBCsag1nmCqOphR0P8f7r6NCmP7ojkX8mRh9mUCMnl04Z/RiWVVqcMg 5 | nr9pVrP3Tz+pVMLajzyv8nVU+n6BAgMBAAECgYBH8LlvcM62QyAC0Y/DkBeINY0G 6 | wY5lN8mDESei83g196XriwPKqOA15Vj+QOVtoN3Q5PuP17NTXOLX7m5A+WKQVK/O 7 | Cl0uBCEqS9YvPN6Fp9va5VonhWxGpLdZcrxETTpxjHhVBGS9C8wBday65r2nDfo6 8 | uWlCebceUBuuSzwybQJBAOAwS7ZY8xY/bCNDzvfnNuPsPQDEQWVx6A9mv9BnepT/ 9 | 8bQcvfkUbXyWy5NsPN6yt/tqmjdbUEFAuNJlI23I2wsCQQDVG7poTL8KPa7UZge7 10 | W79FyyEoL5but1VPTAN6JJNTMpp9k2LBWFjUSmTiTkeccHfbvKxMjUuI7NQwya41 11 | hSQjAkApSRuYUBcsIK/kaqdhxeW44Zd2Xa4BZZGrzGtEkNnlOKElXympBhcHm6mP 12 | 053+EQGKvl36FcnYynd+33s/y35zAkAZ5ZC1c/4TJIPGU8/EuNV5icGxvHa+85Bu 13 | XnJduWwdxBx5/hsWG8JPqeqwhYq2PASUs0zM0K7JKN5wP1HoNxG5AkEAlaumCfLv 14 | vA/b3HVZD/b0nxkl/F7g3nACPVJ48FU2BneB+bU75zqeI3B7xGd9CKamkuutH6or 15 | fe17ZI8ZeLCLqA== 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/server.pkcs12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/tests/hwsim/auth_serv/server.pkcs12 -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/user.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAKaWLpsijN+UvouJ 3 | SfZ4dqJgfhSV85b+qxklAzRkdAE+qJ988UdhYEyCkih8K6AOy4e/WevX82EiOxTz 4 | qzH2WpUfuHq4LDypYVN4m+g+UOzC1kTnQ828Pk7nRv6SnsOYDylYyMuJAXVH6ZVX 5 | D3bFLwVexx4N8jwSY125VBmvf0BrAgMBAAECgYEAkEoS0kKJ3Hqc1IW0r6xFrX2A 6 | l1oOpCGvl1bswKuloxJfwczZu+cHHx4VdMWgj8Fg3xKJ03K4FtEsdYhdJyhn6c6G 7 | YsKF7HHGo2WA61VHxgqRB/CZzALy2JR/3rzElvrVQ5ZVh15DipNpwfwP9bW6P99A 8 | omPQVnZ3p1HgU5WK68kCQQDXHbFUYX3I9SYlR4JhPy5ov2Q8WHu4p9rWXGBO75uS 9 | 7f3FZCbGULKZEOsiVFbloyUdpvLId7wvb343a1EAOnC9AkEAxj9UqsKMAdlXTDrT 10 | 9NcQmJKWt568gEV4/45fjpTzbdndEOtCMwWBWEv/SyiWgWdwPeBViRGEyPrkLV/S 11 | teesRwJBAIfN6QuaWKyrh591W6xFFOlwGrm2KrVS0ucNfoeW4SKLOPCK36fHflj/ 12 | w1Hy6MEkk+P6Z7+DR7yyqH4YNBTu0AkCQA7uZioWTQU2oWSUabJfIFjdcYyS4A+p 13 | K9vTlU7f2RXE+ulzTqEZIQzNbIT0oaFNcR637rlMIHwiqVzhgrVApbECQQDK5QqX 14 | E6Z2VHTNEnCki9YvkgjPhLxSihQMDSaR0ENkre0OctFUufbwzH7DEhzV6CQ1Uw+9 15 | Au5AOFzcb1tfGczP 16 | -----END PRIVATE KEY----- 17 | -------------------------------------------------------------------------------- /tests/hwsim/auth_serv/user.pkcs12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/tests/hwsim/auth_serv/user.pkcs12 -------------------------------------------------------------------------------- /tests/hwsim/bss-1.conf: -------------------------------------------------------------------------------- 1 | driver=nl80211 2 | 3 | hw_mode=g 4 | channel=1 5 | ieee80211n=1 6 | 7 | interface=wlan3 8 | bssid=02:00:00:00:03:00 9 | ctrl_interface=/var/run/hostapd 10 | 11 | ssid=bss-1 12 | -------------------------------------------------------------------------------- /tests/hwsim/bss-2.conf: -------------------------------------------------------------------------------- 1 | driver=nl80211 2 | 3 | hw_mode=g 4 | channel=1 5 | ieee80211n=1 6 | 7 | interface=wlan3-2 8 | bssid=02:00:00:00:03:01 9 | ctrl_interface=/var/run/hostapd 10 | 11 | ssid=bss-2 12 | -------------------------------------------------------------------------------- /tests/hwsim/bss-3.conf: -------------------------------------------------------------------------------- 1 | driver=nl80211 2 | 3 | hw_mode=g 4 | channel=1 5 | ieee80211n=1 6 | 7 | interface=wlan3-3 8 | bssid=02:00:00:00:03:02 9 | ctrl_interface=/var/run/hostapd 10 | 11 | ssid=bss-3 12 | -------------------------------------------------------------------------------- /tests/hwsim/bss-ht40-1.conf: -------------------------------------------------------------------------------- 1 | driver=nl80211 2 | 3 | hw_mode=g 4 | channel=1 5 | ieee80211n=1 6 | ht_capab=[HT40+] 7 | 8 | interface=wlan3 9 | bssid=02:00:00:00:03:00 10 | ctrl_interface=/var/run/hostapd 11 | 12 | ssid=bss-1 13 | -------------------------------------------------------------------------------- /tests/hwsim/bss-ht40-2.conf: -------------------------------------------------------------------------------- 1 | driver=nl80211 2 | 3 | hw_mode=g 4 | channel=1 5 | ieee80211n=1 6 | ht_capab=[HT40+] 7 | 8 | interface=wlan3-2 9 | bssid=02:00:00:00:03:01 10 | ctrl_interface=/var/run/hostapd 11 | 12 | ssid=bss-2 13 | -------------------------------------------------------------------------------- /tests/hwsim/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | cd $(dirname $0) 6 | 7 | cd ../../wpa_supplicant 8 | if [ ! -e .config ]; then 9 | cp ../tests/hwsim/example-wpa_supplicant.config .config 10 | fi 11 | make clean 12 | make -j8 13 | cd ../hostapd 14 | if [ ! -e .config ]; then 15 | cp ../tests/hwsim/example-hostapd.config .config 16 | fi 17 | make clean 18 | make -j8 hostapd hlr_auc_gw 19 | cd ../wlantest 20 | make clean 21 | make -j8 22 | cd ../mac80211_hwsim/tools 23 | make clean 24 | make -j8 25 | cd ../../tests/hwsim/tnc 26 | make clean 27 | make -j8 28 | cd .. 29 | -------------------------------------------------------------------------------- /tests/hwsim/check_kernel.py: -------------------------------------------------------------------------------- 1 | # kernel message checker module 2 | # 3 | # Copyright (c) 2013, Intel Corporation 4 | # 5 | # Author: Johannes Berg 6 | # 7 | # This software may be distributed under the terms of the BSD license. 8 | # See README for more details. 9 | # 10 | """ 11 | Tests for kernel messages to find if there were any issues in them. 12 | """ 13 | 14 | import re 15 | 16 | lockdep_messages = [ 17 | 'possible circular locking dependency', 18 | '.*-safe -> .*unsafe lock order detected', 19 | 'possible recursive locking detected', 20 | 'inconsistent lock state', 21 | 'possible irq lock inversion dependency', 22 | 'suspicious RCU usage', 23 | ] 24 | lockdep = r'(\[\s*)?INFO: (%s)' % ('|'.join(lockdep_messages), ) 25 | issue = re.compile('(\[[0-9 .]*\] )?(WARNING:|BUG:|%s).*' % lockdep) 26 | 27 | def check_kernel(logfile): 28 | for line in open(logfile, 'r'): 29 | if issue.match(line): 30 | return False 31 | return True 32 | -------------------------------------------------------------------------------- /tests/hwsim/dictionary.radius: -------------------------------------------------------------------------------- 1 | ATTRIBUTE User-Name 1 string 2 | ATTRIBUTE User-Password 2 string 3 | ATTRIBUTE NAS-IP-Address 4 ipaddr 4 | ATTRIBUTE Calling-Station-Id 31 string 5 | ATTRIBUTE NAS-Identifier 32 string 6 | ATTRIBUTE Acct-Session-Id 44 string 7 | ATTRIBUTE Event-Timestamp 55 date 8 | ATTRIBUTE Message-Authenticator 80 octets 9 | ATTRIBUTE Chargeable-User-Identity 89 string 10 | ATTRIBUTE Error-Cause 101 integer 11 | -------------------------------------------------------------------------------- /tests/hwsim/hostapd.accept: -------------------------------------------------------------------------------- 1 | 02:00:00:00:00:00 1 2 | 02:00:00:00:01:00 2 3 | -------------------------------------------------------------------------------- /tests/hwsim/hostapd.macaddr: -------------------------------------------------------------------------------- 1 | 02:00:00:00:00:00 2 | 02:00:00:00:00:12 3 | 02:00:00:00:00:34 4 | -02:00:00:00:00:12 5 | -02:00:00:00:00:34 6 | -------------------------------------------------------------------------------- /tests/hwsim/hostapd.vlan: -------------------------------------------------------------------------------- 1 | 1 hwsimvlan1 2 | * testvlan# 3 | -------------------------------------------------------------------------------- /tests/hwsim/hostapd.wpa_psk: -------------------------------------------------------------------------------- 1 | 00:00:00:00:00:00 secret passphrase 2 | 02:00:00:00:00:00 very secret 3 | 00:11:22:33:44:55 another passphrase 4 | 00:22:33:44:55:66 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef 5 | 00:00:00:00:00:00 another passphrase for all STAs 6 | -------------------------------------------------------------------------------- /tests/hwsim/multi-bss-acs.conf: -------------------------------------------------------------------------------- 1 | driver=nl80211 2 | 3 | hw_mode=g 4 | channel=0 5 | ieee80211n=1 6 | 7 | interface=wlan3 8 | ctrl_interface=/var/run/hostapd 9 | 10 | ssid=bss-1 11 | 12 | bss=wlan3-2 13 | bssid=02:00:00:00:03:01 14 | ctrl_interface=/var/run/hostapd 15 | ssid=bss-2 16 | wpa=2 17 | wpa_key_mgmt=WPA-PSK 18 | rsn_pairwise=CCMP 19 | wpa_passphrase=12345678 20 | 21 | bss=wlan3-3 22 | bssid=02:00:00:00:03:02 23 | ctrl_interface=/var/run/hostapd 24 | ssid=bss-3 25 | wpa=1 26 | wpa_key_mgmt=WPA-PSK 27 | rsn_pairwise=TKIP 28 | wpa_passphrase=qwertyuiop 29 | -------------------------------------------------------------------------------- /tests/hwsim/multi-bss.conf: -------------------------------------------------------------------------------- 1 | driver=nl80211 2 | 3 | hw_mode=g 4 | channel=1 5 | ieee80211n=1 6 | 7 | interface=wlan3 8 | ctrl_interface=/var/run/hostapd 9 | 10 | ssid=bss-1 11 | 12 | 13 | bss=wlan3-2 14 | bssid=02:00:00:00:03:01 15 | ctrl_interface=/var/run/hostapd 16 | ssid=bss-2 17 | 18 | bss=wlan3-3 19 | bssid=02:00:00:00:03:02 20 | ctrl_interface=/var/run/hostapd 21 | ssid=bss-3 22 | -------------------------------------------------------------------------------- /tests/hwsim/p2p0.conf: -------------------------------------------------------------------------------- 1 | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=admin 2 | device_name=Device A 3 | p2p_no_group_iface=1 4 | -------------------------------------------------------------------------------- /tests/hwsim/p2p1.conf: -------------------------------------------------------------------------------- 1 | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=admin 2 | device_name=Device B 3 | p2p_no_group_iface=1 4 | -------------------------------------------------------------------------------- /tests/hwsim/p2p2.conf: -------------------------------------------------------------------------------- 1 | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=admin 2 | device_name=Device C 3 | p2p_no_group_iface=1 4 | -------------------------------------------------------------------------------- /tests/hwsim/run-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | errors=0 4 | umask 0002 5 | 6 | DATE="$(date +%s)" 7 | unset LOGBASEDIR 8 | if [ -z "$LOGDIR" ]; then 9 | LOGBASEDIR=logs 10 | LOGDIR=$LOGBASEDIR/$DATE 11 | mkdir -p $LOGDIR 12 | fi 13 | export LOGDIR 14 | 15 | if [ -z "$DBFILE" ]; then 16 | DB="" 17 | else 18 | DB="-S $DBFILE --commit $(git rev-parse HEAD)" 19 | if [ -n "$BUILD" ]; then 20 | DB="$DB -b $BUILD" 21 | fi 22 | if [ "$PREFILL_DB" = "y" ] ; then 23 | DB="$DB --prefill-tests" 24 | fi 25 | fi 26 | 27 | if [ "x$1" = "xvalgrind" ]; then 28 | VALGRIND=valgrind 29 | SUFFIX=-valgrind 30 | shift 31 | else 32 | unset VALGRIND 33 | SUFFIX= 34 | fi 35 | 36 | if [ "x$1" = "xtrace" ] ; then 37 | TRACE=trace 38 | SUFFIX=$SUFFIX-trace 39 | TRACE_ARGS="-T" 40 | shift 41 | else 42 | unset TRACE 43 | unset TRACE_ARGS 44 | fi 45 | 46 | if ! ./start.sh $VALGRIND $TRACE; then 47 | if ! [ -z "$LOGBASEDIR" ] ; then 48 | echo "Could not start test environment" > $LOGDIR/run 49 | fi 50 | exit 1 51 | fi 52 | 53 | ./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -q $DB $@ || errors=1 54 | 55 | ./stop.sh 56 | 57 | if [ ! -z "$VALGRIND" ] ; then 58 | failures=`grep "ERROR SUMMARY" $LOGDIR/valgrind-* | grep -v " 0 errors" | wc -l` 59 | if [ $failures -gt 0 ]; then 60 | echo "Mark as failed due to valgrind errors" 61 | errors=1 62 | fi 63 | fi 64 | if [ $errors -gt 0 ]; then 65 | tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/ 66 | exit 1 67 | fi 68 | 69 | echo "ALL-PASSED" 70 | -------------------------------------------------------------------------------- /tests/hwsim/test_cfg80211.py: -------------------------------------------------------------------------------- 1 | # cfg80211 test cases 2 | # Copyright (c) 2014, Jouni Malinen 3 | # 4 | # This software may be distributed under the terms of the BSD license. 5 | # See README for more details. 6 | 7 | import binascii 8 | 9 | import hostapd 10 | from nl80211 import * 11 | 12 | def nl80211_command(dev, cmd, attr): 13 | res = dev.request("VENDOR ffffffff {} {}".format(nl80211_cmd[cmd], 14 | binascii.hexlify(attr))) 15 | if "FAIL" in res: 16 | raise Exception("nl80211 command failed") 17 | return binascii.unhexlify(res) 18 | 19 | def test_cfg80211_disassociate(dev, apdev): 20 | """cfg80211 disassociation command""" 21 | hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" }) 22 | dev[0].connect("open", key_mgmt="NONE", scan_freq="2412") 23 | ev = hapd.wait_event([ "AP-STA-CONNECTED" ], timeout=5) 24 | if ev is None: 25 | raise Exception("No connection event received from hostapd") 26 | 27 | ifindex = int(dev[0].get_driver_status_field("ifindex")) 28 | attrs = build_nl80211_attr_u32('IFINDEX', ifindex) 29 | attrs += build_nl80211_attr_u16('REASON_CODE', 1) 30 | attrs += build_nl80211_attr_mac('MAC', apdev[0]['bssid']) 31 | nl80211_command(dev[0], 'DISASSOCIATE', attrs) 32 | 33 | ev = hapd.wait_event([ "AP-STA-DISCONNECTED" ], timeout=5) 34 | if ev is None: 35 | raise Exception("No disconnection event received from hostapd") 36 | -------------------------------------------------------------------------------- /tests/hwsim/test_module_tests.py: -------------------------------------------------------------------------------- 1 | # Module tests 2 | # Copyright (c) 2014, Jouni Malinen 3 | # 4 | # This software may be distributed under the terms of the BSD license. 5 | # See README for more details. 6 | 7 | import hostapd 8 | 9 | def test_module_wpa_supplicant(dev): 10 | """wpa_supplicant module tests""" 11 | if "OK" not in dev[0].global_request("MODULE_TESTS"): 12 | raise Exception("Module tests failed") 13 | 14 | def test_module_hostapd(dev): 15 | """hostapd module tests""" 16 | hapd_global = hostapd.HostapdGlobal() 17 | if "OK" not in hapd_global.ctrl.request("MODULE_TESTS"): 18 | raise Exception("Module tests failed") 19 | -------------------------------------------------------------------------------- /tests/hwsim/test_p2p_device.py: -------------------------------------------------------------------------------- 1 | # cfg80211 P2P Device 2 | # Copyright (c) 2013, Jouni Malinen 3 | # 4 | # This software may be distributed under the terms of the BSD license. 5 | # See README for more details. 6 | 7 | import logging 8 | logger = logging.getLogger() 9 | import time 10 | 11 | from wpasupplicant import WpaSupplicant 12 | from test_p2p_grpform import go_neg_pin_authorized 13 | from test_p2p_grpform import check_grpform_results 14 | from test_p2p_grpform import remove_group 15 | 16 | def test_p2p_device_grpform(dev, apdev): 17 | """P2P group formation with driver using cfg80211 P2P Device""" 18 | wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') 19 | wpas.interface_add("wlan5") 20 | [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, 21 | r_dev=wpas, r_intent=0) 22 | check_grpform_results(i_res, r_res) 23 | remove_group(dev[0], wpas) 24 | 25 | def test_p2p_device_grpform2(dev, apdev): 26 | """P2P group formation with driver using cfg80211 P2P Device (reverse)""" 27 | wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') 28 | wpas.interface_add("wlan5") 29 | [i_res, r_res] = go_neg_pin_authorized(i_dev=wpas, i_intent=15, 30 | r_dev=dev[0], r_intent=0) 31 | check_grpform_results(i_res, r_res) 32 | remove_group(wpas, dev[0]) 33 | -------------------------------------------------------------------------------- /tests/hwsim/tnc/.gitignore: -------------------------------------------------------------------------------- 1 | libhostap2_imc.so 2 | libhostap2_imv.so 3 | libhostap_imc.so 4 | libhostap_imv.so 5 | -------------------------------------------------------------------------------- /tests/hwsim/tnc/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS += -I$(abspath ../../../src) 2 | CFLAGS += -I$(abspath ../../../src/utils) 3 | 4 | ALL=libhostap_imc.so libhostap_imv.so libhostap2_imc.so libhostap2_imv.so 5 | all: $(ALL) 6 | 7 | lib%.so: %.c 8 | $(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $< 9 | 10 | clean: 11 | rm -f $(ALL) 12 | -------------------------------------------------------------------------------- /tests/hwsim/tnc/tnc_config: -------------------------------------------------------------------------------- 1 | IMC "hostap IMC" tnc/libhostap_imc.so 2 | IMV "hostap IMV" tnc/libhostap_imv.so 3 | IMC "hostap2 IMC" tnc/libhostap2_imc.so 4 | IMV "hostap2 IMV" tnc/libhostap2_imv.so 5 | -------------------------------------------------------------------------------- /tests/hwsim/utils.py: -------------------------------------------------------------------------------- 1 | # Testing utilities 2 | # Copyright (c) 2013, Jouni Malinen 3 | # 4 | # This software may be distributed under the terms of the BSD license. 5 | # See README for more details. 6 | 7 | def get_ifnames(): 8 | ifnames = [] 9 | with open("/proc/net/dev", "r") as f: 10 | lines = f.readlines() 11 | for l in lines: 12 | val = l.split(':', 1) 13 | if len(val) == 2: 14 | ifnames.append(val[0].strip(' ')) 15 | return ifnames 16 | -------------------------------------------------------------------------------- /tests/hwsim/vm/.gitignore: -------------------------------------------------------------------------------- 1 | vm-config 2 | -------------------------------------------------------------------------------- /tests/hwsim/vm/parallel-vm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd "$(dirname $0)" 4 | 5 | NUM=$1 6 | if [ -z "$NUM" ]; then 7 | echo "usage: $0 [params..]" 8 | exit 1 9 | fi 10 | shift 11 | 12 | LOGS=/tmp/hwsim-test-logs 13 | mkdir -p $LOGS 14 | DATE=$(date +%s) 15 | 16 | for i in `seq 1 $NUM`; do 17 | printf "\rStarting virtual machine $i/$NUM" 18 | ./vm-run.sh --ext srv.$i --split $i/$NUM $* >> $LOGS/parallel-$DATE.srv.$i 2>&1 & 19 | done 20 | echo 21 | 22 | echo "Waiting for virtual machines to complete testing" 23 | count=$NUM 24 | for i in `seq 1 $NUM`; do 25 | printf "\r$count VM(s) remaining " 26 | wait -n 27 | count=$((count-1)) 28 | done 29 | printf "\rTesting completed " 30 | echo 31 | 32 | echo -n "PASS count: " 33 | grep ^PASS $LOGS/parallel-$DATE.srv.* | wc -l 34 | cat $LOGS/parallel-$DATE.srv.* | grep FAIL | sort 35 | -------------------------------------------------------------------------------- /tests/hwsim/vm/uevent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # assume this was a call for CRDA, 4 | # if not then it won't find a COUNTRY 5 | # environment variable and exit 6 | exec crda 7 | -------------------------------------------------------------------------------- /tests/hwsim/w1fi_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/tests/hwsim/w1fi_logo.png -------------------------------------------------------------------------------- /tests/hwsim/wps-wep-cred: -------------------------------------------------------------------------------- 1 | 1&ETest('hello  -------------------------------------------------------------------------------- /tests/test-base64.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Base64 encoding/decoding (RFC1341) - test program 3 | * Copyright (c) 2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "utils/includes.h" 10 | #include "utils/os.h" 11 | #include "utils/base64.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | FILE *f; 16 | size_t len, elen; 17 | unsigned char *buf, *e; 18 | 19 | if (argc != 4) { 20 | printf("Usage: base64 \n"); 21 | return -1; 22 | } 23 | 24 | buf = (unsigned char *) os_readfile(argv[2], &len); 25 | if (buf == NULL) 26 | return -1; 27 | 28 | if (strcmp(argv[1], "encode") == 0) 29 | e = base64_encode(buf, len, &elen); 30 | else 31 | e = base64_decode(buf, len, &elen); 32 | if (e == NULL) 33 | return -2; 34 | f = fopen(argv[3], "w"); 35 | if (f == NULL) 36 | return -3; 37 | fwrite(e, 1, elen, f); 38 | fclose(f); 39 | free(e); 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /tests/test-x509.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Testing tool for X.509v3 routines 3 | * Copyright (c) 2006-2009, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "tls/x509v3.h" 13 | 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | FILE *f; 18 | u8 buf[3000]; 19 | size_t len; 20 | struct x509_certificate *cert; 21 | 22 | wpa_debug_level = 0; 23 | 24 | f = fopen(argv[1], "rb"); 25 | if (f == NULL) 26 | return -1; 27 | len = fread(buf, 1, sizeof(buf), f); 28 | fclose(f); 29 | 30 | cert = x509_certificate_parse(buf, len); 31 | if (cert == NULL) 32 | printf("Failed to parse X.509 certificate\n"); 33 | x509_certificate_free(cert); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /tests/test-x509v3.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Testing tool for X.509v3 routines 3 | * Copyright (c) 2006-2007, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "tls/asn1.h" 13 | #include "tls/x509v3.h" 14 | 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | char *buf; 19 | size_t len; 20 | struct x509_certificate *certs = NULL, *last = NULL, *cert; 21 | int i, reason; 22 | 23 | wpa_debug_level = 0; 24 | 25 | if (argc < 3 || strcmp(argv[1], "-v") != 0) { 26 | printf("usage: test_x509v3 -v ..\n"); 27 | return -1; 28 | } 29 | 30 | for (i = 2; i < argc; i++) { 31 | printf("Reading: %s\n", argv[i]); 32 | buf = os_readfile(argv[i], &len); 33 | if (buf == NULL) { 34 | printf("Failed to read '%s'\n", argv[i]); 35 | return -1; 36 | } 37 | 38 | cert = x509_certificate_parse((u8 *) buf, len); 39 | if (cert == NULL) { 40 | printf("Failed to parse X.509 certificate\n"); 41 | return -1; 42 | } 43 | 44 | free(buf); 45 | 46 | if (certs == NULL) 47 | certs = cert; 48 | else 49 | last->next = cert; 50 | last = cert; 51 | } 52 | 53 | printf("\n\nValidating certificate chain\n"); 54 | if (x509_certificate_chain_validate(last, certs, &reason, 0) < 0) { 55 | printf("\nCertificate chain validation failed: %d\n", reason); 56 | return -1; 57 | } 58 | printf("\nCertificate chain is valid\n"); 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /wpa_supplicant/.gitignore: -------------------------------------------------------------------------------- 1 | *.service 2 | -------------------------------------------------------------------------------- /wpa_supplicant/autoscan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant - auto scan 3 | * Copyright (c) 2012, Intel Corporation. All rights reserved. 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef AUTOSCAN_H 10 | #define AUTOSCAN_H 11 | 12 | struct wpa_supplicant; 13 | 14 | struct autoscan_ops { 15 | const char *name; 16 | 17 | void * (*init)(struct wpa_supplicant *wpa_s, const char *params); 18 | void (*deinit)(void *priv); 19 | 20 | int (*notify_scan)(void *priv, struct wpa_scan_results *scan_res); 21 | }; 22 | 23 | #ifdef CONFIG_AUTOSCAN 24 | 25 | int autoscan_init(struct wpa_supplicant *wpa_s, int req_scan); 26 | void autoscan_deinit(struct wpa_supplicant *wpa_s); 27 | int autoscan_notify_scan(struct wpa_supplicant *wpa_s, 28 | struct wpa_scan_results *scan_res); 29 | 30 | #else /* CONFIG_AUTOSCAN */ 31 | 32 | static inline int autoscan_init(struct wpa_supplicant *wpa_s, int req_scan) 33 | { 34 | return 0; 35 | } 36 | 37 | static inline void autoscan_deinit(struct wpa_supplicant *wpa_s) 38 | { 39 | } 40 | 41 | static inline int autoscan_notify_scan(struct wpa_supplicant *wpa_s, 42 | struct wpa_scan_results *scan_res) 43 | { 44 | return 0; 45 | } 46 | 47 | #endif /* CONFIG_AUTOSCAN */ 48 | 49 | #endif /* AUTOSCAN_H */ 50 | -------------------------------------------------------------------------------- /wpa_supplicant/blacklist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_supplicant - Temporary BSSID blacklist 3 | * Copyright (c) 2003-2007, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef BLACKLIST_H 10 | #define BLACKLIST_H 11 | 12 | struct wpa_blacklist { 13 | struct wpa_blacklist *next; 14 | u8 bssid[ETH_ALEN]; 15 | int count; 16 | }; 17 | 18 | struct wpa_blacklist * wpa_blacklist_get(struct wpa_supplicant *wpa_s, 19 | const u8 *bssid); 20 | int wpa_blacklist_add(struct wpa_supplicant *wpa_s, const u8 *bssid); 21 | int wpa_blacklist_del(struct wpa_supplicant *wpa_s, const u8 *bssid); 22 | void wpa_blacklist_clear(struct wpa_supplicant *wpa_s); 23 | 24 | #endif /* BLACKLIST_H */ 25 | -------------------------------------------------------------------------------- /wpa_supplicant/config_none.c: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant / Configuration backend: empty starting point 3 | * Copyright (c) 2003-2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | * 8 | * This file implements dummy example of a configuration backend. None of the 9 | * functions are actually implemented so this can be used as a simple 10 | * compilation test or a starting point for a new configuration backend. 11 | */ 12 | 13 | #include "includes.h" 14 | 15 | #include "common.h" 16 | #include "config.h" 17 | #include "base64.h" 18 | 19 | 20 | struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp) 21 | { 22 | struct wpa_config *config; 23 | 24 | if (name == NULL) 25 | return NULL; 26 | if (cfgp) 27 | config = cfgp; 28 | else 29 | config = wpa_config_alloc_empty(NULL, NULL); 30 | if (config == NULL) 31 | return NULL; 32 | /* TODO: fill in configuration data */ 33 | return config; 34 | } 35 | 36 | 37 | int wpa_config_write(const char *name, struct wpa_config *config) 38 | { 39 | struct wpa_ssid *ssid; 40 | struct wpa_config_blob *blob; 41 | 42 | wpa_printf(MSG_DEBUG, "Writing configuration file '%s'", name); 43 | 44 | /* TODO: write global config parameters */ 45 | 46 | 47 | for (ssid = config->ssid; ssid; ssid = ssid->next) { 48 | /* TODO: write networks */ 49 | } 50 | 51 | for (blob = config->blobs; blob; blob = blob->next) { 52 | /* TODO: write blobs */ 53 | } 54 | 55 | return 0; 56 | } 57 | -------------------------------------------------------------------------------- /wpa_supplicant/dbus/.gitignore: -------------------------------------------------------------------------------- 1 | libwpadbus.a 2 | -------------------------------------------------------------------------------- /wpa_supplicant/dbus/Makefile: -------------------------------------------------------------------------------- 1 | all: libwpadbus.a 2 | 3 | clean: 4 | rm -f *~ *.o *.d *.gcno *.gcda *.gcov 5 | rm -f libwpadbus.a 6 | 7 | install: 8 | @echo Nothing to be made. 9 | 10 | ifndef CC 11 | CC=gcc 12 | endif 13 | 14 | ifndef CFLAGS 15 | CFLAGS = -MMD -O2 -Wall -g 16 | endif 17 | 18 | PKG_CONFIG ?= pkg-config 19 | CFLAGS += -I../../src -I../../src/utils 20 | 21 | 22 | Q=@ 23 | E=echo 24 | ifeq ($(V), 1) 25 | Q= 26 | E=true 27 | endif 28 | 29 | %.o: %.c 30 | $(Q)$(CC) -c -o $@ $(CFLAGS) $< 31 | @$(E) " CC " $< 32 | 33 | 34 | ifdef CONFIG_WPS 35 | CFLAGS += -DCONFIG_WPS 36 | endif 37 | 38 | CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_NEW 39 | CFLAGS += -DCONFIG_CTRL_IFACE_DBUS 40 | 41 | ifndef DBUS_LIBS 42 | DBUS_LIBS := $(shell $(PKG_CONFIG) --libs dbus-1) 43 | endif 44 | ifndef DBUS_INCLUDE 45 | DBUS_INCLUDE := $(shell $(PKG_CONFIG) --cflags dbus-1) 46 | endif 47 | ifdef CONFIG_CTRL_IFACE_DBUS_INTRO 48 | CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_INTRO 49 | DBUS_INCLUDE += $(shell xml2-config --cflags) 50 | DBUS_LIBS += $(shell xml2-config --libs) 51 | endif 52 | 53 | CFLAGS += $(DBUS_INCLUDE) 54 | 55 | LIB_OBJS= \ 56 | dbus_common.o \ 57 | dbus_old.o \ 58 | dbus_old_handlers.o \ 59 | dbus_new.o \ 60 | dbus_new_handlers.o \ 61 | dbus_new_helpers.o \ 62 | dbus_new_introspect.o \ 63 | dbus_dict_helpers.o 64 | 65 | ifdef CONFIG_WPS 66 | LIB_OBJS += dbus_old_handlers_wps.o 67 | LIB_OBJS += dbus_new_handlers_wps.o 68 | endif 69 | 70 | libwpadbus.a: $(LIB_OBJS) 71 | $(AR) crT $@ $? 72 | 73 | -include $(OBJS:%.o=%.d) 74 | -------------------------------------------------------------------------------- /wpa_supplicant/dbus/dbus-wpa_supplicant.conf: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /wpa_supplicant/dbus/dbus_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_supplicant D-Bus control interface - common definitions 3 | * Copyright (c) 2006, Dan Williams and Red Hat, Inc. 4 | * Copyright (c) 2009, Witold Sowa 5 | * Copyright (c) 2009, Jouni Malinen 6 | * 7 | * This software may be distributed under the terms of the BSD license. 8 | * See README for more details. 9 | */ 10 | 11 | #ifndef DBUS_COMMON_H 12 | #define DBUS_COMMON_H 13 | 14 | struct wpas_dbus_priv; 15 | struct wpa_global; 16 | 17 | struct wpas_dbus_priv * wpas_dbus_init(struct wpa_global *global); 18 | void wpas_dbus_deinit(struct wpas_dbus_priv *priv); 19 | 20 | #endif /* DBUS_COMMON_H */ 21 | -------------------------------------------------------------------------------- /wpa_supplicant/dbus/dbus_common_i.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_supplicant D-Bus control interface - internal definitions 3 | * Copyright (c) 2006, Dan Williams and Red Hat, Inc. 4 | * Copyright (c) 2009, Witold Sowa 5 | * Copyright (c) 2009, Jouni Malinen 6 | * 7 | * This software may be distributed under the terms of the BSD license. 8 | * See README for more details. 9 | */ 10 | 11 | #ifndef DBUS_COMMON_I_H 12 | #define DBUS_COMMON_I_H 13 | 14 | #include 15 | 16 | struct wpas_dbus_priv { 17 | DBusConnection *con; 18 | int should_dispatch; 19 | struct wpa_global *global; 20 | u32 next_objid; 21 | int dbus_new_initialized; 22 | 23 | #if defined(CONFIG_CTRL_IFACE_DBUS_NEW) && defined(CONFIG_AP) 24 | int dbus_noc_refcnt; 25 | #endif /* CONFIG_CTRL_IFACE_DBUS_NEW && CONFIG_AP */ 26 | }; 27 | 28 | #endif /* DBUS_COMMON_I_H */ 29 | -------------------------------------------------------------------------------- /wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=fi.epitest.hostap.WPASupplicant 3 | Exec=@BINDIR@/wpa_supplicant -u 4 | User=root 5 | SystemdService=wpa_supplicant.service 6 | -------------------------------------------------------------------------------- /wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=fi.w1.wpa_supplicant1 3 | Exec=@BINDIR@/wpa_supplicant -u 4 | User=root 5 | SystemdService=wpa_supplicant.service 6 | -------------------------------------------------------------------------------- /wpa_supplicant/doc/docbook/.gitignore: -------------------------------------------------------------------------------- 1 | manpage.links 2 | manpage.refs 3 | *.8 4 | *.5 5 | *.html 6 | *.pdf 7 | -------------------------------------------------------------------------------- /wpa_supplicant/doc/docbook/Makefile: -------------------------------------------------------------------------------- 1 | all: man html pdf 2 | 3 | FILES += wpa_background 4 | FILES += wpa_cli 5 | FILES += wpa_gui 6 | FILES += wpa_passphrase 7 | FILES += wpa_priv 8 | FILES += wpa_supplicant.conf 9 | FILES += wpa_supplicant 10 | FILES += eapol_test 11 | 12 | man: 13 | for i in $(FILES); do docbook2man $$i.sgml; done 14 | 15 | html: 16 | for i in $(FILES); do docbook2html $$i.sgml && \ 17 | mv index.html $$i.html; done 18 | 19 | pdf: 20 | for i in $(FILES); do docbook2pdf $$i.sgml; done 21 | 22 | 23 | clean: 24 | rm -f wpa_background.8 wpa_cli.8 wpa_gui.8 wpa_passphrase.8 wpa_priv.8 wpa_supplicant.8 eapol_test.8 25 | rm -f wpa_supplicant.conf.5 26 | rm -f manpage.links manpage.refs 27 | rm -f $(FILES:%=%.pdf) 28 | rm -f $(FILES:%=%.html) 29 | -------------------------------------------------------------------------------- /wpa_supplicant/eap_proxy_dummy.mak: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/wpa_supplicant/eap_proxy_dummy.mak -------------------------------------------------------------------------------- /wpa_supplicant/eap_proxy_dummy.mk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vanhoefm/apbleed/32a78e257170f3adc8ad2e9f7fc3cf221721cab0/wpa_supplicant/eap_proxy_dummy.mk -------------------------------------------------------------------------------- /wpa_supplicant/example.conf: -------------------------------------------------------------------------------- 1 | network={ 2 | # 1. Filters to specify which network to test 3 | ssid="eduroam" 4 | key_mgmt=WPA-EAP 5 | 6 | # 2. Configure which RADIUS server (realm) to connect to. 7 | anonymous_identity="anonymous@example.com" 8 | 9 | # 3. Tell wpa_supp to listen at 127.0.0.1:56789 once connected 10 | eap=SOCKET 11 | } 12 | 13 | -------------------------------------------------------------------------------- /wpa_supplicant/examples/60_wpa_supplicant: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # /etc/pm/sleep.d/60_wpa_supplicant 4 | # Action script to notify wpa_supplicant of pm-action events. 5 | 6 | PATH=/sbin:/usr/sbin:/bin:/usr/bin 7 | 8 | WPACLI=wpa_cli 9 | 10 | case "$1" in 11 | suspend|hibernate) 12 | $WPACLI suspend 13 | ;; 14 | resume|thaw) 15 | $WPACLI resume 16 | ;; 17 | esac 18 | 19 | exit 0 20 | -------------------------------------------------------------------------------- /wpa_supplicant/examples/ieee8021x.conf: -------------------------------------------------------------------------------- 1 | # IEEE 802.1X with dynamic WEP keys using EAP-PEAP/MSCHAPv2 2 | 3 | ctrl_interface=/var/run/wpa_supplicant 4 | 5 | network={ 6 | ssid="example 802.1x network" 7 | key_mgmt=IEEE8021X 8 | eap=PEAP 9 | phase2="auth=MSCHAPV2" 10 | identity="user name" 11 | password="password" 12 | ca_cert="/etc/cert/ca.pem" 13 | } 14 | -------------------------------------------------------------------------------- /wpa_supplicant/examples/openCryptoki.conf: -------------------------------------------------------------------------------- 1 | # EAP-TLS using private key and certificates via OpenSSL PKCS#11 engine and 2 | # openCryptoki (e.g., with TPM token) 3 | 4 | # This example uses following PKCS#11 objects: 5 | # $ pkcs11-tool --module /usr/lib/opencryptoki/libopencryptoki.so -O -l 6 | # Please enter User PIN: 7 | # Private Key Object; RSA 8 | # label: rsakey 9 | # ID: 04 10 | # Usage: decrypt, sign, unwrap 11 | # Certificate Object, type = X.509 cert 12 | # label: ca 13 | # ID: 01 14 | # Certificate Object, type = X.509 cert 15 | # label: cert 16 | # ID: 04 17 | 18 | # Configure OpenSSL to load the PKCS#11 engine and openCryptoki module 19 | pkcs11_engine_path=/usr/lib/engines/engine_pkcs11.so 20 | pkcs11_module_path=/usr/lib/opencryptoki/libopencryptoki.so 21 | 22 | network={ 23 | ssid="test network" 24 | key_mgmt=WPA-EAP 25 | eap=TLS 26 | identity="User" 27 | 28 | # use OpenSSL PKCS#11 engine for this network 29 | engine=1 30 | engine_id="pkcs11" 31 | 32 | # select the private key and certificates based on ID (see pkcs11-tool 33 | # output above) 34 | key_id="4" 35 | cert_id="4" 36 | ca_cert_id="1" 37 | 38 | # set the PIN code; leave this out to configure the PIN to be requested 39 | # interactively when needed (e.g., via wpa_gui or wpa_cli) 40 | pin="123456" 41 | } 42 | -------------------------------------------------------------------------------- /wpa_supplicant/examples/plaintext.conf: -------------------------------------------------------------------------------- 1 | # Plaintext (no encryption) network 2 | 3 | ctrl_interface=/var/run/wpa_supplicant 4 | 5 | network={ 6 | ssid="example open network" 7 | key_mgmt=NONE 8 | } 9 | -------------------------------------------------------------------------------- /wpa_supplicant/examples/wep.conf: -------------------------------------------------------------------------------- 1 | # Static WEP keys 2 | 3 | ctrl_interface=/var/run/wpa_supplicant 4 | 5 | network={ 6 | ssid="example wep network" 7 | key_mgmt=NONE 8 | wep_key0="abcde" 9 | wep_key1=0102030405 10 | wep_tx_keyidx=0 11 | } 12 | -------------------------------------------------------------------------------- /wpa_supplicant/examples/wpa-psk-tkip.conf: -------------------------------------------------------------------------------- 1 | # WPA-PSK/TKIP 2 | 3 | ctrl_interface=/var/run/wpa_supplicant 4 | 5 | network={ 6 | ssid="example wpa-psk network" 7 | key_mgmt=WPA-PSK 8 | proto=WPA 9 | pairwise=TKIP 10 | group=TKIP 11 | psk="secret passphrase" 12 | } 13 | -------------------------------------------------------------------------------- /wpa_supplicant/examples/wpa2-eap-ccmp.conf: -------------------------------------------------------------------------------- 1 | # WPA2-EAP/CCMP using EAP-TLS 2 | 3 | ctrl_interface=/var/run/wpa_supplicant 4 | 5 | network={ 6 | ssid="example wpa2-eap network" 7 | key_mgmt=WPA-EAP 8 | proto=WPA2 9 | pairwise=CCMP 10 | group=CCMP 11 | eap=TLS 12 | ca_cert="/etc/cert/ca.pem" 13 | private_key="/etc/cert/user.p12" 14 | private_key_passwd="PKCS#12 passhrase" 15 | } 16 | -------------------------------------------------------------------------------- /wpa_supplicant/examples/wps-ap-cli: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CLI=wpa_cli 4 | 5 | pbc() 6 | { 7 | echo "Starting PBC mode" 8 | echo "Push button on the station within two minutes" 9 | if ! $CLI wps_pbc | grep -q OK; then 10 | echo "Failed to enable PBC mode" 11 | fi 12 | } 13 | 14 | enter_pin() 15 | { 16 | echo "Enter a PIN from a station to be enrolled to the network." 17 | read -p "Enrollee PIN: " pin 18 | cpin=`$CLI wps_check_pin "$pin" | tail -1` 19 | if [ "$cpin" = "FAIL-CHECKSUM" ]; then 20 | echo "Checksum digit is not valid" 21 | read -p "Do you want to use this PIN (y/n)? " resp 22 | case "$resp" in 23 | y*) 24 | cpin=`echo "$pin" | sed "s/[^1234567890]//g"` 25 | ;; 26 | *) 27 | return 1 28 | ;; 29 | esac 30 | fi 31 | if [ "$cpin" = "FAIL" ]; then 32 | echo "Invalid PIN: $pin" 33 | return 1 34 | fi 35 | echo "Enabling Enrollee PIN: $cpin" 36 | $CLI wps_pin any "$cpin" 37 | } 38 | 39 | show_config() 40 | { 41 | $CLI status wps 42 | } 43 | 44 | main_menu() 45 | { 46 | echo "WPS AP" 47 | echo "------" 48 | echo "1: Push button (activate PBC)" 49 | echo "2: Enter Enrollee PIN" 50 | echo "3: Show current configuration" 51 | echo "0: Exit wps-ap-cli" 52 | 53 | read -p "Command: " cmd 54 | 55 | case "$cmd" in 56 | 1) 57 | pbc 58 | ;; 59 | 2) 60 | enter_pin 61 | ;; 62 | 3) 63 | show_config 64 | ;; 65 | 0) 66 | exit 0 67 | ;; 68 | *) 69 | echo "Unknown command: $cmd" 70 | ;; 71 | esac 72 | 73 | echo 74 | main_menu 75 | } 76 | 77 | 78 | main_menu 79 | -------------------------------------------------------------------------------- /wpa_supplicant/interworking.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Interworking (IEEE 802.11u) 3 | * Copyright (c) 2011-2012, Qualcomm Atheros 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef INTERWORKING_H 10 | #define INTERWORKING_H 11 | 12 | enum gas_query_result; 13 | 14 | int anqp_send_req(struct wpa_supplicant *wpa_s, const u8 *dst, 15 | u16 info_ids[], size_t num_ids, u32 subtypes); 16 | void anqp_resp_cb(void *ctx, const u8 *dst, u8 dialog_token, 17 | enum gas_query_result result, 18 | const struct wpabuf *adv_proto, 19 | const struct wpabuf *resp, u16 status_code); 20 | int gas_send_request(struct wpa_supplicant *wpa_s, const u8 *dst, 21 | const struct wpabuf *adv_proto, 22 | const struct wpabuf *query); 23 | int interworking_fetch_anqp(struct wpa_supplicant *wpa_s); 24 | void interworking_stop_fetch_anqp(struct wpa_supplicant *wpa_s); 25 | int interworking_select(struct wpa_supplicant *wpa_s, int auto_select, 26 | int *freqs); 27 | int interworking_connect(struct wpa_supplicant *wpa_s, struct wpa_bss *bss); 28 | void interworking_start_fetch_anqp(struct wpa_supplicant *wpa_s); 29 | int interworking_home_sp_cred(struct wpa_supplicant *wpa_s, 30 | struct wpa_cred *cred, 31 | struct wpabuf *domain_names); 32 | int domain_name_list_contains(struct wpabuf *domain_names, 33 | const char *domain, int exact_match); 34 | 35 | #endif /* INTERWORKING_H */ 36 | -------------------------------------------------------------------------------- /wpa_supplicant/main_none.c: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant / Example program entrypoint 3 | * Copyright (c) 2003-2005, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "includes.h" 10 | 11 | #include "common.h" 12 | #include "wpa_supplicant_i.h" 13 | 14 | int main(int argc, char *argv[]) 15 | { 16 | struct wpa_interface iface; 17 | int exitcode = 0; 18 | struct wpa_params params; 19 | struct wpa_global *global; 20 | 21 | memset(¶ms, 0, sizeof(params)); 22 | params.wpa_debug_level = MSG_INFO; 23 | 24 | global = wpa_supplicant_init(¶ms); 25 | if (global == NULL) 26 | return -1; 27 | 28 | memset(&iface, 0, sizeof(iface)); 29 | /* TODO: set interface parameters */ 30 | 31 | if (wpa_supplicant_add_iface(global, &iface) == NULL) 32 | exitcode = -1; 33 | 34 | if (exitcode == 0) 35 | exitcode = wpa_supplicant_run(global); 36 | 37 | wpa_supplicant_deinit(global); 38 | 39 | return exitcode; 40 | } 41 | -------------------------------------------------------------------------------- /wpa_supplicant/offchannel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_supplicant - Off-channel Action frame TX/RX 3 | * Copyright (c) 2009-2010, Atheros Communications 4 | * Copyright (c) 2011, Qualcomm Atheros 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #ifndef OFFCHANNEL_H 11 | #define OFFCHANNEL_H 12 | 13 | int offchannel_send_action(struct wpa_supplicant *wpa_s, unsigned int freq, 14 | const u8 *dst, const u8 *src, const u8 *bssid, 15 | const u8 *buf, size_t len, unsigned int wait_time, 16 | void (*tx_cb)(struct wpa_supplicant *wpa_s, 17 | unsigned int freq, const u8 *dst, 18 | const u8 *src, const u8 *bssid, 19 | const u8 *data, size_t data_len, 20 | enum offchannel_send_action_result 21 | result), 22 | int no_cck); 23 | void offchannel_send_action_done(struct wpa_supplicant *wpa_s); 24 | void offchannel_remain_on_channel_cb(struct wpa_supplicant *wpa_s, 25 | unsigned int freq, unsigned int duration); 26 | void offchannel_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s, 27 | unsigned int freq); 28 | void offchannel_deinit(struct wpa_supplicant *wpa_s); 29 | void offchannel_send_action_tx_status( 30 | struct wpa_supplicant *wpa_s, const u8 *dst, const u8 *data, 31 | size_t data_len, enum offchannel_send_action_result result); 32 | const void * offchannel_pending_action_tx(struct wpa_supplicant *wpa_s); 33 | void offchannel_clear_pending_action_tx(struct wpa_supplicant *wpa_s); 34 | 35 | #endif /* OFFCHANNEL_H */ 36 | -------------------------------------------------------------------------------- /wpa_supplicant/systemd/wpa_supplicant-nl80211.service.arg.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=WPA supplicant daemon (interface- and nl80211 driver-specific version) 3 | Requires=sys-subsystem-net-devices-%i.device 4 | After=sys-subsystem-net-devices-%i.device 5 | 6 | # NetworkManager users will probably want the dbus version instead. 7 | 8 | [Service] 9 | Type=simple 10 | ExecStart=@BINDIR@/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-nl80211-%I.conf -Dnl80211 -i%I 11 | 12 | [Install] 13 | Alias=multi-user.target.wants/wpa_supplicant-nl80211@%i.service 14 | -------------------------------------------------------------------------------- /wpa_supplicant/systemd/wpa_supplicant-wired.service.arg.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=WPA supplicant daemon (interface- and wired driver-specific version) 3 | Requires=sys-subsystem-net-devices-%i.device 4 | After=sys-subsystem-net-devices-%i.device 5 | 6 | # NetworkManager users will probably want the dbus version instead. 7 | 8 | [Service] 9 | Type=simple 10 | ExecStart=@BINDIR@/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-wired-%I.conf -Dwired -i%I 11 | 12 | [Install] 13 | Alias=multi-user.target.wants/wpa_supplicant-wired@%i.service 14 | -------------------------------------------------------------------------------- /wpa_supplicant/systemd/wpa_supplicant.service.arg.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=WPA supplicant daemon (interface-specific version) 3 | Requires=sys-subsystem-net-devices-%i.device 4 | After=sys-subsystem-net-devices-%i.device 5 | 6 | # NetworkManager users will probably want the dbus version instead. 7 | 8 | [Service] 9 | Type=simple 10 | ExecStart=@BINDIR@/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -i%I 11 | 12 | [Install] 13 | Alias=multi-user.target.wants/wpa_supplicant@%i.service 14 | -------------------------------------------------------------------------------- /wpa_supplicant/systemd/wpa_supplicant.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=WPA supplicant 3 | 4 | [Service] 5 | Type=dbus 6 | BusName=fi.epitest.hostap.WPASupplicant 7 | ExecStart=@BINDIR@/wpa_supplicant -u 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | Alias=dbus-fi.epitest.hostap.WPASupplicant.service 12 | -------------------------------------------------------------------------------- /wpa_supplicant/tests/test_eap_sim_common.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Test program for EAP-SIM PRF 3 | * Copyright (c) 2004-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include "eap_common/eap_sim_common.c" 10 | 11 | 12 | static int test_eap_sim_prf(void) 13 | { 14 | /* http://csrc.nist.gov/encryption/dss/Examples-1024bit.pdf */ 15 | u8 xkey[] = { 16 | 0xbd, 0x02, 0x9b, 0xbe, 0x7f, 0x51, 0x96, 0x0b, 17 | 0xcf, 0x9e, 0xdb, 0x2b, 0x61, 0xf0, 0x6f, 0x0f, 18 | 0xeb, 0x5a, 0x38, 0xb6 19 | }; 20 | u8 w[] = { 21 | 0x20, 0x70, 0xb3, 0x22, 0x3d, 0xba, 0x37, 0x2f, 22 | 0xde, 0x1c, 0x0f, 0xfc, 0x7b, 0x2e, 0x3b, 0x49, 23 | 0x8b, 0x26, 0x06, 0x14, 0x3c, 0x6c, 0x18, 0xba, 24 | 0xcb, 0x0f, 0x6c, 0x55, 0xba, 0xbb, 0x13, 0x78, 25 | 0x8e, 0x20, 0xd7, 0x37, 0xa3, 0x27, 0x51, 0x16 26 | }; 27 | u8 buf[40]; 28 | 29 | printf("Testing EAP-SIM PRF (FIPS 186-2 + change notice 1)\n"); 30 | eap_sim_prf(xkey, buf, sizeof(buf)); 31 | if (memcmp(w, buf, sizeof(w)) != 0) { 32 | printf("eap_sim_prf failed\n"); 33 | return 1; 34 | } 35 | 36 | return 0; 37 | } 38 | 39 | 40 | int main(int argc, char *argv[]) 41 | { 42 | int errors = 0; 43 | 44 | errors += test_eap_sim_prf(); 45 | 46 | return errors; 47 | } 48 | -------------------------------------------------------------------------------- /wpa_supplicant/wifi_display.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_supplicant - Wi-Fi Display 3 | * Copyright (c) 2011, Atheros Communications, Inc. 4 | * Copyright (c) 2011-2012, Qualcomm Atheros, Inc. 5 | * 6 | * This software may be distributed under the terms of the BSD license. 7 | * See README for more details. 8 | */ 9 | 10 | #ifndef WIFI_DISPLAY_H 11 | #define WIFI_DISPLAY_H 12 | 13 | int wifi_display_init(struct wpa_global *global); 14 | void wifi_display_deinit(struct wpa_global *global); 15 | void wifi_display_enable(struct wpa_global *global, int enabled); 16 | int wifi_display_subelem_set(struct wpa_global *global, char *cmd); 17 | int wifi_display_subelem_get(struct wpa_global *global, char *cmd, 18 | char *buf, size_t buflen); 19 | char * wifi_display_subelem_hex(const struct wpabuf *wfd_subelems, u8 id); 20 | 21 | #endif /* WIFI_DISPLAY_H */ 22 | -------------------------------------------------------------------------------- /wpa_supplicant/win_example.reg: -------------------------------------------------------------------------------- 1 | REGEDIT4 2 | 3 | [HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant] 4 | "debug_level"=dword:00000000 5 | "debug_show_keys"=dword:00000001 6 | "debug_timestamp"=dword:00000000 7 | "debug_use_file"=dword:00000000 8 | 9 | [HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs] 10 | 11 | [HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs\test] 12 | "ap_scan"=dword:00000002 13 | "update_config"=dword:00000001 14 | "uuid"="12345678-9abc-def0-1234-56789abcdef0" 15 | "device_name"="Wireless Client" 16 | "manufacturer"="Company" 17 | "model_name"="cmodel" 18 | "serial_number"="12345" 19 | "device_type"="1-0050F204-1" 20 | "os_version"="01020300" 21 | 22 | [HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs\test\blobs] 23 | "testblob"=hex:01,02,03,04,05 24 | 25 | [HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs\test\networks] 26 | 27 | [HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs\test\networks\0000] 28 | "ssid"="\"example network\"" 29 | "key_mgmt"="WPA-PSK" 30 | "psk"="\"secret password\"" 31 | "pairwise"="CCMP" 32 | "group"="CCMP" 33 | "proto"="WPA" 34 | 35 | [HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\interfaces] 36 | 37 | [HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\interfaces\0000] 38 | "adapter"="{A7627643-C310-49E5-BD89-7E77709C04AB}" 39 | "config"="test" 40 | "ctrl_interface"="" 41 | "skip_on_error"=dword:00000000 42 | 43 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/.gitignore: -------------------------------------------------------------------------------- 1 | .moc 2 | .obj 3 | .ui 4 | qrc_icons.cpp 5 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/addinterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - AddInterface class 3 | * Copyright (c) 2008, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef ADDINTERFACE_H 10 | #define ADDINTERFACE_H 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | class WpaGui; 19 | 20 | class AddInterface : public QDialog 21 | { 22 | Q_OBJECT 23 | 24 | public: 25 | AddInterface(WpaGui *_wpagui, QWidget *parent = 0); 26 | 27 | public slots: 28 | virtual void interfaceSelected(QTreeWidgetItem *sel); 29 | 30 | private: 31 | void addInterfaces(); 32 | bool addRegistryInterface(const QString &ifname); 33 | 34 | QVBoxLayout *vboxLayout; 35 | QTreeWidget *interfaceWidget; 36 | WpaGui *wpagui; 37 | }; 38 | 39 | #endif /* ADDINTERFACE_H */ 40 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/eventhistory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - EventHistory class 3 | * Copyright (c) 2005-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef EVENTHISTORY_H 10 | #define EVENTHISTORY_H 11 | 12 | #include 13 | #include "ui_eventhistory.h" 14 | 15 | 16 | class EventListModel : public QAbstractTableModel 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | EventListModel(QObject *parent = 0) 22 | : QAbstractTableModel(parent) {} 23 | 24 | int rowCount(const QModelIndex &parent = QModelIndex()) const; 25 | int columnCount(const QModelIndex &parent = QModelIndex()) const; 26 | QVariant data(const QModelIndex &index, int role) const; 27 | QVariant headerData(int section, Qt::Orientation orientation, 28 | int role = Qt::DisplayRole) const; 29 | void addEvent(QString time, QString msg); 30 | 31 | private: 32 | QStringList timeList; 33 | QStringList msgList; 34 | }; 35 | 36 | 37 | class EventHistory : public QDialog, public Ui::EventHistory 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | EventHistory(QWidget *parent = 0, const char *name = 0, 43 | bool modal = false, Qt::WFlags fl = 0); 44 | ~EventHistory(); 45 | 46 | public slots: 47 | virtual void addEvents(WpaMsgList msgs); 48 | virtual void addEvent(WpaMsg msg); 49 | 50 | protected slots: 51 | virtual void languageChange(); 52 | 53 | private: 54 | EventListModel *elm; 55 | }; 56 | 57 | #endif /* EVENTHISTORY_H */ 58 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/icons.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/wpa_gui.svg 4 | icons/ap.svg 5 | icons/laptop.svg 6 | icons/group.svg 7 | icons/invitation.svg 8 | 9 | 10 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/icons/Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | NAMES := wpa_gui ap laptop group invitation 4 | SIZES := 16x16 22x22 32x32 48x48 64x64 128x128 5 | ICONS := $(addsuffix .png, $(foreach name, $(NAMES), $(foreach size, $(SIZES), $(size)/$(name)))) 6 | ICONS += $(addsuffix .xpm, $(NAMES)) 7 | 8 | all: $(ICONS) 9 | 10 | %.png: 11 | mkdir -p hicolor/$(word 1, $(subst /, ,$(@)))/apps/ 12 | inkscape $(subst .png,.svg, $(word 2, $(subst /, , $(@)))) --without-gui \ 13 | --export-width=$(word 1, $(subst x, , $(@))) \ 14 | --export-height=$(word 2, $(subst x, , $(subst /, , $(@)))) \ 15 | --export-png=hicolor/$(word 1, $(subst /, ,$(@)))/apps/$(word 2, $(subst /, , $@)) 16 | 17 | %.xpm: 18 | mkdir -p pixmaps/ 19 | convert hicolor/16x16/apps/$(@:.xpm=.png) pixmaps/$(@:.xpm=-16.xpm) 20 | convert hicolor/32x32/apps/$(@:.xpm=.png) pixmaps/$@ 21 | 22 | clean: 23 | $(RM) -r pixmaps hicolor 24 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/icons_png.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/hicolor/16x16/apps/wpa_gui.png 4 | icons/hicolor/32x32/apps/ap.png 5 | icons/hicolor/32x32/apps/laptop.png 6 | icons/hicolor/32x32/apps/group.png 7 | icons/hicolor/32x32/apps/invitation.png 8 | 9 | 10 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/lang/.gitignore: -------------------------------------------------------------------------------- 1 | *.qm 2 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/networkconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - NetworkConfig class 3 | * Copyright (c) 2005-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef NETWORKCONFIG_H 10 | #define NETWORKCONFIG_H 11 | 12 | #include 13 | #include "ui_networkconfig.h" 14 | 15 | class WpaGui; 16 | 17 | class NetworkConfig : public QDialog, public Ui::NetworkConfig 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | NetworkConfig(QWidget *parent = 0, const char *name = 0, 23 | bool modal = false, Qt::WFlags fl = 0); 24 | ~NetworkConfig(); 25 | 26 | virtual void paramsFromScanResults(QTreeWidgetItem *sel); 27 | virtual void setWpaGui(WpaGui *_wpagui); 28 | virtual int setNetworkParam(int id, const char *field, 29 | const char *value, bool quote); 30 | virtual void paramsFromConfig(int network_id); 31 | virtual void newNetwork(); 32 | 33 | public slots: 34 | virtual void authChanged(int sel); 35 | virtual void addNetwork(); 36 | virtual void encrChanged(const QString &sel); 37 | virtual void writeWepKey(int network_id, QLineEdit *edit, int id); 38 | virtual void removeNetwork(); 39 | virtual void eapChanged(int sel); 40 | virtual void useWps(); 41 | 42 | protected slots: 43 | virtual void languageChange(); 44 | 45 | private: 46 | WpaGui *wpagui; 47 | int edit_network_id; 48 | bool new_network; 49 | QString bssid; 50 | 51 | virtual void wepEnabled(bool enabled); 52 | virtual void getEapCapa(); 53 | }; 54 | 55 | #endif /* NETWORKCONFIG_H */ 56 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/peers.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Peers 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Peers 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | true 27 | 28 | 29 | QAbstractItemView::NoEditTriggers 30 | 31 | 32 | QListView::IconMode 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/scanresults.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - ScanResults class 3 | * Copyright (c) 2005-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef SCANRESULTS_H 10 | #define SCANRESULTS_H 11 | 12 | #include 13 | #include "ui_scanresults.h" 14 | 15 | class WpaGui; 16 | 17 | class ScanResults : public QDialog, public Ui::ScanResults 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | ScanResults(QWidget *parent = 0, const char *name = 0, 23 | bool modal = false, Qt::WFlags fl = 0); 24 | ~ScanResults(); 25 | 26 | public slots: 27 | virtual void setWpaGui(WpaGui *_wpagui); 28 | virtual void updateResults(); 29 | virtual void scanRequest(); 30 | virtual void getResults(); 31 | virtual void bssSelected(QTreeWidgetItem *sel); 32 | 33 | protected slots: 34 | virtual void languageChange(); 35 | 36 | private: 37 | WpaGui *wpagui; 38 | }; 39 | 40 | #endif /* SCANRESULTS_H */ 41 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/signalbar.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - SignalBar class 3 | * Copyright (c) 2011, Kel Modderman 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | #include "signalbar.h" 13 | 14 | 15 | SignalBar::SignalBar(QObject *parent) 16 | : QStyledItemDelegate(parent) 17 | { 18 | } 19 | 20 | 21 | SignalBar::~SignalBar() 22 | { 23 | } 24 | 25 | 26 | void SignalBar::paint(QPainter *painter, 27 | const QStyleOptionViewItem &option, 28 | const QModelIndex &index) const 29 | { 30 | QStyleOptionProgressBar opts; 31 | int signal; 32 | 33 | if (index.column() != 3) { 34 | QStyledItemDelegate::paint(painter, option, index); 35 | return; 36 | } 37 | 38 | if (index.data().toInt() > 0) 39 | signal = 0 - (256 - index.data().toInt()); 40 | else 41 | signal = index.data().toInt(); 42 | 43 | opts.minimum = -95; 44 | opts.maximum = -35; 45 | if (signal < opts.minimum) 46 | opts.progress = opts.minimum; 47 | else if (signal > opts.maximum) 48 | opts.progress = opts.maximum; 49 | else 50 | opts.progress = signal; 51 | 52 | opts.text = QString::number(signal) + " dBm"; 53 | opts.textVisible = true; 54 | opts.rect = option.rect; 55 | 56 | QApplication::style()->drawControl(QStyle::CE_ProgressBar, 57 | &opts, painter); 58 | } 59 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/signalbar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - SignalBar class 3 | * Copyright (c) 2011, Kel Modderman 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef SIGNALBAR_H 10 | #define SIGNALBAR_H 11 | 12 | #include 13 | #include 14 | 15 | class SignalBar : public QStyledItemDelegate 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | SignalBar(QObject *parent = 0); 21 | ~SignalBar(); 22 | 23 | virtual void paint(QPainter *painter, 24 | const QStyleOptionViewItem &option, 25 | const QModelIndex &index) const ; 26 | }; 27 | 28 | #endif /* SIGNALBAR_H */ 29 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/stringquery.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - StringQuery class 3 | * Copyright (c) 2009, Atheros Communications 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | #include "stringquery.h" 13 | 14 | 15 | StringQuery::StringQuery(QString label) 16 | { 17 | edit = new QLineEdit; 18 | edit->setFocus(); 19 | QGridLayout *layout = new QGridLayout; 20 | layout->addWidget(new QLabel(label), 0, 0); 21 | layout->addWidget(edit, 0, 1); 22 | setLayout(layout); 23 | 24 | connect(edit, SIGNAL(returnPressed()), this, SLOT(accept())); 25 | } 26 | 27 | 28 | QString StringQuery::get_string() 29 | { 30 | return edit->text(); 31 | } 32 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/stringquery.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - StringQuery class 3 | * Copyright (c) 2009, Atheros Communications 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef STRINGQUERY_H 10 | #define STRINGQUERY_H 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | class StringQuery : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | StringQuery(QString label); 22 | QString get_string(); 23 | 24 | private: 25 | QLineEdit *edit; 26 | }; 27 | 28 | #endif /* STRINGQUERY_H */ 29 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/userdatarequest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - UserDataRequest class 3 | * Copyright (c) 2005-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef USERDATAREQUEST_H 10 | #define USERDATAREQUEST_H 11 | 12 | #include 13 | #include "ui_userdatarequest.h" 14 | 15 | class WpaGui; 16 | 17 | class UserDataRequest : public QDialog, public Ui::UserDataRequest 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | UserDataRequest(QWidget *parent = 0, const char *name = 0, 23 | bool modal = false, Qt::WFlags fl = 0); 24 | ~UserDataRequest(); 25 | 26 | int setParams(WpaGui *_wpagui, const char *reqMsg); 27 | 28 | public slots: 29 | virtual void sendReply(); 30 | 31 | protected slots: 32 | virtual void languageChange(); 33 | 34 | private: 35 | WpaGui *wpagui; 36 | int networkid; 37 | QString field; 38 | }; 39 | 40 | #endif /* USERDATAREQUEST_H */ 41 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/wpa_gui.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Name=wpa_gui 4 | Comment=Graphical user interface for wpa_supplicant 5 | Exec=wpa_gui 6 | Icon=wpa_gui 7 | GenericName=wpa_supplicant user interface 8 | Terminal=false 9 | Type=Application 10 | Categories=Qt;Network; 11 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_gui-qt4/wpamsg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wpa_gui - WpaMsg class for storing event messages 3 | * Copyright (c) 2005-2006, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef WPAMSG_H 10 | #define WPAMSG_H 11 | 12 | #include 13 | #include 14 | 15 | class WpaMsg { 16 | public: 17 | WpaMsg(const QString &_msg, int _priority = 2) 18 | : msg(_msg), priority(_priority) 19 | { 20 | timestamp = QDateTime::currentDateTime(); 21 | } 22 | 23 | QString getMsg() const { return msg; } 24 | int getPriority() const { return priority; } 25 | QDateTime getTimestamp() const { return timestamp; } 26 | 27 | private: 28 | QString msg; 29 | int priority; 30 | QDateTime timestamp; 31 | }; 32 | 33 | typedef QLinkedList WpaMsgList; 34 | 35 | #endif /* WPAMSG_H */ 36 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_supplicant_conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2010 The Android Open Source Project 3 | # 4 | # This software may be distributed under the terms of the BSD license. 5 | # See README for more details. 6 | # 7 | 8 | # Include this makefile to generate your hardware specific wpa_supplicant.conf 9 | # Requires: WIFI_DRIVER_SOCKET_IFACE 10 | 11 | LOCAL_PATH := $(call my-dir) 12 | 13 | ######################## 14 | include $(CLEAR_VARS) 15 | 16 | LOCAL_MODULE := wpa_supplicant.conf 17 | LOCAL_MODULE_CLASS := ETC 18 | LOCAL_MODULE_TAGS := optional 19 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/wifi 20 | 21 | include $(BUILD_SYSTEM)/base_rules.mk 22 | 23 | WPA_SUPPLICANT_CONF_TEMPLATE := $(LOCAL_PATH)/wpa_supplicant_template.conf 24 | WPA_SUPPLICANT_CONF_SCRIPT := $(LOCAL_PATH)/wpa_supplicant_conf.sh 25 | $(LOCAL_BUILT_MODULE): PRIVATE_WIFI_DRIVER_SOCKET_IFACE := $(WIFI_DRIVER_SOCKET_IFACE) 26 | $(LOCAL_BUILT_MODULE): PRIVATE_WPA_SUPPLICANT_CONF_TEMPLATE := $(WPA_SUPPLICANT_CONF_TEMPLATE) 27 | $(LOCAL_BUILT_MODULE): PRIVATE_WPA_SUPPLICANT_CONF_SCRIPT := $(WPA_SUPPLICANT_CONF_SCRIPT) 28 | $(LOCAL_BUILT_MODULE) : $(WPA_SUPPLICANT_CONF_TEMPLATE) $(WPA_SUPPLICANT_CONF_SCRIPT) 29 | @echo Target wpa_supplicant.conf: $@ 30 | @mkdir -p $(dir $@) 31 | $(hide) WIFI_DRIVER_SOCKET_IFACE="$(PRIVATE_WIFI_DRIVER_SOCKET_IFACE)" \ 32 | bash $(PRIVATE_WPA_SUPPLICANT_CONF_SCRIPT) $(PRIVATE_WPA_SUPPLICANT_CONF_TEMPLATE) > $@ 33 | 34 | ######################## 35 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_supplicant_conf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2010 The Android Open Source Project 4 | # 5 | # This software may be distributed under the terms of the BSD license. 6 | # See README for more details. 7 | # 8 | 9 | # Generate a wpa_supplicant.conf from the template. 10 | # $1: the template file name 11 | if [ -n "$WIFI_DRIVER_SOCKET_IFACE" ] 12 | then 13 | sed -e 's/#.*$//' -e 's/[ \t]*$//' -e '/^$/d' < $1 | sed -e "s/wlan0/$WIFI_DRIVER_SOCKET_IFACE/" 14 | else 15 | sed -e 's/#.*$//' -e 's/[ \t]*$//' -e '/^$/d' < $1 16 | fi 17 | -------------------------------------------------------------------------------- /wpa_supplicant/wpa_supplicant_template.conf: -------------------------------------------------------------------------------- 1 | ##### wpa_supplicant configuration file template ##### 2 | update_config=1 3 | ctrl_interface=wlan0 4 | eapol_version=1 5 | ap_scan=1 6 | fast_reauth=1 7 | -------------------------------------------------------------------------------- /wpa_supplicant/wpas_glue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * WPA Supplicant - Glue code to setup EAPOL and RSN modules 3 | * Copyright (c) 2003-2008, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef WPAS_GLUE_H 10 | #define WPAS_GLUE_H 11 | 12 | enum wpa_ctrl_req_type; 13 | 14 | int wpa_supplicant_init_eapol(struct wpa_supplicant *wpa_s); 15 | int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s); 16 | void wpa_supplicant_rsn_supp_set_config(struct wpa_supplicant *wpa_s, 17 | struct wpa_ssid *ssid); 18 | 19 | const char * wpa_supplicant_ctrl_req_to_string(enum wpa_ctrl_req_type field, 20 | const char *default_txt, 21 | const char **txt); 22 | 23 | enum wpa_ctrl_req_type wpa_supplicant_ctrl_req_from_string(const char *field); 24 | 25 | #endif /* WPAS_GLUE_H */ 26 | -------------------------------------------------------------------------------- /wpa_supplicant/wpas_kay.h: -------------------------------------------------------------------------------- 1 | /* 2 | * IEEE 802.1X-2010 KaY Interface 3 | * Copyright (c) 2013-2014, Qualcomm Atheros, Inc. 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | #ifndef WPAS_KAY_H 10 | #define WPAS_KAY_H 11 | 12 | #ifdef CONFIG_MACSEC 13 | 14 | int ieee802_1x_alloc_kay_sm(struct wpa_supplicant *wpa_s, 15 | struct wpa_ssid *ssid); 16 | void * ieee802_1x_notify_create_actor(struct wpa_supplicant *wpa_s, 17 | const u8 *peer_addr); 18 | void ieee802_1x_dealloc_kay_sm(struct wpa_supplicant *wpa_s); 19 | 20 | #else /* CONFIG_MACSEC */ 21 | 22 | static inline int ieee802_1x_alloc_kay_sm(struct wpa_supplicant *wpa_s, 23 | struct wpa_ssid *ssid) 24 | { 25 | return 0; 26 | } 27 | 28 | static inline void * 29 | ieee802_1x_notify_create_actor(struct wpa_supplicant *wpa_s, 30 | const u8 *peer_addr) 31 | { 32 | return NULL; 33 | } 34 | 35 | static inline void ieee802_1x_dealloc_kay_sm(struct wpa_supplicant *wpa_s) 36 | { 37 | } 38 | 39 | #endif /* CONFIG_MACSEC */ 40 | 41 | #endif /* WPAS_KAY_H */ 42 | -------------------------------------------------------------------------------- /wpadebug/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /wpadebug/project.properties: -------------------------------------------------------------------------------- 1 | # Project target. 2 | target=android-17 3 | -------------------------------------------------------------------------------- /wpadebug/res/raw/shell_commands.txt: -------------------------------------------------------------------------------- 1 | id@id 2 | version@cat /proc/version 3 | -------------------------------------------------------------------------------- /wpadebug/res/raw/wpa_commands.txt: -------------------------------------------------------------------------------- 1 | Status@STATUS 2 | PMKSA cache@PMKSA 3 | Networks@LIST_NETWORKS 4 | Interworking connect@INTERWORKING_SELECT auto 5 | Creds@LIST_CREDS 6 | Scan results@SCAN_RESULTS 7 | Flush@FLUSH 8 | Disconnect@DISCONNECT 9 | Reassociate@REASSOCIATE 10 | -------------------------------------------------------------------------------- /wpadebug/src/w1/fi/wpadebug/DisplayMessageActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * wpadebug - wpa_supplicant and Wi-Fi debugging app for Android 3 | * Copyright (c) 2013, Jouni Malinen 4 | * 5 | * This software may be distributed under the terms of the BSD license. 6 | * See README for more details. 7 | */ 8 | 9 | package w1.fi.wpadebug; 10 | 11 | import android.app.Activity; 12 | import android.os.Bundle; 13 | import android.os.Parcelable; 14 | import android.view.MenuItem; 15 | import android.content.Intent; 16 | import android.widget.TextView; 17 | import android.text.method.ScrollingMovementMethod; 18 | import android.util.Log; 19 | 20 | public class DisplayMessageActivity extends Activity 21 | { 22 | private static final String TAG = "wpadebug"; 23 | 24 | String byteArrayHex(byte[] a) { 25 | StringBuilder sb = new StringBuilder(); 26 | for (byte b: a) 27 | sb.append(String.format("%02x", b)); 28 | return sb.toString(); 29 | } 30 | 31 | @Override 32 | public void onCreate(Bundle savedInstanceState) 33 | { 34 | Log.d(TAG, "onCreate"); 35 | super.onCreate(savedInstanceState); 36 | 37 | // Get the message from the intent 38 | Intent intent = getIntent(); 39 | String action = intent.getAction(); 40 | Log.d(TAG, "onCreate: action=" + action); 41 | 42 | String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); 43 | 44 | TextView textView = new TextView(this); 45 | textView.setText(message); 46 | textView.setMovementMethod(new ScrollingMovementMethod()); 47 | setContentView(textView); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /wpaspy/Makefile: -------------------------------------------------------------------------------- 1 | all: build 2 | 3 | SRC=wpaspy.c 4 | 5 | build: $(SRC) setup.py 6 | python setup.py build 7 | 8 | install: 9 | python setup.py install 10 | 11 | clean: 12 | python setup.py clean 13 | rm -f *~ 14 | rm -rf build 15 | -------------------------------------------------------------------------------- /wpaspy/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Python bindings for wpa_ctrl (wpa_supplicant/hostapd control interface) 4 | # Copyright (c) 2013, Jouni Malinen 5 | # 6 | # This software may be distributed under the terms of the BSD license. 7 | # See README for more details. 8 | 9 | from distutils.core import setup, Extension 10 | 11 | ext = Extension(name = 'wpaspy', 12 | sources = ['../src/common/wpa_ctrl.c', 13 | '../src/utils/os_unix.c', 14 | 'wpaspy.c'], 15 | extra_compile_args = ["-I../src/common", 16 | "-I../src/utils", 17 | "-DCONFIG_CTRL_IFACE", 18 | "-DCONFIG_CTRL_IFACE_UNIX"]) 19 | 20 | setup(name = 'wpaspy', 21 | ext_modules = [ext], 22 | description = 'Python bindings for wpa_ctrl (wpa_supplicant/hostapd)') 23 | --------------------------------------------------------------------------------