syslog-ng source
tls-session.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2013 Balabit
3  * Copyright (c) 1998-2011 Balázs Scheidler
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * As an additional exemption you are allowed to compile & link against the
20  * OpenSSL libraries as published by the OpenSSL project. See the file
21  * COPYING for details.
22  */
23 #ifndef TRANSPORT_TLS_SESSION_H_INCLUDED
24 #define TRANSPORT_TLS_SESSION_H_INCLUDED
25 
26 #include "tls-verifier.h"
27 
28 #define X509_MAX_CN_LEN 64
29 #define X509_MAX_O_LEN 64
30 #define X509_MAX_OU_LEN 32
31 #define X509_MAX_FP_LEN 256
32 
33 typedef struct _TLSContext TLSContext;
34 typedef struct _TLSSession
35 {
36  SSL *ssl;
37  TLSContext *ctx;
39  struct
40  {
41  int found;
42  gchar o[X509_MAX_O_LEN];
43  gchar ou[X509_MAX_OU_LEN];
44  gchar cn[X509_MAX_CN_LEN];
45  gchar fingerprint[X509_MAX_FP_LEN];
46  } peer_info;
47 } TLSSession;
48 
49 void tls_session_set_trusted_fingerprints(TLSContext *self, GList *fingerprints);
50 void tls_session_set_trusted_dn(TLSContext *self, GList *dns);
51 void tls_session_set_verifier(TLSSession *self, TLSVerifier *verifier);
52 
53 int tls_session_verify_callback(int ok, X509_STORE_CTX *ctx);
54 int tls_session_ocsp_client_verify_callback(SSL *ssl, void *user_data);
55 
56 TLSSession *tls_session_new(SSL *ssl, TLSContext *ctx);
57 void tls_session_free(TLSSession *self);
58 
59 #endif
Definition: tls-session.h:35
TLSContext * ctx
Definition: tls-session.h:37
SSL * ssl
Definition: tls-session.h:36
int found
Definition: tls-session.h:41
TLSVerifier * verifier
Definition: tls-session.h:38
Definition: tls-verifier.h:33
Definition: tls-context.h:69
TLSSession * tls_session_new(SSL *ssl, TLSContext *ctx)
Definition: tls-session.c:581
#define X509_MAX_CN_LEN
Definition: tls-session.h:28
void tls_session_free(TLSSession *self)
Definition: tls-session.c:604
void tls_session_set_trusted_dn(TLSContext *self, GList *dns)
Definition: tls-session.c:525
int tls_session_verify_callback(int ok, X509_STORE_CTX *ctx)
Definition: tls-session.c:284
#define X509_MAX_FP_LEN
Definition: tls-session.h:31
#define X509_MAX_OU_LEN
Definition: tls-session.h:30
int tls_session_ocsp_client_verify_callback(SSL *ssl, void *user_data)
Definition: tls-session.c:483
void tls_session_set_trusted_fingerprints(TLSContext *self, GList *fingerprints)
Definition: tls-session.c:516
#define X509_MAX_O_LEN
Definition: tls-session.h:29
void tls_session_set_verifier(TLSSession *self, TLSVerifier *verifier)
Definition: tls-session.c:534