Skip to content

Commit

Permalink
Clear old messages from queues in order to avoid leaks of record laye…
Browse files Browse the repository at this point in the history
…r objects.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #22275)
  • Loading branch information
fwh-dc authored and mattcaswell committed May 10, 2024
1 parent 35306a2 commit e1bd225
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ssl/tls13_enc.c
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions test/tls13secretstest.c
Expand Up @@ -229,6 +229,14 @@ int ssl_set_new_record_layer(SSL_CONNECTION *s, int version, int direction,
return 0;
}

void dtls1_clear_received_buffer(SSL_CONNECTION *s)
{
}

void dtls1_clear_sent_buffer(SSL_CONNECTION *s)
{
}

/* End of mocked out code */

static int test_secret(SSL_CONNECTION *s, unsigned char *prk,
Expand Down

0 comments on commit e1bd225

Please sign in to comment.