summaryrefslogtreecommitdiff
path: root/src/lib/libssl/tls13_handshake.c
diff options
context:
space:
mode:
authorjsing <>2019-01-21 13:45:57 +0000
committerjsing <>2019-01-21 13:45:57 +0000
commitc06f6f3e478fe1e9e0a1f1601f983e3d55479ed3 (patch)
tree14969b4304a48b9fdbf41d756aec5076c5ac5d69 /src/lib/libssl/tls13_handshake.c
parentbde3ac13e78ee3960e9e0340d4af51a79ada0aa6 (diff)
downloadopenbsd-c06f6f3e478fe1e9e0a1f1601f983e3d55479ed3.tar.gz
openbsd-c06f6f3e478fe1e9e0a1f1601f983e3d55479ed3.tar.bz2
openbsd-c06f6f3e478fe1e9e0a1f1601f983e3d55479ed3.zip
Provide the initial TLSv1.3 client implementation.
Move tls13_connect() to a new tls13_client.c file and provide a legacy wrapper to it, which allocates a struct tls_ctx if necessary. Also move tls13_client_hello_send() to tls13_client.c and actual implement the building of a client hello. ok tb@
Diffstat (limited to 'src/lib/libssl/tls13_handshake.c')
-rw-r--r--src/lib/libssl/tls13_handshake.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/lib/libssl/tls13_handshake.c b/src/lib/libssl/tls13_handshake.c
index 78f5611b70..160202421c 100644
--- a/src/lib/libssl/tls13_handshake.c
+++ b/src/lib/libssl/tls13_handshake.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls13_handshake.c,v 1.17 2019/01/21 13:13:46 jsing Exp $ */ 1/* $OpenBSD: tls13_handshake.c,v 1.18 2019/01/21 13:45:57 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018-2019 Theo Buehler <tb@openbsd.org>
4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
@@ -31,11 +31,7 @@
31struct tls13_handshake_action { 31struct tls13_handshake_action {
32 uint8_t record_type; 32 uint8_t record_type;
33 uint8_t handshake_type; 33 uint8_t handshake_type;
34
35 uint8_t sender; 34 uint8_t sender;
36#define TLS13_HS_CLIENT 1
37#define TLS13_HS_SERVER 2
38
39 uint8_t handshake_complete; 35 uint8_t handshake_complete;
40 36
41 int (*send)(struct tls13_ctx *ctx); 37 int (*send)(struct tls13_ctx *ctx);
@@ -44,7 +40,6 @@ struct tls13_handshake_action {
44 40
45enum tls13_message_type tls13_handshake_active_state(struct tls13_ctx *ctx); 41enum tls13_message_type tls13_handshake_active_state(struct tls13_ctx *ctx);
46 42
47int tls13_connect(struct tls13_ctx *ctx);
48int tls13_accept(struct tls13_ctx *ctx); 43int tls13_accept(struct tls13_ctx *ctx);
49 44
50struct tls13_handshake_action * 45struct tls13_handshake_action *
@@ -313,14 +308,6 @@ tls13_handshake_perform(struct tls13_ctx *ctx)
313} 308}
314 309
315int 310int
316tls13_connect(struct tls13_ctx *ctx)
317{
318 ctx->mode = TLS13_HS_CLIENT;
319
320 return tls13_handshake_perform(ctx);
321}
322
323int
324tls13_accept(struct tls13_ctx *ctx) 311tls13_accept(struct tls13_ctx *ctx)
325{ 312{
326 ctx->mode = TLS13_HS_SERVER; 313 ctx->mode = TLS13_HS_SERVER;
@@ -391,13 +378,13 @@ tls13_handshake_recv_action(struct tls13_ctx *ctx,
391 return TLS13_IO_FAILURE; 378 return TLS13_IO_FAILURE;
392 } 379 }
393 380
394 return action->recv(ctx); 381 /* XXX provide CBS and check all consumed. */
395} 382 ret = action->recv(ctx);
396 383
397int 384 tls13_handshake_msg_free(ctx->hs_msg);
398tls13_client_hello_send(struct tls13_ctx *ctx) 385 ctx->hs_msg = NULL;
399{ 386
400 return 0; 387 return ret;
401} 388}
402 389
403int 390int