summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2020-05-09 08:26:16 +0000
committerjsing <>2020-05-09 08:26:16 +0000
commitf24566acbbda3181c4df6cca6398328022a3f7c9 (patch)
tree6b4ef5b8dfbe3c9c7dd8aab19f2df4199e98fc00 /src/lib
parent978cde8ed27c6004531f660175ec12b94bb514ed (diff)
downloadopenbsd-f24566acbbda3181c4df6cca6398328022a3f7c9.tar.gz
openbsd-f24566acbbda3181c4df6cca6398328022a3f7c9.tar.bz2
openbsd-f24566acbbda3181c4df6cca6398328022a3f7c9.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 'src/lib')
-rw-r--r--src/lib/libssl/tls13_server.c66
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
245int 245static int
246tls13_server_hello_retry_request_send(struct tls13_ctx *ctx, CBB *cbb) 246tls13_server_engage_record_protection(struct tls13_ctx *ctx)
247{
248 return 0;
249}
250
251int
252tls13_client_hello_retry_recv(struct tls13_ctx *ctx, CBS *cbs)
253{
254 return 0;
255}
256
257int
258tls13_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
272int
273tls13_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
340int 313int
314tls13_server_hello_retry_request_send(struct tls13_ctx *ctx, CBB *cbb)
315{
316 return 0;
317}
318
319int
320tls13_client_hello_retry_recv(struct tls13_ctx *ctx, CBS *cbs)
321{
322 return 0;
323}
324
325int
326tls13_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
340int
341tls13_server_hello_sent(struct tls13_ctx *ctx)
342{
343 return tls13_server_engage_record_protection(ctx);
344}
345
346int
341tls13_server_encrypted_extensions_send(struct tls13_ctx *ctx, CBB *cbb) 347tls13_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))