2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_SRC_SECURITY_CONTEXT_H
10 #define SQUID_SRC_SECURITY_CONTEXT_H
12 #include "security/LockingPointer.h"
15 #if HAVE_OPENSSL_SSL_H
16 #include <openssl/ssl.h>
20 #if HAVE_GNUTLS_GNUTLS_H
21 #include <gnutls/gnutls.h>
28 * Due to circular dependency issues between ssl/libsquidssl.la and
29 * security/libsecurity.la the code within src/ssl/ is restricted to
30 * only using Security::ContextPtr, it MUST NOT use ContextPointer
32 * Code outside of src/ssl/ should always use Security::ContextPointer
33 * when storing a reference to a context.
36 typedef SSL_CTX
* ContextPtr
;
37 CtoCpp1(SSL_CTX_free
, SSL_CTX
*);
38 typedef LockingPointer
<SSL_CTX
, SSL_CTX_free_cpp
, CRYPTO_LOCK_SSL_CTX
> ContextPointer
;
41 typedef gnutls_certificate_credentials_t ContextPtr
;
42 CtoCpp1(gnutls_certificate_free_credentials
, gnutls_certificate_credentials_t
);
43 typedef Security::LockingPointer
<struct gnutls_certificate_credentials_st
, gnutls_certificate_free_credentials_cpp
, -1> ContextPointer
;
46 // use void* so we can check against nullptr
47 typedef void* ContextPtr
;
48 typedef Security::LockingPointer
<void, nullptr, -1> ContextPointer
;
52 } // namespace Security
54 #endif /* SQUID_SRC_SECURITY_CONTEXT_H */