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