2 Unix SMB/CIFS implementation.
4 transport layer security handling code
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "lib/socket/socket.h"
27 struct loadparm_context;
29 void tls_cert_generate(TALLOC_CTX *mem_ctx,
31 const char *keyfile, const char *certfile,
34 struct tstream_context;
35 struct tstream_tls_params;
37 enum tls_verify_peer_state {
38 TLS_VERIFY_PEER_NO_CHECK = 0,
39 #define TLS_VERIFY_PEER_NO_CHECK_STRING "no_check"
41 TLS_VERIFY_PEER_CA_ONLY = 10,
42 #define TLS_VERIFY_PEER_CA_ONLY_STRING "ca_only"
44 TLS_VERIFY_PEER_CA_AND_NAME_IF_AVAILABLE = 20,
45 #define TLS_VERIFY_PEER_CA_AND_NAME_IF_AVAILABLE_STRING \
46 "ca_and_name_if_available"
48 TLS_VERIFY_PEER_CA_AND_NAME = 30,
49 #define TLS_VERIFY_PEER_CA_AND_NAME_STRING "ca_and_name"
51 TLS_VERIFY_PEER_AS_STRICT_AS_POSSIBLE = 9999,
52 #define TLS_VERIFY_PEER_AS_STRICT_AS_POSSIBLE_STRING \
53 "as_strict_as_possible"
56 const char *tls_verify_peer_string(enum tls_verify_peer_state verify_peer);
58 NTSTATUS tstream_tls_params_client(TALLOC_CTX *mem_ctx,
61 const char *tls_priority,
62 enum tls_verify_peer_state verify_peer,
63 const char *peer_name,
64 struct tstream_tls_params **_tlsp);
66 NTSTATUS tstream_tls_params_client_lpcfg(TALLOC_CTX *mem_ctx,
67 struct loadparm_context *lp_ctx,
68 const char *peer_name,
69 struct tstream_tls_params **tlsp);
71 NTSTATUS tstream_tls_params_server(TALLOC_CTX *mem_ctx,
72 const char *dns_host_name,
75 const char *cert_file,
79 const char *tls_priority,
80 struct tstream_tls_params **_params);
82 bool tstream_tls_params_enabled(struct tstream_tls_params *params);
84 struct tevent_req *_tstream_tls_connect_send(TALLOC_CTX *mem_ctx,
85 struct tevent_context *ev,
86 struct tstream_context *plain_stream,
87 struct tstream_tls_params *tls_params,
88 const char *location);
89 #define tstream_tls_connect_send(mem_ctx, ev, plain_stream, tls_params) \
90 _tstream_tls_connect_send(mem_ctx, ev, plain_stream, tls_params, __location__)
92 int tstream_tls_connect_recv(struct tevent_req *req,
95 struct tstream_context **tls_stream);
97 struct tevent_req *_tstream_tls_accept_send(TALLOC_CTX *mem_ctx,
98 struct tevent_context *ev,
99 struct tstream_context *plain_stream,
100 struct tstream_tls_params *tls_params,
101 const char *location);
102 #define tstream_tls_accept_send(mem_ctx, ev, plain_stream, tls_params) \
103 _tstream_tls_accept_send(mem_ctx, ev, plain_stream, tls_params, __location__)
105 int tstream_tls_accept_recv(struct tevent_req *req,
108 struct tstream_context **tls_stream);