]> git.sur5r.net Git - openldap/blob - libraries/libldap/ldap-tls.h
ITS#8753 Public key pinning support in libldap
[openldap] / libraries / libldap / ldap-tls.h
1 /*  ldap-tls.h - TLS defines & prototypes internal to the LDAP library */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 2008-2017 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16
17 #ifndef _LDAP_TLS_H
18 #define _LDAP_TLS_H 1
19
20 struct tls_impl;
21
22 struct tls_ctx;
23 struct tls_session;
24
25 typedef struct tls_ctx tls_ctx;
26 typedef struct tls_session tls_session;
27
28 typedef int (TI_tls_init)(void);
29 typedef void (TI_tls_destroy)(void);
30
31 typedef tls_ctx *(TI_ctx_new)(struct ldapoptions *lo);
32 typedef void (TI_ctx_ref)(tls_ctx *ctx);
33 typedef void (TI_ctx_free)(tls_ctx *ctx);
34 typedef int (TI_ctx_init)(struct ldapoptions *lo, struct ldaptls *lt, int is_server);
35
36 typedef tls_session *(TI_session_new)(tls_ctx *ctx, int is_server);
37 typedef int (TI_session_connect)(LDAP *ld, tls_session *s);
38 typedef int (TI_session_accept)(tls_session *s);
39 typedef int (TI_session_upflags)(Sockbuf *sb, tls_session *s, int rc);
40 typedef char *(TI_session_errmsg)(tls_session *s, int rc, char *buf, size_t len );
41 typedef int (TI_session_dn)(tls_session *sess, struct berval *dn);
42 typedef int (TI_session_chkhost)(LDAP *ld, tls_session *s, const char *name_in);
43 typedef int (TI_session_strength)(tls_session *sess);
44 typedef int (TI_session_unique)(tls_session *sess, struct berval *buf, int is_server);
45 typedef const char *(TI_session_name)(tls_session *s);
46 typedef int (TI_session_peercert)(tls_session *s, struct berval *der);
47 typedef int (TI_session_pinning)(LDAP *ld, tls_session *s, char *hashalg, struct berval *hash);
48
49 typedef void (TI_thr_init)(void);
50
51 typedef struct tls_impl {
52         const char *ti_name;
53
54         TI_tls_init *ti_tls_init;       /* library initialization */
55         TI_tls_destroy *ti_tls_destroy;
56
57         TI_ctx_new *ti_ctx_new;
58         TI_ctx_ref *ti_ctx_ref;
59         TI_ctx_free *ti_ctx_free;
60         TI_ctx_init *ti_ctx_init;
61
62         TI_session_new *ti_session_new;
63         TI_session_connect *ti_session_connect;
64         TI_session_accept *ti_session_accept;
65         TI_session_upflags *ti_session_upflags;
66         TI_session_errmsg *ti_session_errmsg;
67         TI_session_dn *ti_session_my_dn;
68         TI_session_dn *ti_session_peer_dn;
69         TI_session_chkhost *ti_session_chkhost;
70         TI_session_strength *ti_session_strength;
71         TI_session_unique *ti_session_unique;
72         TI_session_name *ti_session_version;
73         TI_session_name *ti_session_cipher;
74         TI_session_peercert *ti_session_peercert;
75         TI_session_pinning *ti_session_pinning;
76
77         Sockbuf_IO *ti_sbio;
78
79         TI_thr_init *ti_thr_init;
80
81         int ti_inited;
82 } tls_impl;
83
84 extern tls_impl ldap_int_tls_impl;
85
86 #endif /* _LDAP_TLS_H */