summaryrefslogtreecommitdiff
path: root/lib/libtls/tls_internal.h
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2019-04-01 15:58:03 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2019-04-01 15:58:03 +0000
commit16e45ee494a33f343b7ced1debeb773588b9f2bd (patch)
treefc84b6fd4f4418b9b68ad7ce42f2f74f2b2b2dce /lib/libtls/tls_internal.h
parent16da4f8be43cedc6539c84a30ac91ec6ad9ca75c (diff)
Add a mutex to guard reference counting for tls_config.
This makes libtls more friendly for multithreaded use - otherwise we can end up with incorrect refcounts and end up freeing when we should not be (or not freeing when we should be). ok beck@
Diffstat (limited to 'lib/libtls/tls_internal.h')
-rw-r--r--lib/libtls/tls_internal.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libtls/tls_internal.h b/lib/libtls/tls_internal.h
index e1a858d4de2..3842439d586 100644
--- a/lib/libtls/tls_internal.h
+++ b/lib/libtls/tls_internal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls_internal.h,v 1.73 2018/11/06 20:34:54 jsing Exp $ */
+/* $OpenBSD: tls_internal.h,v 1.74 2019/04/01 15:58:02 jsing Exp $ */
/*
* Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org>
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
@@ -19,6 +19,8 @@
#ifndef HEADER_TLS_INTERNAL_H
#define HEADER_TLS_INTERNAL_H
+#include <pthread.h>
+
#include <arpa/inet.h>
#include <netinet/in.h>
@@ -75,6 +77,7 @@ struct tls_ticket_key {
struct tls_config {
struct tls_error error;
+ pthread_mutex_t mutex;
int refcount;
char *alpn;