hostapd: Avoid key reinstallation in FT handshake

Do not reinstall TK to the driver during Reassociation Response frame
processing if the first attempt of setting the TK succeeded. This avoids
issues related to clearing the TX/RX PN that could result in reusing
same PN values for transmitted frames (e.g., due to CCM nonce reuse and
also hitting replay protection on the receiver) and accepting replayed
frames on RX side.

This issue was introduced by the commit
0e84c25434e6a1f283c7b4e62e483729085b78d2 ('FT: Fix PTK configuration in
authenticator') which allowed wpa_ft_install_ptk() to be called multiple
times with the same PTK. While the second configuration attempt is
needed with some drivers, it must be done only if the first attempt

Bug: 65245581
Test: WiFi integration tests
Change-Id: I9d60b25a655eeb2dc19694e49d2f34d537849a13
Merged-In: Ieb2913762eef0ea49a7c6b3b0782e709653f96bb
Signed-off-by: Mathy Vanhoef <>
Signed-off-by: Glen Kuhne <>
(cherry picked from commit e3db9d2d56c7c07c3632bab770bbcb3f881c1ee2)
5 files changed