syslog-ng source
openssl_support.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2016 Balabit
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * As an additional exemption you are allowed to compile & link against the
19  * OpenSSL libraries as published by the OpenSSL project. See the file
20  * COPYING for details.
21  *
22  */
23 
24 #ifndef OPENSSL_SUPPORT_H_INCLUDED
25 #define OPENSSL_SUPPORT_H_INCLUDED
26 
27 #include "compat/compat.h"
28 #include <openssl/ssl.h>
29 #include <openssl/dh.h>
30 #include <glib.h>
31 
32 #if !SYSLOG_NG_HAVE_DECL_SSL_CTX_GET0_PARAM
33 X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx);
34 #endif
35 
36 #if !SYSLOG_NG_HAVE_DECL_X509_STORE_CTX_GET0_CERT
37 X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx);
38 #endif
39 
40 #if !SYSLOG_NG_HAVE_DECL_X509_GET_EXTENSION_FLAGS
41 #include <stdint.h>
42 uint32_t X509_get_extension_flags(X509 *x);
43 #endif
44 
45 #if SYSLOG_NG_HAVE_DECL_EVP_MD_CTX_RESET
46 #include <openssl/evp.h>
47 #define EVP_MD_CTX_cleanup EVP_MD_CTX_reset
48 #define DECLARE_EVP_MD_CTX(md_ctx) EVP_MD_CTX * md_ctx = EVP_MD_CTX_create()
49 #else
50 #define DECLARE_EVP_MD_CTX(md_ctx) EVP_MD_CTX _##md_ctx; EVP_MD_CTX * md_ctx = & _##md_ctx
51 #define EVP_MD_CTX_destroy(md_ctx) EVP_MD_CTX_cleanup(md_ctx)
52 #endif
53 
54 #if !SYSLOG_NG_HAVE_DECL_ASN1_STRING_GET0_DATA
55 #define ASN1_STRING_get0_data ASN1_STRING_data
56 #endif
57 
58 #if OPENSSL_VERSION_NUMBER < 0x30000000L
59 #define SYSLOG_NG_HAVE_DECL_DIGEST_MD4 1
60 #else
61 #define SYSLOG_NG_HAVE_DECL_DIGEST_MD4 0
62 #endif
63 
64 #if !SYSLOG_NG_HAVE_DECL_DH_SET0_PQG && OPENSSL_VERSION_NUMBER < 0x30000000L
65 int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
66 #endif
67 
68 #if !SYSLOG_NG_HAVE_DECL_BN_GET_RFC3526_PRIME_2048
69 BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);
70 #endif
71 
72 void openssl_ctx_setup_session_tickets(SSL_CTX *ctx);
73 
74 void openssl_ctx_setup_ecdh(SSL_CTX *ctx);
75 gboolean openssl_ctx_setup_dh(SSL_CTX *ctx);
76 gboolean openssl_ctx_load_dh_from_file(SSL_CTX *ctx, const gchar *dhparam_file);
77 
78 void openssl_init(void);
81 
82 #endif
gboolean openssl_ctx_load_dh_from_file(SSL_CTX *ctx, const gchar *dhparam_file)
Definition: openssl_support.c:245
BIGNUM * BN_get_rfc3526_prime_2048(BIGNUM *bn)
Definition: openssl_support.c:314
void openssl_ctx_setup_ecdh(SSL_CTX *ctx)
Definition: openssl_support.c:166
X509_VERIFY_PARAM * SSL_CTX_get0_param(SSL_CTX *ctx)
Definition: openssl_support.c:31
X509 * X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx)
Definition: openssl_support.c:38
gboolean openssl_ctx_setup_dh(SSL_CTX *ctx)
Definition: openssl_support.c:189
void openssl_ctx_setup_session_tickets(SSL_CTX *ctx)
Definition: openssl_support.c:321
uint32_t X509_get_extension_flags(X509 *x)
Definition: openssl_support.c:45
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
Definition: openssl_support.c:283
void openssl_crypto_init_threading(void)
Definition: openssl_support.c:129
void openssl_crypto_deinit_threading(void)
Definition: openssl_support.c:136
void openssl_init(void)
Definition: openssl_support.c:156