@@ -767,6 +767,32 @@ bool handshake_state_get_pmkid(struct handshake_state *s, uint8_t *out_pmkid,
use_sha256);
}
+bool handshake_state_pmkid_matches(struct handshake_state *s,
+ const uint8_t *check)
+{
+ uint8_t own_pmkid[16];
+
+ if (!handshake_state_get_pmkid(s, own_pmkid, false))
+ return false;
+
+ if (l_secure_memcmp(own_pmkid, check, 16)) {
+ if (s->akm_suite != IE_RSN_AKM_SUITE_FT_OVER_8021X)
+ return false;
+ /*
+ * Recent hostapd versions (commit b6d3fd05e3) changed the PMKID
+ * derivation for the FT-8021x AKM to use SHA256. This may be
+ * the issue here so try the SHA1 derivation before giving up.
+ */
+
+ if (!handshake_state_get_pmkid(s, own_pmkid, true))
+ return false;
+
+ return l_secure_memcmp(own_pmkid, check, 16) == 0;
+ }
+
+ return true;
+}
+
void handshake_state_set_gtk(struct handshake_state *s, const uint8_t *key,
unsigned int key_index, const uint8_t *rsc)
{
@@ -271,7 +271,8 @@ void handshake_state_override_pairwise_cipher(struct handshake_state *s,
bool handshake_state_get_pmkid(struct handshake_state *s, uint8_t *out_pmkid,
bool force_sha1);
-
+bool handshake_state_pmkid_matches(struct handshake_state *s,
+ const uint8_t *check);
bool handshake_decode_fte_key(struct handshake_state *s, const uint8_t *wrapped,
size_t key_len, uint8_t *key_out);