diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libssl/tls13_handshake_msg.c | 8 | ||||
| -rw-r--r-- | src/lib/libssl/tls13_internal.h | 5 | ||||
| -rw-r--r-- | src/lib/libssl/tls13_lib.c | 17 | ||||
| -rw-r--r-- | src/lib/libssl/tls13_record_layer.c | 4 | ||||
| -rw-r--r-- | src/lib/libssl/tls_buffer.c | 11 | ||||
| -rw-r--r-- | src/lib/libssl/tls_internal.h | 3 |
6 files changed, 14 insertions, 34 deletions
diff --git a/src/lib/libssl/tls13_handshake_msg.c b/src/lib/libssl/tls13_handshake_msg.c index 67eab3152f..946ccaccd6 100644 --- a/src/lib/libssl/tls13_handshake_msg.c +++ b/src/lib/libssl/tls13_handshake_msg.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_handshake_msg.c,v 1.4 2021/10/23 13:12:14 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_handshake_msg.c,v 1.5 2022/07/20 06:32:24 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 | * |
| @@ -71,12 +71,6 @@ tls13_handshake_msg_data(struct tls13_handshake_msg *msg, CBS *cbs) | |||
| 71 | CBS_init(cbs, msg->data, msg->data_len); | 71 | CBS_init(cbs, msg->data, msg->data_len); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | int | ||
| 75 | tls13_handshake_msg_set_buffer(struct tls13_handshake_msg *msg, CBS *cbs) | ||
| 76 | { | ||
| 77 | return tls_buffer_set_data(msg->buf, cbs); | ||
| 78 | } | ||
| 79 | |||
| 80 | uint8_t | 74 | uint8_t |
| 81 | tls13_handshake_msg_type(struct tls13_handshake_msg *msg) | 75 | tls13_handshake_msg_type(struct tls13_handshake_msg *msg) |
| 82 | { | 76 | { |
diff --git a/src/lib/libssl/tls13_internal.h b/src/lib/libssl/tls13_internal.h index 555dd4262e..599eb200cb 100644 --- a/src/lib/libssl/tls13_internal.h +++ b/src/lib/libssl/tls13_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_internal.h,v 1.98 2022/07/17 15:49:20 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_internal.h,v 1.99 2022/07/20 06:32:24 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2018 Bob Beck <beck@openbsd.org> |
| 4 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> |
| @@ -88,7 +88,7 @@ __BEGIN_HIDDEN_DECLS | |||
| 88 | #define TLS13_INFO_CONNECT_EXIT SSL_CB_CONNECT_EXIT | 88 | #define TLS13_INFO_CONNECT_EXIT SSL_CB_CONNECT_EXIT |
| 89 | 89 | ||
| 90 | typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg); | 90 | typedef void (*tls13_alert_cb)(uint8_t _alert_desc, void *_cb_arg); |
| 91 | typedef ssize_t (*tls13_phh_recv_cb)(void *_cb_arg, CBS *_cbs); | 91 | typedef ssize_t (*tls13_phh_recv_cb)(void *_cb_arg); |
| 92 | typedef void (*tls13_phh_sent_cb)(void *_cb_arg); | 92 | typedef void (*tls13_phh_sent_cb)(void *_cb_arg); |
| 93 | typedef void (*tls13_handshake_message_cb)(void *_cb_arg); | 93 | typedef void (*tls13_handshake_message_cb)(void *_cb_arg); |
| 94 | typedef void (*tls13_info_cb)(void *_cb_arg, int _state, int _ret); | 94 | typedef void (*tls13_info_cb)(void *_cb_arg, int _state, int _ret); |
| @@ -226,7 +226,6 @@ struct tls13_handshake_msg; | |||
| 226 | struct tls13_handshake_msg *tls13_handshake_msg_new(void); | 226 | struct tls13_handshake_msg *tls13_handshake_msg_new(void); |
| 227 | void tls13_handshake_msg_free(struct tls13_handshake_msg *msg); | 227 | void tls13_handshake_msg_free(struct tls13_handshake_msg *msg); |
| 228 | void tls13_handshake_msg_data(struct tls13_handshake_msg *msg, CBS *cbs); | 228 | void tls13_handshake_msg_data(struct tls13_handshake_msg *msg, CBS *cbs); |
| 229 | int tls13_handshake_msg_set_buffer(struct tls13_handshake_msg *msg, CBS *cbs); | ||
| 230 | uint8_t tls13_handshake_msg_type(struct tls13_handshake_msg *msg); | 229 | uint8_t tls13_handshake_msg_type(struct tls13_handshake_msg *msg); |
| 231 | int tls13_handshake_msg_content(struct tls13_handshake_msg *msg, CBS *cbs); | 230 | int tls13_handshake_msg_content(struct tls13_handshake_msg *msg, CBS *cbs); |
| 232 | int tls13_handshake_msg_start(struct tls13_handshake_msg *msg, CBB *body, | 231 | int tls13_handshake_msg_start(struct tls13_handshake_msg *msg, CBB *body, |
diff --git a/src/lib/libssl/tls13_lib.c b/src/lib/libssl/tls13_lib.c index 8b28bf55a4..8d0e030b5a 100644 --- a/src/lib/libssl/tls13_lib.c +++ b/src/lib/libssl/tls13_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_lib.c,v 1.66 2022/07/20 06:20:44 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_lib.c,v 1.67 2022/07/20 06:32:24 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 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2019 Bob Beck <beck@openbsd.org> |
| @@ -338,11 +338,11 @@ tls13_phh_done_cb(void *cb_arg) | |||
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | static ssize_t | 340 | static ssize_t |
| 341 | tls13_phh_received_cb(void *cb_arg, CBS *cbs) | 341 | tls13_phh_received_cb(void *cb_arg) |
| 342 | { | 342 | { |
| 343 | ssize_t ret = TLS13_IO_FAILURE; | 343 | ssize_t ret = TLS13_IO_FAILURE; |
| 344 | struct tls13_ctx *ctx = cb_arg; | 344 | struct tls13_ctx *ctx = cb_arg; |
| 345 | CBS phh_cbs; | 345 | CBS cbs; |
| 346 | 346 | ||
| 347 | if (!tls13_phh_limit_check(ctx)) | 347 | if (!tls13_phh_limit_check(ctx)) |
| 348 | return tls13_send_alert(ctx->rl, TLS13_ALERT_UNEXPECTED_MESSAGE); | 348 | return tls13_send_alert(ctx->rl, TLS13_ALERT_UNEXPECTED_MESSAGE); |
| @@ -351,19 +351,16 @@ tls13_phh_received_cb(void *cb_arg, CBS *cbs) | |||
| 351 | ((ctx->hs_msg = tls13_handshake_msg_new()) == NULL)) | 351 | ((ctx->hs_msg = tls13_handshake_msg_new()) == NULL)) |
| 352 | return TLS13_IO_FAILURE; | 352 | return TLS13_IO_FAILURE; |
| 353 | 353 | ||
| 354 | if (!tls13_handshake_msg_set_buffer(ctx->hs_msg, cbs)) | 354 | if ((ret = tls13_handshake_msg_recv(ctx->hs_msg, ctx->rl)) != |
| 355 | return TLS13_IO_FAILURE; | 355 | TLS13_IO_SUCCESS) |
| 356 | |||
| 357 | if ((ret = tls13_handshake_msg_recv(ctx->hs_msg, ctx->rl)) | ||
| 358 | != TLS13_IO_SUCCESS) | ||
| 359 | return ret; | 356 | return ret; |
| 360 | 357 | ||
| 361 | if (!tls13_handshake_msg_content(ctx->hs_msg, &phh_cbs)) | 358 | if (!tls13_handshake_msg_content(ctx->hs_msg, &cbs)) |
| 362 | return TLS13_IO_FAILURE; | 359 | return TLS13_IO_FAILURE; |
| 363 | 360 | ||
| 364 | switch(tls13_handshake_msg_type(ctx->hs_msg)) { | 361 | switch(tls13_handshake_msg_type(ctx->hs_msg)) { |
| 365 | case TLS13_MT_KEY_UPDATE: | 362 | case TLS13_MT_KEY_UPDATE: |
| 366 | ret = tls13_key_update_recv(ctx, &phh_cbs); | 363 | ret = tls13_key_update_recv(ctx, &cbs); |
| 367 | break; | 364 | break; |
| 368 | case TLS13_MT_NEW_SESSION_TICKET: | 365 | case TLS13_MT_NEW_SESSION_TICKET: |
| 369 | /* XXX do nothing for now and ignore this */ | 366 | /* XXX do nothing for now and ignore this */ |
diff --git a/src/lib/libssl/tls13_record_layer.c b/src/lib/libssl/tls13_record_layer.c index c68ee3b3a5..2b7052c30e 100644 --- a/src/lib/libssl/tls13_record_layer.c +++ b/src/lib/libssl/tls13_record_layer.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls13_record_layer.c,v 1.67 2022/01/14 09:12:15 tb Exp $ */ | 1 | /* $OpenBSD: tls13_record_layer.c,v 1.68 2022/07/20 06:32:24 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 | * |
| @@ -909,7 +909,7 @@ tls13_record_layer_recv_phh(struct tls13_record_layer *rl) | |||
| 909 | * TLS13_IO_FAILURE something broke. | 909 | * TLS13_IO_FAILURE something broke. |
| 910 | */ | 910 | */ |
| 911 | if (rl->cb.phh_recv != NULL) | 911 | if (rl->cb.phh_recv != NULL) |
| 912 | ret = rl->cb.phh_recv(rl->cb_arg, tls_content_cbs(rl->rcontent)); | 912 | ret = rl->cb.phh_recv(rl->cb_arg); |
| 913 | 913 | ||
| 914 | tls_content_clear(rl->rcontent); | 914 | tls_content_clear(rl->rcontent); |
| 915 | 915 | ||
diff --git a/src/lib/libssl/tls_buffer.c b/src/lib/libssl/tls_buffer.c index 5c0ca7e40e..9bb6b62e51 100644 --- a/src/lib/libssl/tls_buffer.c +++ b/src/lib/libssl/tls_buffer.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls_buffer.c,v 1.1 2021/10/23 13:12:14 jsing Exp $ */ | 1 | /* $OpenBSD: tls_buffer.c,v 1.2 2022/07/20 06:32:24 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 | * |
| @@ -76,15 +76,6 @@ tls_buffer_resize(struct tls_buffer *buf, size_t capacity) | |||
| 76 | return 1; | 76 | return 1; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | int | ||
| 80 | tls_buffer_set_data(struct tls_buffer *buf, CBS *data) | ||
| 81 | { | ||
| 82 | if (!tls_buffer_resize(buf, CBS_len(data))) | ||
| 83 | return 0; | ||
| 84 | memcpy(buf->data, CBS_data(data), CBS_len(data)); | ||
| 85 | return 1; | ||
| 86 | } | ||
| 87 | |||
| 88 | ssize_t | 79 | ssize_t |
| 89 | tls_buffer_extend(struct tls_buffer *buf, size_t len, | 80 | tls_buffer_extend(struct tls_buffer *buf, size_t len, |
| 90 | tls_read_cb read_cb, void *cb_arg) | 81 | tls_read_cb read_cb, void *cb_arg) |
diff --git a/src/lib/libssl/tls_internal.h b/src/lib/libssl/tls_internal.h index 0065f0f39f..ac2d14da48 100644 --- a/src/lib/libssl/tls_internal.h +++ b/src/lib/libssl/tls_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls_internal.h,v 1.6 2022/06/29 08:27:51 tb Exp $ */ | 1 | /* $OpenBSD: tls_internal.h,v 1.7 2022/07/20 06:32:24 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018, 2019, 2021 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2018, 2019, 2021 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -47,7 +47,6 @@ typedef ssize_t (*tls_flush_cb)(void *_cb_arg); | |||
| 47 | struct tls_buffer; | 47 | struct tls_buffer; |
| 48 | 48 | ||
| 49 | struct tls_buffer *tls_buffer_new(size_t init_size); | 49 | struct tls_buffer *tls_buffer_new(size_t init_size); |
| 50 | int tls_buffer_set_data(struct tls_buffer *buf, CBS *data); | ||
| 51 | void tls_buffer_free(struct tls_buffer *buf); | 50 | void tls_buffer_free(struct tls_buffer *buf); |
| 52 | ssize_t tls_buffer_extend(struct tls_buffer *buf, size_t len, | 51 | ssize_t tls_buffer_extend(struct tls_buffer *buf, size_t len, |
| 53 | tls_read_cb read_cb, void *cb_arg); | 52 | tls_read_cb read_cb, void *cb_arg); |
