diff options
| author | jsing <> | 2019-04-01 15:58:02 +0000 | 
|---|---|---|
| committer | jsing <> | 2019-04-01 15:58:02 +0000 | 
| commit | 21c42a511c7d5693d9e491b79f765c4e74d2c16e (patch) | |
| tree | 968d23aa68db9b19e12bd8f87dac1683253ac622 /src/lib/libtls/tls_internal.h | |
| parent | 5cecd6a22c296f340853d47afffabcd24c0c8b33 (diff) | |
| download | openbsd-21c42a511c7d5693d9e491b79f765c4e74d2c16e.tar.gz openbsd-21c42a511c7d5693d9e491b79f765c4e74d2c16e.tar.bz2 openbsd-21c42a511c7d5693d9e491b79f765c4e74d2c16e.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 'src/lib/libtls/tls_internal.h')
| -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; | 
