diff options
author | jsing <> | 2020-04-06 16:28:38 +0000 |
---|---|---|
committer | jsing <> | 2020-04-06 16:28:38 +0000 |
commit | 88624381b593bd2db75613e1f49fca6f4df14ca6 (patch) | |
tree | 1eb9c8dd37bebc561e4ab5e44a07512449452c27 | |
parent | 7f8e8fe1e230faa3cc552993d35440645f6eae82 (diff) | |
download | openbsd-88624381b593bd2db75613e1f49fca6f4df14ca6.tar.gz openbsd-88624381b593bd2db75613e1f49fca6f4df14ca6.tar.bz2 openbsd-88624381b593bd2db75613e1f49fca6f4df14ca6.zip |
Send a zero-length session identifier if TLSv1.3 is not enabled.
If the maximum version is less than TLSv1.3, send a zero-length session
identifier (matching the behaviour of the legacy TLS stack), rather than
a 32 byte random identifier. The 32 byte random identifier is only needed
for "compatibility" mode in TLSv1.3.
ok beck@
-rw-r--r-- | src/lib/libssl/tls13_client.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/libssl/tls13_client.c b/src/lib/libssl/tls13_client.c index 078730111a..82fc50ed9e 100644 --- a/src/lib/libssl/tls13_client.c +++ b/src/lib/libssl/tls13_client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_client.c,v 1.46 2020/03/10 17:23:25 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_client.c,v 1.47 2020/04/06 16:28:38 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -177,9 +177,12 @@ tls13_client_hello_build(struct tls13_ctx *ctx, CBB *cbb) | |||
177 | goto err; | 177 | goto err; |
178 | 178 | ||
179 | /* Either 32-random bytes or zero length... */ | 179 | /* Either 32-random bytes or zero length... */ |
180 | arc4random_buf(ctx->hs->legacy_session_id, | 180 | if (ctx->hs->max_version >= TLS1_3_VERSION) { |
181 | sizeof(ctx->hs->legacy_session_id)); | 181 | arc4random_buf(ctx->hs->legacy_session_id, |
182 | ctx->hs->legacy_session_id_len = sizeof(ctx->hs->legacy_session_id); | 182 | sizeof(ctx->hs->legacy_session_id)); |
183 | ctx->hs->legacy_session_id_len = | ||
184 | sizeof(ctx->hs->legacy_session_id); | ||
185 | } | ||
183 | 186 | ||
184 | if (!CBB_add_u8_length_prefixed(cbb, &session_id)) | 187 | if (!CBB_add_u8_length_prefixed(cbb, &session_id)) |
185 | goto err; | 188 | goto err; |