diff options
| author | jsing <> | 2020-05-09 08:26:16 +0000 |
|---|---|---|
| committer | jsing <> | 2020-05-09 08:26:16 +0000 |
| commit | 6ea83f22d7db50fd60106a752e515e8b9dbf0d49 (patch) | |
| tree | 6b4ef5b8dfbe3c9c7dd8aab19f2df4199e98fc00 /src/lib/libssl/tls13_server.c | |
| parent | aa8b13ca9d4cbeef9f9ae64522dc2c55318be32e (diff) | |
| download | openbsd-6ea83f22d7db50fd60106a752e515e8b9dbf0d49.tar.gz openbsd-6ea83f22d7db50fd60106a752e515e8b9dbf0d49.tar.bz2 openbsd-6ea83f22d7db50fd60106a752e515e8b9dbf0d49.zip | |
Refactor tls13_server_hello_sent().
Split the record protection engagement code into a separate
tls13_server_engage_record_protection() function and call this from
tls13_server_hello_sent(). Also move some functions around to keep the
logical ordering/grouping.
ok inoguchi@ tb@ (as part of a larger diff)
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/tls13_server.c | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/src/lib/libssl/tls13_server.c b/src/lib/libssl/tls13_server.c index 4fa1aba31d..19ee2e9eaa 100644 --- a/src/lib/libssl/tls13_server.c +++ b/src/lib/libssl/tls13_server.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_server.c,v 1.34 2020/04/28 20:37:22 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_server.c,v 1.35 2020/05/09 08:26:16 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2019, 2020 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2020 Bob Beck <beck@openbsd.org> |
| @@ -242,35 +242,8 @@ err: | |||
| 242 | return 0; | 242 | return 0; |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | int | 245 | static int |
| 246 | tls13_server_hello_retry_request_send(struct tls13_ctx *ctx, CBB *cbb) | 246 | tls13_server_engage_record_protection(struct tls13_ctx *ctx) |
| 247 | { | ||
| 248 | return 0; | ||
| 249 | } | ||
| 250 | |||
| 251 | int | ||
| 252 | tls13_client_hello_retry_recv(struct tls13_ctx *ctx, CBS *cbs) | ||
| 253 | { | ||
| 254 | return 0; | ||
| 255 | } | ||
| 256 | |||
| 257 | int | ||
| 258 | tls13_server_hello_send(struct tls13_ctx *ctx, CBB *cbb) | ||
| 259 | { | ||
| 260 | if (ctx->hs->key_share == NULL) | ||
| 261 | return 0; | ||
| 262 | |||
| 263 | if (!tls13_key_share_generate(ctx->hs->key_share)) | ||
| 264 | return 0; | ||
| 265 | |||
| 266 | if (!tls13_server_hello_build(ctx, cbb)) | ||
| 267 | return 0; | ||
| 268 | |||
| 269 | return 1; | ||
| 270 | } | ||
| 271 | |||
| 272 | int | ||
| 273 | tls13_server_hello_sent(struct tls13_ctx *ctx) | ||
| 274 | { | 247 | { |
| 275 | struct tls13_secrets *secrets; | 248 | struct tls13_secrets *secrets; |
| 276 | struct tls13_secret context; | 249 | struct tls13_secret context; |
| @@ -338,6 +311,39 @@ tls13_server_hello_sent(struct tls13_ctx *ctx) | |||
| 338 | } | 311 | } |
| 339 | 312 | ||
| 340 | int | 313 | int |
| 314 | tls13_server_hello_retry_request_send(struct tls13_ctx *ctx, CBB *cbb) | ||
| 315 | { | ||
| 316 | return 0; | ||
| 317 | } | ||
| 318 | |||
| 319 | int | ||
| 320 | tls13_client_hello_retry_recv(struct tls13_ctx *ctx, CBS *cbs) | ||
| 321 | { | ||
| 322 | return 0; | ||
| 323 | } | ||
| 324 | |||
| 325 | int | ||
| 326 | tls13_server_hello_send(struct tls13_ctx *ctx, CBB *cbb) | ||
| 327 | { | ||
| 328 | if (ctx->hs->key_share == NULL) | ||
| 329 | return 0; | ||
| 330 | |||
| 331 | if (!tls13_key_share_generate(ctx->hs->key_share)) | ||
| 332 | return 0; | ||
| 333 | |||
| 334 | if (!tls13_server_hello_build(ctx, cbb)) | ||
| 335 | return 0; | ||
| 336 | |||
| 337 | return 1; | ||
| 338 | } | ||
| 339 | |||
| 340 | int | ||
| 341 | tls13_server_hello_sent(struct tls13_ctx *ctx) | ||
| 342 | { | ||
| 343 | return tls13_server_engage_record_protection(ctx); | ||
| 344 | } | ||
| 345 | |||
| 346 | int | ||
| 341 | tls13_server_encrypted_extensions_send(struct tls13_ctx *ctx, CBB *cbb) | 347 | tls13_server_encrypted_extensions_send(struct tls13_ctx *ctx, CBB *cbb) |
| 342 | { | 348 | { |
| 343 | if (!tlsext_server_build(ctx->ssl, cbb, SSL_TLSEXT_MSG_EE)) | 349 | if (!tlsext_server_build(ctx->ssl, cbb, SSL_TLSEXT_MSG_EE)) |
