os_free(pasn->rsnxe_ie);
wpabuf_free(pasn->frame);
os_free(pasn->pasn_groups);
+ wpabuf_free(pasn->auth1);
bin_clear_free(pasn, sizeof(struct pasn_data));
}
#ifdef CONFIG_SAE
#include "common/sae.h"
#endif /* CONFIG_SAE */
-#include "crypto/sha384.h"
#ifdef __cplusplus
extern "C" {
bool using_pmksa;
enum rsn_hash_alg hash_alg;
- u8 hash[SHA384_MAC_LEN];
+ struct wpabuf *auth1;
struct wpabuf *beacon_rsne_rsnxe;
struct wpa_ptk ptk;
#include "common/ieee802_11_defs.h"
#include "common/dragonfly.h"
#include "crypto/sha384.h"
+#include "crypto/sha512.h"
#include "crypto/crypto.h"
#include "crypto/random.h"
#include "eap_common/eap_defs.h"
struct wpabuf *buf, *pubkey = NULL, *wrapped_data_buf = NULL;
const u8 *pmkid;
u8 wrapped_data;
- int ret;
wpa_printf(MSG_DEBUG, "PASN: Building frame 1");
wpa_pasn_add_extra_ies(buf, pasn->extra_ies, pasn->extra_ies_len);
- ret = pasn_auth_frame_hash(pasn->akmp, pasn->cipher,
- wpabuf_head_u8(buf) + IEEE80211_HDRLEN,
- wpabuf_len(buf) - IEEE80211_HDRLEN,
- pasn->hash);
- if (ret) {
- wpa_printf(MSG_DEBUG, "PASN: Failed to compute hash");
+ wpabuf_free(pasn->auth1);
+ pasn->auth1 = wpabuf_alloc_copy(wpabuf_head_u8(buf) + IEEE80211_HDRLEN,
+ wpabuf_len(buf) - IEEE80211_HDRLEN);
+ if (!pasn->auth1) {
+ wpa_printf(MSG_DEBUG, "PASN: Failed to store a copy of Auth1");
goto fail;
}
u8 *ptr;
u8 wrapped_data;
int ret;
+ u8 hash[SHA512_MAC_LEN];
wpa_printf(MSG_DEBUG, "PASN: Building frame 3");
data = wpabuf_head_u8(buf) + IEEE80211_HDRLEN;
data_len = wpabuf_len(buf) - IEEE80211_HDRLEN;
+ if (!pasn->auth1 ||
+ pasn_auth_frame_hash(pasn->akmp, pasn->cipher,
+ wpabuf_head(pasn->auth1),
+ wpabuf_len(pasn->auth1), hash)) {
+ wpa_printf(MSG_INFO, "PASN: Failed to calculate Auth1 hash");
+ goto fail;
+ }
+
ret = pasn_mic(pasn->ptk.kck, pasn->akmp, pasn->cipher,
pasn->own_addr, pasn->peer_addr,
- pasn->hash, mic_len * 2, data, data_len, mic);
+ hash, mic_len * 2, data, data_len, mic);
if (ret) {
wpa_printf(MSG_DEBUG, "PASN: frame 3: Failed MIC calculation");
goto fail;
forced_memzero(pasn->pmk, sizeof(pasn->pmk));
forced_memzero(&pasn->ptk, sizeof(pasn->ptk));
- forced_memzero(&pasn->hash, sizeof(pasn->hash));
+
+ wpabuf_free(pasn->auth1);
+ pasn->auth1 = NULL;
wpabuf_free(pasn->beacon_rsne_rsnxe);
pasn->beacon_rsne_rsnxe = NULL;
wpabuf_free(pasn->frame);
pasn->frame = NULL;
+
+ wpabuf_free(pasn->auth1);
+ pasn->auth1 = NULL;
}
#include "common/ieee802_11_defs.h"
#include "crypto/sha384.h"
#include "crypto/sha256.h"
+#include "crypto/sha512.h"
#include "crypto/random.h"
#include "crypto/crypto.h"
#include "ap/hostapd.h"
pasn->wrapped_data_format = pasn_params.wrapped_data_format;
- ret = pasn_auth_frame_hash(pasn->akmp, pasn->cipher,
- ((const u8 *) mgmt) + IEEE80211_HDRLEN,
- len - IEEE80211_HDRLEN, pasn->hash);
- if (ret) {
- wpa_printf(MSG_DEBUG, "PASN: Failed to compute hash");
+ wpabuf_free(pasn->auth1);
+ pasn->auth1 = wpabuf_alloc_copy(((const u8 *) mgmt) + IEEE80211_HDRLEN,
+ len - IEEE80211_HDRLEN);
+ if (!pasn->auth1) {
+ wpa_printf(MSG_DEBUG, "PASN: Failed to store a copy of Auth1");
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
goto send_resp;
}
goto send_resp;
}
- ret = pasn_auth_frame_hash(pasn->akmp, pasn->cipher,
- ((const u8 *) mgmt) + IEEE80211_HDRLEN,
- len - IEEE80211_HDRLEN, pasn->hash);
- if (ret) {
- wpa_printf(MSG_DEBUG, "PASN: Failed to compute hash");
+ wpabuf_free(pasn->auth1);
+ pasn->auth1 = wpabuf_alloc_copy(((const u8 *) mgmt) + IEEE80211_HDRLEN,
+ len - IEEE80211_HDRLEN);
+ if (!pasn->auth1) {
+ wpa_printf(MSG_DEBUG, "PASN: Failed to store a copy of Auth1");
status = WLAN_STATUS_UNSPECIFIED_FAILURE;
}
int ret;
u8 *copy = NULL;
size_t copy_len, mic_offset;
+ u8 hash[SHA512_MAC_LEN];
if (ieee802_11_parse_elems(mgmt->u.auth.variable,
len - offsetof(struct ieee80211_mgmt,
if (!copy)
goto fail;
os_memset(copy + mic_offset, 0, mic_len);
+ if (!pasn->auth1 ||
+ pasn_auth_frame_hash(pasn->akmp, pasn->cipher,
+ wpabuf_head(pasn->auth1),
+ wpabuf_len(pasn->auth1), hash)) {
+ wpa_printf(MSG_INFO, "PASN: Failed to calculate Auth1 hash");
+ goto fail;
+ }
ret = pasn_mic(pasn->ptk.kck, pasn->akmp, pasn->cipher,
peer_addr, own_addr,
- pasn->hash, mic_len * 2,
+ hash, mic_len * 2,
copy, copy_len, out_mic);
os_free(copy);
copy = NULL;