mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-09 06:59:08 +02:00
processAnswer advanced the exchange to stateAwaitingRekey before init.Finish derived the PSK. A rekey firing in that window chained the next offer off an exchange whose key was not yet committed, letting the responder commit PSK N+1 before this side committed PSK N; a lost next answer then left the two peers on different PSKs. Move to an intermediate stateFinishing while deriving (OnDataPathRekeyed chains only on stateAwaitingRekey, so it will not chain mid-derive), and advance to stateAwaitingRekey only after Finish succeeds and the exchange is still current. Found in cubic review on #7098 (client/internal/pqkem/convergence.go:194).