1/*
2 * tls.c
3 *
4 * Copyright (C) 2016 Aerospike, Inc.
5 *
6 * Portions may be licensed to Aerospike, Inc. under one or more contributor
7 * license agreements.
8 *
9 * This program is free software: you can redistribute it and/or modify it under
10 * the terms of the GNU Affero General Public License as published by the Free
11 * Software Foundation, either version 3 of the License, or (at your option) any
12 * later version.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see http://www.gnu.org/licenses/
21 */
22#include <openssl/ssl.h>
23
24#include "fault.h"
25#include "socket.h"
26#include "tls.h"
27
28void
29tls_check_init()
30{
31}
32
33void
34tls_cleanup()
35{
36}
37
38void
39tls_thread_cleanup()
40{
41}
42
43void
44tls_socket_init(cf_socket *sock)
45{
46 sock->ssl = NULL;
47}
48
49void
50tls_socket_term(cf_socket *sock)
51{
52 if (sock->ssl) {
53 cf_crash(CF_TLS, "unexpected TLS state");
54 }
55}
56
57int
58tls_socket_shutdown(cf_socket *sock)
59{
60 if (sock->ssl) {
61 cf_crash(CF_TLS, "unexpected TLS state");
62 }
63 return -1;
64}
65
66void
67tls_socket_close(cf_socket *sock)
68{
69 if (sock->ssl) {
70 cf_crash(CF_TLS, "unexpected TLS state");
71 }
72}
73
74char *tls_read_password(const char *path)
75{
76 cf_crash(CF_TLS, "unexpected TLS state");
77 return NULL;
78}
79
80cf_tls_info *
81tls_config_server_context(cf_tls_spec *tspec, bool auth_client, uint32_t n_peer_names, char **peer_names)
82{
83 cf_crash(CF_TLS, "unexpected TLS state");
84 return NULL;
85}
86
87cf_tls_info *
88tls_config_intra_context(cf_tls_spec *tspec, const char *which)
89{
90 cf_crash(CF_TLS, "unexpected TLS state");
91 return NULL;
92}
93
94void
95tls_socket_prepare_server(cf_tls_info *info, cf_socket *sock)
96{
97 cf_crash(CF_TLS, "unexpected TLS state");
98}
99
100void
101tls_socket_prepare_client(cf_tls_info *info, cf_socket *sock)
102{
103 cf_crash(CF_TLS, "unexpected TLS state");
104}
105
106void
107tls_socket_must_not_have_data(cf_socket *sock, const char *caller)
108{
109 if (sock->state == CF_SOCKET_STATE_NON_TLS) {
110 return;
111 }
112
113 cf_crash(CF_TLS, "unexpected TLS state");
114}
115
116int
117tls_socket_accept(cf_socket *sock)
118{
119 cf_crash(CF_TLS, "unexpected TLS state");
120 return 1;
121}
122
123int
124tls_socket_connect(cf_socket *sock)
125{
126 cf_crash(CF_TLS, "unexpected TLS state");
127 return 1;
128}
129
130int
131tls_socket_accept_block(cf_socket *sock)
132{
133 cf_crash(CF_TLS, "unexpected TLS state");
134 return 1;
135}
136
137int
138tls_socket_connect_block(cf_socket *sock)
139{
140 cf_crash(CF_TLS, "unexpected TLS state");
141 return 1;
142}
143
144int
145tls_socket_recv(cf_socket *sock, void *buf, size_t sz, int32_t flags,
146 uint64_t deadline_msec)
147{
148 cf_crash(CF_TLS, "unexpected TLS state");
149 return 1;
150}
151
152int
153tls_socket_send(cf_socket *sock, void const *buf, size_t sz, int32_t flags,
154 uint64_t deadline_msec)
155{
156 cf_crash(CF_TLS, "unexpected TLS state");
157 return 1;
158}
159
160int
161tls_socket_pending(cf_socket *sock)
162{
163 return 0;
164}
165
166