Lines Matching refs:wps

21 int wps_build_public_key(struct wps_data *wps, struct wpabuf *msg)
26 wpabuf_free(wps->dh_privkey);
27 wps->dh_privkey = NULL;
28 if (wps->dev_pw_id != DEV_PW_DEFAULT && wps->wps->dh_privkey &&
29 wps->wps->dh_ctx) {
31 if (wps->wps->dh_pubkey == NULL) {
33 "WPS: wps->wps->dh_pubkey == NULL");
36 wps->dh_privkey = wpabuf_dup(wps->wps->dh_privkey);
37 wps->dh_ctx = wps->wps->dh_ctx;
38 wps->wps->dh_ctx = NULL;
39 pubkey = wpabuf_dup(wps->wps->dh_pubkey);
41 } else if (wps->dev_pw_id >= 0x10 && wps->wps->ap &&
42 wps->dev_pw_id == wps->wps->ap_nfc_dev_pw_id) {
44 if (wps->wps->ap_nfc_dh_privkey == NULL) {
46 "WPS: wps->wps->ap_nfc_dh_privkey == NULL");
49 if (wps->wps->ap_nfc_dh_pubkey == NULL) {
51 "WPS: wps->wps->ap_nfc_dh_pubkey == NULL");
54 wps->dh_privkey = wpabuf_dup(wps->wps->ap_nfc_dh_privkey);
55 pubkey = wpabuf_dup(wps->wps->ap_nfc_dh_pubkey);
56 wps->dh_ctx = dh5_init_fixed(wps->dh_privkey, pubkey);
60 dh5_free(wps->dh_ctx);
61 wps->dh_ctx = dh5_init(&wps->dh_privkey, &pubkey);
64 if (wps->dh_ctx == NULL || wps->dh_privkey == NULL || pubkey == NULL) {
70 wpa_hexdump_buf_key(MSG_DEBUG, "WPS: DH Private Key", wps->dh_privkey);
77 if (wps->registrar) {
78 wpabuf_free(wps->dh_pubkey_r);
79 wps->dh_pubkey_r = pubkey;
81 wpabuf_free(wps->dh_pubkey_e);
82 wps->dh_pubkey_e = pubkey;
149 int wps_build_authenticator(struct wps_data *wps, struct wpabuf *msg)
155 if (wps->last_msg == NULL) {
164 addr[0] = wpabuf_head(wps->last_msg);
165 len[0] = wpabuf_len(wps->last_msg);
168 hmac_sha256_vector(wps->authkey, WPS_AUTHKEY_LEN, 2, addr, len, hash);
254 int wps_build_enrollee_nonce(struct wps_data *wps, struct wpabuf *msg)
259 wpabuf_put_data(msg, wps->nonce_e, WPS_NONCE_LEN);
264 int wps_build_registrar_nonce(struct wps_data *wps, struct wpabuf *msg)
269 wpabuf_put_data(msg, wps->nonce_r, WPS_NONCE_LEN);
274 int wps_build_auth_type_flags(struct wps_data *wps, struct wpabuf *msg)
288 int wps_build_encr_type_flags(struct wps_data *wps, struct wpabuf *msg)
302 int wps_build_conn_type_flags(struct wps_data *wps, struct wpabuf *msg)
312 int wps_build_assoc_state(struct wps_data *wps, struct wpabuf *msg)
322 int wps_build_key_wrap_auth(struct wps_data *wps, struct wpabuf *msg)
327 hmac_sha256(wps->authkey, WPS_AUTHKEY_LEN, wpabuf_head(msg),
337 int wps_build_encr_settings(struct wps_data *wps, struct wpabuf *msg,
359 if (aes_128_cbc_encrypt(wps->keywrapkey, iv, data, wpabuf_len(plain)))