diff options
author | jsing <> | 2019-04-01 15:58:02 +0000 |
---|---|---|
committer | jsing <> | 2019-04-01 15:58:02 +0000 |
commit | 124072cef0c06581ae5bb8581be095c92b65e802 (patch) | |
tree | 968d23aa68db9b19e12bd8f87dac1683253ac622 /src/lib/libtls/tls_internal.h | |
parent | 9552538f07c2d19c99c3229f037712f6dfa1c550 (diff) | |
download | openbsd-124072cef0c06581ae5bb8581be095c92b65e802.tar.gz openbsd-124072cef0c06581ae5bb8581be095c92b65e802.tar.bz2 openbsd-124072cef0c06581ae5bb8581be095c92b65e802.zip |
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 '')
-rw-r--r-- | src/lib/libtls/tls_internal.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h index e1a858d4de..3842439d58 100644 --- a/src/lib/libtls/tls_internal.h +++ b/src/lib/libtls/tls_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_internal.h,v 1.73 2018/11/06 20:34:54 jsing Exp $ */ | 1 | /* $OpenBSD: tls_internal.h,v 1.74 2019/04/01 15:58:02 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> | 3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> |
4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
@@ -19,6 +19,8 @@ | |||
19 | #ifndef HEADER_TLS_INTERNAL_H | 19 | #ifndef HEADER_TLS_INTERNAL_H |
20 | #define HEADER_TLS_INTERNAL_H | 20 | #define HEADER_TLS_INTERNAL_H |
21 | 21 | ||
22 | #include <pthread.h> | ||
23 | |||
22 | #include <arpa/inet.h> | 24 | #include <arpa/inet.h> |
23 | #include <netinet/in.h> | 25 | #include <netinet/in.h> |
24 | 26 | ||
@@ -75,6 +77,7 @@ struct tls_ticket_key { | |||
75 | struct tls_config { | 77 | struct tls_config { |
76 | struct tls_error error; | 78 | struct tls_error error; |
77 | 79 | ||
80 | pthread_mutex_t mutex; | ||
78 | int refcount; | 81 | int refcount; |
79 | 82 | ||
80 | char *alpn; | 83 | char *alpn; |