From ec0a42c8a74417f7ba05753597cf210a41fb6fc8 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Mon, 21 Jan 2019 00:24:19 +0000 Subject: Store the record version and make it available for use. While here correct an int vs size_t mismatch. ok tb@ --- src/lib/libssl/tls13_record.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/lib/libssl/tls13_record.c') diff --git a/src/lib/libssl/tls13_record.c b/src/lib/libssl/tls13_record.c index 1a4e22ee47..e0631dff76 100644 --- a/src/lib/libssl/tls13_record.c +++ b/src/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 * @@ -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; } -- cgit v1.2.3-55-g6feb