xref: /freebsd/contrib/wpa/src/crypto/tls_none.c (revision a90b9d0159070121c221b966469c3e36d912bf82)
1 /*
2  * SSL/TLS interface functions for no TLS case
3  * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #include "includes.h"
10 
11 #include "common.h"
12 #include "tls.h"
13 
tls_init(const struct tls_config * conf)14 void * tls_init(const struct tls_config *conf)
15 {
16 	return (void *) 1;
17 }
18 
19 
tls_deinit(void * ssl_ctx)20 void tls_deinit(void *ssl_ctx)
21 {
22 }
23 
24 
tls_get_errors(void * tls_ctx)25 int tls_get_errors(void *tls_ctx)
26 {
27 	return 0;
28 }
29 
30 
tls_connection_init(void * tls_ctx)31 struct tls_connection * tls_connection_init(void *tls_ctx)
32 {
33 	return NULL;
34 }
35 
36 
tls_connection_deinit(void * tls_ctx,struct tls_connection * conn)37 void tls_connection_deinit(void *tls_ctx, struct tls_connection *conn)
38 {
39 }
40 
41 
tls_connection_established(void * tls_ctx,struct tls_connection * conn)42 int tls_connection_established(void *tls_ctx, struct tls_connection *conn)
43 {
44 	return -1;
45 }
46 
47 
tls_connection_peer_serial_num(void * tls_ctx,struct tls_connection * conn)48 char * tls_connection_peer_serial_num(void *tls_ctx,
49 				      struct tls_connection *conn)
50 {
51 	return NULL;
52 }
53 
54 
tls_connection_shutdown(void * tls_ctx,struct tls_connection * conn)55 int tls_connection_shutdown(void *tls_ctx, struct tls_connection *conn)
56 {
57 	return -1;
58 }
59 
60 
tls_connection_set_params(void * tls_ctx,struct tls_connection * conn,const struct tls_connection_params * params)61 int tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
62 			      const struct tls_connection_params *params)
63 {
64 	return -1;
65 }
66 
67 
tls_global_set_params(void * tls_ctx,const struct tls_connection_params * params)68 int tls_global_set_params(void *tls_ctx,
69 			  const struct tls_connection_params *params)
70 {
71 	return -1;
72 }
73 
74 
tls_global_set_verify(void * tls_ctx,int check_crl,int strict)75 int tls_global_set_verify(void *tls_ctx, int check_crl, int strict)
76 {
77 	return -1;
78 }
79 
80 
tls_connection_set_verify(void * tls_ctx,struct tls_connection * conn,int verify_peer,unsigned int flags,const u8 * session_ctx,size_t session_ctx_len)81 int tls_connection_set_verify(void *tls_ctx, struct tls_connection *conn,
82 			      int verify_peer, unsigned int flags,
83 			      const u8 *session_ctx, size_t session_ctx_len)
84 {
85 	return -1;
86 }
87 
88 
tls_connection_get_random(void * tls_ctx,struct tls_connection * conn,struct tls_random * data)89 int tls_connection_get_random(void *tls_ctx, struct tls_connection *conn,
90 			      struct tls_random *data)
91 {
92 	return -1;
93 }
94 
95 
tls_connection_export_key(void * tls_ctx,struct tls_connection * conn,const char * label,const u8 * context,size_t context_len,u8 * out,size_t out_len)96 int tls_connection_export_key(void *tls_ctx, struct tls_connection *conn,
97 			      const char *label, const u8 *context,
98 			      size_t context_len, u8 *out, size_t out_len)
99 {
100 	return -1;
101 }
102 
103 
tls_connection_get_eap_fast_key(void * tls_ctx,struct tls_connection * conn,u8 * out,size_t out_len)104 int tls_connection_get_eap_fast_key(void *tls_ctx, struct tls_connection *conn,
105 				    u8 *out, size_t out_len)
106 {
107 	return -1;
108 }
109 
110 
tls_connection_handshake(void * tls_ctx,struct tls_connection * conn,const struct wpabuf * in_data,struct wpabuf ** appl_data)111 struct wpabuf * tls_connection_handshake(void *tls_ctx,
112 					 struct tls_connection *conn,
113 					 const struct wpabuf *in_data,
114 					 struct wpabuf **appl_data)
115 {
116 	return NULL;
117 }
118 
119 
tls_connection_server_handshake(void * tls_ctx,struct tls_connection * conn,const struct wpabuf * in_data,struct wpabuf ** appl_data)120 struct wpabuf * tls_connection_server_handshake(void *tls_ctx,
121 						struct tls_connection *conn,
122 						const struct wpabuf *in_data,
123 						struct wpabuf **appl_data)
124 {
125 	return NULL;
126 }
127 
128 
tls_connection_encrypt(void * tls_ctx,struct tls_connection * conn,const struct wpabuf * in_data)129 struct wpabuf * tls_connection_encrypt(void *tls_ctx,
130 				       struct tls_connection *conn,
131 				       const struct wpabuf *in_data)
132 {
133 	return NULL;
134 }
135 
136 
tls_connection_decrypt(void * tls_ctx,struct tls_connection * conn,const struct wpabuf * in_data)137 struct wpabuf * tls_connection_decrypt(void *tls_ctx,
138 				       struct tls_connection *conn,
139 				       const struct wpabuf *in_data)
140 {
141 	return NULL;
142 }
143 
144 
tls_connection_resumed(void * tls_ctx,struct tls_connection * conn)145 int tls_connection_resumed(void *tls_ctx, struct tls_connection *conn)
146 {
147 	return 0;
148 }
149 
150 
tls_connection_set_cipher_list(void * tls_ctx,struct tls_connection * conn,u8 * ciphers)151 int tls_connection_set_cipher_list(void *tls_ctx, struct tls_connection *conn,
152 				   u8 *ciphers)
153 {
154 	return -1;
155 }
156 
157 
tls_get_version(void * ssl_ctx,struct tls_connection * conn,char * buf,size_t buflen)158 int tls_get_version(void *ssl_ctx, struct tls_connection *conn,
159 		    char *buf, size_t buflen)
160 {
161 	return -1;
162 }
163 
164 
tls_get_cipher(void * tls_ctx,struct tls_connection * conn,char * buf,size_t buflen)165 int tls_get_cipher(void *tls_ctx, struct tls_connection *conn,
166 		   char *buf, size_t buflen)
167 {
168 	return -1;
169 }
170 
171 
tls_connection_enable_workaround(void * tls_ctx,struct tls_connection * conn)172 int tls_connection_enable_workaround(void *tls_ctx,
173 				     struct tls_connection *conn)
174 {
175 	return -1;
176 }
177 
178 
tls_connection_client_hello_ext(void * tls_ctx,struct tls_connection * conn,int ext_type,const u8 * data,size_t data_len)179 int tls_connection_client_hello_ext(void *tls_ctx, struct tls_connection *conn,
180 				    int ext_type, const u8 *data,
181 				    size_t data_len)
182 {
183 	return -1;
184 }
185 
186 
tls_connection_get_failed(void * tls_ctx,struct tls_connection * conn)187 int tls_connection_get_failed(void *tls_ctx, struct tls_connection *conn)
188 {
189 	return 0;
190 }
191 
192 
tls_connection_get_read_alerts(void * tls_ctx,struct tls_connection * conn)193 int tls_connection_get_read_alerts(void *tls_ctx, struct tls_connection *conn)
194 {
195 	return 0;
196 }
197 
198 
tls_connection_get_write_alerts(void * tls_ctx,struct tls_connection * conn)199 int tls_connection_get_write_alerts(void *tls_ctx,
200 				    struct tls_connection *conn)
201 {
202 	return 0;
203 }
204 
205 
tls_get_library_version(char * buf,size_t buf_len)206 int tls_get_library_version(char *buf, size_t buf_len)
207 {
208 	return os_snprintf(buf, buf_len, "none");
209 }
210 
211 
tls_connection_set_success_data(struct tls_connection * conn,struct wpabuf * data)212 void tls_connection_set_success_data(struct tls_connection *conn,
213 				     struct wpabuf *data)
214 {
215 	wpabuf_free(data);
216 }
217 
218 
tls_connection_set_success_data_resumed(struct tls_connection * conn)219 void tls_connection_set_success_data_resumed(struct tls_connection *conn)
220 {
221 }
222 
223 
224 const struct wpabuf *
tls_connection_get_success_data(struct tls_connection * conn)225 tls_connection_get_success_data(struct tls_connection *conn)
226 {
227 	return NULL;
228 }
229 
230 
tls_connection_remove_session(struct tls_connection * conn)231 void tls_connection_remove_session(struct tls_connection *conn)
232 {
233 }
234