[PATCH 0/2] Explicitly clear PTK derivation and MSK/CAK buffers
Jouni Malinen
j at w1.fi
Mon Nov 23 03:33:21 PST 2026
On Mon, Nov 23, 2026 at 12:19:36AM -0800, Xiaoyi Suo wrote:
> This series changes two places that clear keys with os_memset().
> Nothing reads the buffers after the clear, so the compiler can drop the
> clear. GCC 13.3 and Clang 18 do drop it at -O2.
>
> 1/2 wpa_pmk_to_ptk(): tmp[] holds the new KCK, KEK, TK and KDK. data[]
> holds the addresses, the nonces, and the optional Z value (DHss for
> 802.1X auth in Authentication frames, or the DPP shared secret). After
> the clear, both buffers still hold their data. The same file already
> uses forced_memzero() for the same kind of buffer in pasn_pmk_to_ptk()
> and wpa_pmk_r1_to_ptk().
>
> 2/2 ieee802_1x_notify_create_actor(): the EAP MSK and the CAK built from
> it are cleared on the error path, then freed. The compiler drops that
> clear too. The MSK is still in the heap block when free() is called.
>
> Both patches are hardening. They remove the extra copy that stays in
> memory. They do not fix a known read-back path.
Thanks, applied.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list