summaryrefslogtreecommitdiff
path: root/lib/mbuffers.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2018-08-06 15:20:34 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2018-08-06 15:20:34 +0000
commit695a2549763af25157db50f88d19ea097dd6ab8e (patch)
treef9750ab5f06d0dab88fb201821021c6e1a4c8434 /lib/mbuffers.c
parent41ad338d2f77f57d7a75a5e9e4c94b6a7f2a022d (diff)
parentdac058cc742e44a5ac29c55dbac4f1ba34206eec (diff)
downloadgnutls-695a2549763af25157db50f88d19ea097dd6ab8e.tar.gz
Merge branch 'tmp-handshake-interleave' into 'master'
Fix interleaved handshake handling in TLS 1.3 Closes #272 See merge request gnutls/gnutls!708
Diffstat (limited to 'lib/mbuffers.c')
-rw-r--r--lib/mbuffers.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/mbuffers.c b/lib/mbuffers.c
index 2bcd57e426..2e4c62a295 100644
--- a/lib/mbuffers.c
+++ b/lib/mbuffers.c
@@ -126,6 +126,25 @@ mbuffer_st *_mbuffer_dequeue(mbuffer_head_st * buf, mbuffer_st * bufel)
return ret;
}
+/* Append a segment to the beginning of this buffer.
+ *
+ * Cost: O(1)
+ */
+void _mbuffer_head_push_first(mbuffer_head_st * buf, mbuffer_st * bufel)
+{
+ bufel->prev = NULL;
+ bufel->next = buf->head;
+
+ buf->length++;
+ buf->byte_length += bufel->msg.size - bufel->mark;
+
+ if (buf->head != NULL)
+ buf->head->prev = bufel;
+ else
+ buf->tail = bufel;
+ buf->head = bufel;
+}
+
/* Get a reference to the first segment of the buffer and
* remove it from the list.
*