Fix ordinary Noise handshake races

This commit is contained in:
jack
2026-07-26 12:21:38 +02:00
committed by jack
parent 3b7c590df4
commit 52e753eee2
10 changed files with 1850 additions and 129 deletions
@@ -112,6 +112,14 @@ final class BLENoisePacketHandler {
didEstablishAuthenticatedSession:
result.didEstablishAuthenticatedSession
)
} catch let managedFailure as NoiseManagedHandshakeFailure {
SecureLogger.error(
"Failed to process handshake; manager owns recovery: \(managedFailure.underlying)"
)
return BLENoiseHandshakeHandlingResult(
processed: false,
didEstablishAuthenticatedSession: false
)
} catch NoiseSessionError.peerIdentityMismatch {
// The responder was already discarded by the session manager.
// Do not let a spoofed claimed ID trigger a fresh outbound