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