diff options
author | jsing <> | 2021-10-23 13:12:14 +0000 |
---|---|---|
committer | jsing <> | 2021-10-23 13:12:14 +0000 |
commit | d2039e7348559d4183f5d055e691e70e1dadf349 (patch) | |
tree | bfbb08766325a11dd03fa658249cdacb09f2c3c0 /src/lib/libssl/tls13_record.c | |
parent | c4a5b1f8676a44f32abf55d9aff5ae7d2c36a4be (diff) | |
download | openbsd-d2039e7348559d4183f5d055e691e70e1dadf349.tar.gz openbsd-d2039e7348559d4183f5d055e691e70e1dadf349.tar.bz2 openbsd-d2039e7348559d4183f5d055e691e70e1dadf349.zip |
Rename tls13_buffer to tls_buffer.
This code will soon be used in the DTLSv1.2 and TLSv1.2 stack. Also
introduce tls_internal.h and move/rename the read/write/flush callbacks.
ok beck@ tb@
Diffstat (limited to 'src/lib/libssl/tls13_record.c')
-rw-r--r-- | src/lib/libssl/tls13_record.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/libssl/tls13_record.c b/src/lib/libssl/tls13_record.c index 3bdaead5a7..2c744668e5 100644 --- a/src/lib/libssl/tls13_record.c +++ b/src/lib/libssl/tls13_record.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls13_record.c,v 1.8 2021/05/16 14:19:04 jsing Exp $ */ | 1 | /* $OpenBSD: tls13_record.c,v 1.9 2021/10/23 13:12:14 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 | * |
@@ -26,7 +26,7 @@ struct tls13_record { | |||
26 | size_t data_len; | 26 | size_t data_len; |
27 | CBS cbs; | 27 | CBS cbs; |
28 | 28 | ||
29 | struct tls13_buffer *buf; | 29 | struct tls_buffer *buf; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | struct tls13_record * | 32 | struct tls13_record * |
@@ -36,7 +36,7 @@ tls13_record_new(void) | |||
36 | 36 | ||
37 | if ((rec = calloc(1, sizeof(struct tls13_record))) == NULL) | 37 | if ((rec = calloc(1, sizeof(struct tls13_record))) == NULL) |
38 | goto err; | 38 | goto err; |
39 | if ((rec->buf = tls13_buffer_new(TLS13_RECORD_MAX_LEN)) == NULL) | 39 | if ((rec->buf = tls_buffer_new(TLS13_RECORD_MAX_LEN)) == NULL) |
40 | goto err; | 40 | goto err; |
41 | 41 | ||
42 | return rec; | 42 | return rec; |
@@ -53,7 +53,7 @@ tls13_record_free(struct tls13_record *rec) | |||
53 | if (rec == NULL) | 53 | if (rec == NULL) |
54 | return; | 54 | return; |
55 | 55 | ||
56 | tls13_buffer_free(rec->buf); | 56 | tls_buffer_free(rec->buf); |
57 | 57 | ||
58 | freezero(rec->data, rec->data_len); | 58 | freezero(rec->data, rec->data_len); |
59 | freezero(rec, sizeof(struct tls13_record)); | 59 | freezero(rec, sizeof(struct tls13_record)); |
@@ -118,7 +118,7 @@ tls13_record_set_data(struct tls13_record *rec, uint8_t *data, size_t data_len) | |||
118 | } | 118 | } |
119 | 119 | ||
120 | ssize_t | 120 | ssize_t |
121 | tls13_record_recv(struct tls13_record *rec, tls13_read_cb wire_read, | 121 | tls13_record_recv(struct tls13_record *rec, tls_read_cb wire_read, |
122 | void *wire_arg) | 122 | void *wire_arg) |
123 | { | 123 | { |
124 | uint16_t rec_len, rec_version; | 124 | uint16_t rec_len, rec_version; |
@@ -130,11 +130,11 @@ tls13_record_recv(struct tls13_record *rec, tls13_read_cb wire_read, | |||
130 | return TLS13_IO_FAILURE; | 130 | return TLS13_IO_FAILURE; |
131 | 131 | ||
132 | if (rec->content_type == 0) { | 132 | if (rec->content_type == 0) { |
133 | if ((ret = tls13_buffer_extend(rec->buf, | 133 | if ((ret = tls_buffer_extend(rec->buf, |
134 | TLS13_RECORD_HEADER_LEN, wire_read, wire_arg)) <= 0) | 134 | TLS13_RECORD_HEADER_LEN, wire_read, wire_arg)) <= 0) |
135 | return ret; | 135 | return ret; |
136 | 136 | ||
137 | tls13_buffer_cbs(rec->buf, &cbs); | 137 | tls_buffer_cbs(rec->buf, &cbs); |
138 | 138 | ||
139 | if (!CBS_get_u8(&cbs, &content_type)) | 139 | if (!CBS_get_u8(&cbs, &content_type)) |
140 | return TLS13_IO_FAILURE; | 140 | return TLS13_IO_FAILURE; |
@@ -153,18 +153,18 @@ tls13_record_recv(struct tls13_record *rec, tls13_read_cb wire_read, | |||
153 | rec->rec_len = rec_len; | 153 | rec->rec_len = rec_len; |
154 | } | 154 | } |
155 | 155 | ||
156 | if ((ret = tls13_buffer_extend(rec->buf, | 156 | if ((ret = tls_buffer_extend(rec->buf, |
157 | TLS13_RECORD_HEADER_LEN + rec->rec_len, wire_read, wire_arg)) <= 0) | 157 | TLS13_RECORD_HEADER_LEN + rec->rec_len, wire_read, wire_arg)) <= 0) |
158 | return ret; | 158 | return ret; |
159 | 159 | ||
160 | if (!tls13_buffer_finish(rec->buf, &rec->data, &rec->data_len)) | 160 | if (!tls_buffer_finish(rec->buf, &rec->data, &rec->data_len)) |
161 | return TLS13_IO_FAILURE; | 161 | return TLS13_IO_FAILURE; |
162 | 162 | ||
163 | return rec->data_len; | 163 | return rec->data_len; |
164 | } | 164 | } |
165 | 165 | ||
166 | ssize_t | 166 | ssize_t |
167 | tls13_record_send(struct tls13_record *rec, tls13_write_cb wire_write, | 167 | tls13_record_send(struct tls13_record *rec, tls_write_cb wire_write, |
168 | void *wire_arg) | 168 | void *wire_arg) |
169 | { | 169 | { |
170 | ssize_t ret; | 170 | ssize_t ret; |