Clear old messages from queues in order to avoid leaks of record layer objects.

This commit is contained in:
Frederik Wedel-Heinen 2024-05-07 21:18:44 +02:00
parent 28e5302333
commit 6adbb3057d
No known key found for this signature in database
GPG Key ID: 74AA1921C20CC949
1 changed files with 8 additions and 0 deletions

View File

@ -719,6 +719,14 @@ int tls13_change_cipher_state(SSL_CONNECTION *s, int which)
? OSSL_RECORD_PROTECTION_LEVEL_HANDSHAKE
: OSSL_RECORD_PROTECTION_LEVEL_APPLICATION);
if (SSL_CONNECTION_IS_DTLS(s)) {
/* We have moved to the next flight lets clear out old messages */
if (direction == OSSL_RECORD_DIRECTION_READ)
dtls1_clear_received_buffer(s);
else
dtls1_clear_sent_buffer(s);
}
if (!ssl_set_new_record_layer(s, s->version,
direction,
level, secret, hashlen, key, keylen, iv,