summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2019-01-21 00:24:19 +0000
committerjsing <jsing@openbsd.org>2019-01-21 00:24:19 +0000
commitc11ed2b5fd3e05c42431ac881f99478b9ec3ba7c (patch)
treec40a9e2d11d984d6b25407c8147babef497729c1
parentalso add a mac filter that ignores vlans for the broadcast address, so we can (diff)
downloadwireguard-openbsd-c11ed2b5fd3e05c42431ac881f99478b9ec3ba7c.tar.xz
wireguard-openbsd-c11ed2b5fd3e05c42431ac881f99478b9ec3ba7c.zip
Store the record version and make it available for use.
While here correct an int vs size_t mismatch. ok tb@
-rw-r--r--lib/libssl/tls13_record.c24
-rw-r--r--lib/libssl/tls13_record.h7
2 files changed, 21 insertions, 10 deletions
diff --git a/lib/libssl/tls13_record.c b/lib/libssl/tls13_record.c
index 1a4e22ee471..e0631dff76e 100644
--- a/lib/libssl/tls13_record.c
+++ b/lib/libssl/tls13_record.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_record.c,v 1.2 2019/01/20 09:12:05 jsing Exp $ */
+/* $OpenBSD: tls13_record.c,v 1.3 2019/01/21 00:24:19 jsing Exp $ */
/*
* Copyright (c) 2018, 2019 Joel Sing <jsing@openbsd.org>
*
@@ -23,6 +23,7 @@
#include "tls13_record.h"
struct tls13_record {
+ uint16_t version;
uint8_t content_type;
size_t rec_len;
uint8_t *data;
@@ -62,6 +63,18 @@ tls13_record_free(struct tls13_record *rec)
freezero(rec, sizeof(struct tls13_record));
}
+uint16_t
+tls13_record_version(struct tls13_record *rec)
+{
+ return rec->version;
+}
+
+uint8_t
+tls13_record_content_type(struct tls13_record *rec)
+{
+ return rec->content_type;
+}
+
int
tls13_record_header(struct tls13_record *rec, CBS *cbs)
{
@@ -73,12 +86,6 @@ tls13_record_header(struct tls13_record *rec, CBS *cbs)
return 1;
}
-uint8_t
-tls13_record_content_type(struct tls13_record *rec)
-{
- return rec->content_type;
-}
-
int
tls13_record_content(struct tls13_record *rec, CBS *cbs)
{
@@ -120,8 +127,8 @@ tls13_record_recv(struct tls13_record *rec, tls13_read_cb wire_read,
{
uint16_t rec_len, rec_version;
uint8_t content_type;
+ ssize_t ret;
CBS cbs;
- int ret;
if (rec->data != NULL)
return TLS13_IO_FAILURE;
@@ -145,6 +152,7 @@ tls13_record_recv(struct tls13_record *rec, tls13_read_cb wire_read,
return TLS13_IO_FAILURE;
rec->content_type = content_type;
+ rec->version = rec_version;
rec->rec_len = rec_len;
}
diff --git a/lib/libssl/tls13_record.h b/lib/libssl/tls13_record.h
index 72350d5d49b..400153ba779 100644
--- a/lib/libssl/tls13_record.h
+++ b/lib/libssl/tls13_record.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls13_record.h,v 1.2 2019/01/20 09:12:05 jsing Exp $ */
+/* $OpenBSD: tls13_record.h,v 1.3 2019/01/21 00:24:19 jsing Exp $ */
/*
* Copyright (c) 2019 Joel Sing <jsing@openbsd.org>
*
@@ -46,10 +46,13 @@ __BEGIN_HIDDEN_DECLS
*/
#define TLS13_RECORD_SEQ_NUM_LEN 8
+struct tls13_record;
+
struct tls13_record *tls13_record_new(void);
void tls13_record_free(struct tls13_record *_rec);
-int tls13_record_header(struct tls13_record *_rec, CBS *_cbs);
+uint16_t tls13_record_version(struct tls13_record *_rec);
uint8_t tls13_record_content_type(struct tls13_record *_rec);
+int tls13_record_header(struct tls13_record *_rec, CBS *_cbs);
int tls13_record_content(struct tls13_record *_rec, CBS *_cbs);
void tls13_record_data(struct tls13_record *_rec, CBS *_cbs);
int tls13_record_set_data(struct tls13_record *_rec, uint8_t *_data,