mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
QUIC: Extract reset_crypto() function
This commit is contained in:
parent
c19e79246f
commit
39d0610ce1
1 changed files with 12 additions and 10 deletions
|
@ -34,6 +34,17 @@ function can_decrypt(long_header: LongHeaderPacket, context: Context, crypto: Cr
|
||||||
return ! crypto.finished;
|
return ! crypto.finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reset_crypto(context: Context&) {
|
||||||
|
# Recreate all the crypto state on the next %init of Packet.
|
||||||
|
zeek::protocol_handle_close(context.ssl_handle);
|
||||||
|
unset context.ssl_handle;
|
||||||
|
context.client_crypto = Null;
|
||||||
|
context.server_crypto = Null;
|
||||||
|
context.client_sink = Null;
|
||||||
|
context.server_sink = Null;
|
||||||
|
context.initial_destination_conn_id = Null;
|
||||||
|
}
|
||||||
|
|
||||||
# This unit is connected with the server and client sinks receiving
|
# This unit is connected with the server and client sinks receiving
|
||||||
# CRYPTO frames and forwards data to the SSL handle in the context.
|
# CRYPTO frames and forwards data to the SSL handle in the context.
|
||||||
type CryptoSinkUnit = unit(is_orig: bool, context: Context&) {
|
type CryptoSinkUnit = unit(is_orig: bool, context: Context&) {
|
||||||
|
@ -535,19 +546,10 @@ type Packet = unit(from_client: bool, context: Context&) {
|
||||||
# If we see a retry packet from the responder, reset the decryption
|
# If we see a retry packet from the responder, reset the decryption
|
||||||
# context such that the next DCID from the client is used for decryption.
|
# context such that the next DCID from the client is used for decryption.
|
||||||
if ( self.long_header.is_retry ) {
|
if ( self.long_header.is_retry ) {
|
||||||
|
reset_crypto(context);
|
||||||
|
|
||||||
# Recreate all the crypto state on the next %init of Packet.
|
|
||||||
zeek::protocol_handle_close(context.ssl_handle);
|
|
||||||
unset context.ssl_handle;
|
|
||||||
context.client_crypto = Null;
|
|
||||||
context.server_crypto = Null;
|
|
||||||
context.client_sink = Null;
|
|
||||||
context.server_sink = Null;
|
|
||||||
self.crypto = Null;
|
self.crypto = Null;
|
||||||
self.crypto_sink = Null;
|
self.crypto_sink = Null;
|
||||||
|
|
||||||
# Reset crypto state!
|
|
||||||
context.initial_destination_conn_id = Null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue