return -1;
}
+ /*
+ * Update PMK in wpa_sm and the driver if roamed to WPA/WPA2 PSK from a
+ * different AKM.
+ */
+ if (wpa_s->key_mgmt != ie.key_mgmt &&
+ wpa_key_mgmt_wpa_psk_no_sae(ie.key_mgmt)) {
+ if (!ssid->psk_set) {
+ wpa_dbg(wpa_s, MSG_INFO,
+ "No PSK available for association");
+ wpas_auth_failed(wpa_s, "NO_PSK_AVAILABLE");
+ return -1;
+ }
+
+ wpa_sm_set_pmk(wpa_s->wpa, ssid->psk, PMK_LEN, NULL, NULL);
+ if (wpa_s->conf->key_mgmt_offload &&
+ (wpa_s->drv_flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD) &&
+ wpa_drv_set_key(wpa_s, 0, NULL, 0, 0, NULL, 0, ssid->psk,
+ PMK_LEN, KEY_FLAG_PMK))
+ wpa_dbg(wpa_s, MSG_ERROR,
+ "WPA: Cannot set PMK for key management offload");
+ }
+
wpa_s->key_mgmt = ie.key_mgmt;
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_KEY_MGMT, wpa_s->key_mgmt);
wpa_dbg(wpa_s, MSG_DEBUG, "WPA: using KEY_MGMT %s and proto %d",