]> git.ipfire.org Git - thirdparty/squid.git/blob - src/security/forward.h
merge from trunk-r14768
[thirdparty/squid.git] / src / security / forward.h
1 /*
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 #ifndef SQUID_SRC_SECURITY_FORWARD_H
10 #define SQUID_SRC_SECURITY_FORWARD_H
11
12 #include "security/Context.h"
13 #include "security/Session.h"
14
15 #if USE_GNUTLS
16 #if HAVE_GNUTLS_X509_H
17 #include <gnutls/x509.h>
18 #endif
19 #endif
20 #include <list>
21
22 #if USE_OPENSSL
23 // Macro to be used to define the C++ wrapper functor of the sk_*_pop_free
24 // OpenSSL family of functions. The C++ functor is suffixed with the _free_wrapper
25 // extension
26 #define sk_dtor_wrapper(sk_object, argument_type, freefunction) \
27 struct sk_object ## _free_wrapper { \
28 void operator()(argument_type a) { sk_object ## _pop_free(a, freefunction); } \
29 }
30 #endif /* USE_OPENSSL */
31
32 /* flags a SSL connection can be configured with */
33 #define SSL_FLAG_NO_DEFAULT_CA (1<<0)
34 #define SSL_FLAG_DELAYED_AUTH (1<<1)
35 #define SSL_FLAG_DONT_VERIFY_PEER (1<<2)
36 #define SSL_FLAG_DONT_VERIFY_DOMAIN (1<<3)
37 #define SSL_FLAG_NO_SESSION_REUSE (1<<4)
38 #define SSL_FLAG_VERIFY_CRL (1<<5)
39 #define SSL_FLAG_VERIFY_CRL_ALL (1<<6)
40
41 /// Network/connection security abstraction layer
42 namespace Security
43 {
44
45 #if USE_OPENSSL
46 CtoCpp1(X509_free, X509 *)
47 typedef Security::LockingPointer<X509, X509_free_cpp, CRYPTO_LOCK_X509> CertPointer;
48 #elif USE_GNUTLS
49 CtoCpp1(gnutls_x509_crt_deinit, gnutls_x509_crt_t)
50 typedef Security::LockingPointer<struct gnutls_x509_crt_int, gnutls_x509_crt_deinit, -1> CertPointer;
51 #else
52 typedef void * CertPointer;
53 #endif
54
55 #if USE_OPENSSL
56 CtoCpp1(X509_CRL_free, X509_CRL *)
57 typedef LockingPointer<X509_CRL, X509_CRL_free_cpp, CRYPTO_LOCK_X509_CRL> CrlPointer;
58 #elif USE_GNUTLS
59 CtoCpp1(gnutls_x509_crl_deinit, gnutls_x509_crl_t)
60 typedef Security::LockingPointer<struct gnutls_x509_crl_int, gnutls_x509_crl_deinit, -1> CrlPointer;
61 #else
62 typedef void *CrlPointer;
63 #endif
64
65 typedef std::list<Security::CertPointer> CertList;
66
67 typedef std::list<Security::CrlPointer> CertRevokeList;
68
69 #if USE_OPENSSL
70 CtoCpp1(DH_free, DH *);
71 typedef Security::LockingPointer<DH, DH_free_cpp, CRYPTO_LOCK_DH> DhePointer;
72 #else
73 typedef void *DhePointer;
74 #endif
75
76 class EncryptorAnswer;
77 class KeyData;
78 class PeerConnector;
79 class PeerOptions;
80 class ServerOptions;
81
82 } // namespace Security
83
84 #endif /* SQUID_SRC_SECURITY_FORWARD_H */
85