-
Notifications
You must be signed in to change notification settings - Fork 181
/
sslcls.c
318 lines (276 loc) · 8.35 KB
/
sslcls.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/* source: sslcls.c */
/* Copyright Gerhard Rieger 2001-2007 */
/* Published under the GNU General Public License V.2, see file COPYING */
/* explicit system call and C library trace function, for those who miss strace
*/
#include "config.h"
#include "xioconfig.h" /* what features are enabled */
#if WITH_SYCLS && WITH_OPENSSL
#include "sysincludes.h"
#include "mytypes.h"
#include "compat.h"
#include "errno.h"
#include "error.h"
#include "filan.h"
#include "sysutils.h"
#include "sycls.h"
void sycSSL_load_error_strings(void) {
Debug("SSL_load_error_strings()");
SSL_load_error_strings();
Debug("SSL_load_error_strings() ->");
}
int sycSSL_library_init(void) {
int result;
Debug("SSL_library_init()");
result = SSL_library_init();
Debug1("SSL_library_init() -> %d", result);
return result;
}
SSL_METHOD *sycSSLv2_client_method(void) {
SSL_METHOD *result;
Debug("SSLv2_client_method()");
result = SSLv2_client_method();
Debug1("SSLv2_client_method() -> %p", result);
return result;
}
SSL_METHOD *sycSSLv2_server_method(void) {
SSL_METHOD *result;
Debug("SSLv2_server_method()");
result = SSLv2_server_method();
Debug1("SSLv2_server_method() -> %p", result);
return result;
}
SSL_METHOD *sycSSLv3_client_method(void) {
SSL_METHOD *result;
Debug("SSLv3_client_method()");
result = SSLv3_client_method();
Debug1("SSLv3_client_method() -> %p", result);
return result;
}
SSL_METHOD *sycSSLv3_server_method(void) {
SSL_METHOD *result;
Debug("SSLv3_server_method()");
result = SSLv3_server_method();
Debug1("SSLv3_server_method() -> %p", result);
return result;
}
SSL_METHOD *sycSSLv23_client_method(void) {
SSL_METHOD *result;
Debug("SSLv23_client_method()");
result = SSLv23_client_method();
Debug1("SSLv23_client_method() -> %p", result);
return result;
}
SSL_METHOD *sycSSLv23_server_method(void) {
SSL_METHOD *result;
Debug("SSLv23_server_method()");
result = SSLv23_server_method();
Debug1("SSLv23_server_method() -> %p", result);
return result;
}
SSL_METHOD *sycTLSv1_client_method(void) {
SSL_METHOD *result;
Debug("TLSv1_client_method()");
result = TLSv1_client_method();
Debug1("TLSv1_client_method() -> %p", result);
return result;
}
SSL_METHOD *sycTLSv1_server_method(void) {
SSL_METHOD *result;
Debug("TLSv1_server_method()");
result = TLSv1_server_method();
Debug1("TLSv1_server_method() -> %p", result);
return result;
}
SSL_CTX *sycSSL_CTX_new(SSL_METHOD *method) {
SSL_CTX *result;
Debug1("SSL_CTX_new(%p)", method);
result = SSL_CTX_new(method);
Debug1("SSL_CTX_new() -> %p", result);
return result;
}
SSL *sycSSL_new(SSL_CTX *ctx) {
SSL *result;
Debug1("SSL_new(%p)", ctx);
result = SSL_new(ctx);
Debug1("SSL_new() -> %p", result);
return result;
}
int sycSSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
const char *CApath) {
int result;
Debug7("SSL_CTX_load_verify_locations(%p, %s%s%s, %s%s%s)", ctx,
CAfile?"\"":"", CAfile?CAfile:NULL, CAfile?"\"":"",
CApath?"\"":"", CApath?CApath:NULL, CApath?"\"":"");
result = SSL_CTX_load_verify_locations(ctx, CAfile, CApath);
Debug1("SSL_CTX_load_verify_locations() -> %d", result);
return result;
}
int sycSSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type) {
int result;
Debug3("SSL_CTX_use_certificate_file(%p, \"%s\", %d)", ctx, file, type);
result = SSL_CTX_use_certificate_file(ctx, file, type);
Debug1("SSL_CTX_use_certificate_file() -> %d", result);
return result;
}
int sycSSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) {
int result;
Debug2("SSL_CTX_use_certificate_chain_file(%p, \"%s\")", ctx, file);
result = SSL_CTX_use_certificate_chain_file(ctx, file);
Debug1("SSL_CTX_use_certificate_chain_file() -> %d", result);
return result;
}
int sycSSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type) {
int result;
Debug3("SSL_CTX_use_PrivateKey_file(%p, \"%s\", %d)", ctx, file, type);
result = SSL_CTX_use_PrivateKey_file(ctx, file, type);
Debug1("SSL_CTX_use_PrivateKey_file() -> %d", result);
return result;
}
void sycSSL_CTX_set_verify(SSL_CTX *ctx, int mode,
int (*verify_callback)(int, X509_STORE_CTX *)) {
Debug3("SSL_CTX_set_verify(%p, %u, %p)", ctx, mode, verify_callback);
SSL_CTX_set_verify(ctx, mode, verify_callback);
Debug("SSL_CTX_set_verify() -> ");
}
int sycSSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
int result;
Debug2("SSL_CTX_set_cipher_list(%p, \"%s\")", ctx, str);
result = SSL_CTX_set_cipher_list(ctx, str);
Debug1("SSL_CTX_set_cipher_list() -> %d", result);
return result;
}
int sycSSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh) {
int result;
Debug2("SSL_CTX_set_tmp_dh(%p, %p)", ctx, dh);
result = SSL_CTX_set_tmp_dh(ctx, dh);
Debug1("SSL_CTX_set_tmp_dh() -> %d", result);
return result;
}
int sycSSL_set_cipher_list(SSL *ssl, const char *str) {
int result;
Debug2("SSL_set_cipher_list(%p, \"%s\")", ssl, str);
result = SSL_set_cipher_list(ssl, str);
Debug1("SSL_set_cipher_list() -> %d", result);
return result;
}
long sycSSL_get_verify_result(SSL *ssl) {
long result;
Debug1("SSL_get_verify_result(%p)", ssl);
result = SSL_get_verify_result(ssl);
Debug1("SSL_get_verify_result() -> %lx", result);
return result;
}
int sycSSL_set_fd(SSL *ssl, int fd) {
int result;
Debug2("SSL_set_fd(%p, %d)", ssl, fd);
result = SSL_set_fd(ssl, fd);
Debug1("SSL_set_fd() -> %d", result);
return result;
}
int sycSSL_connect(SSL *ssl) {
int result;
Debug1("SSL_connect(%p)", ssl);
result = SSL_connect(ssl);
Debug1("SSL_connect() -> %d", result);
return result;
}
int sycSSL_accept(SSL *ssl) {
int result;
Debug1("SSL_accept(%p)", ssl);
result = SSL_accept(ssl);
Debug1("SSL_accept() -> %d", result);
return result;
}
int sycSSL_read(SSL *ssl, void *buf, int num) {
int result;
Debug3("SSL_read(%p, %p, %d)", ssl, buf, num);
result = SSL_read(ssl, buf, num);
Debug1("SSL_read() -> %d", result);
return result;
}
int sycSSL_pending(SSL *ssl) {
int result;
Debug1("SSL_pending(%p)", ssl);
result = SSL_pending(ssl);
Debug1("SSL_pending() -> %d", result);
return result;
}
int sycSSL_write(SSL *ssl, const void *buf, int num) {
int result;
Debug3("SSL_write(%p, %p, %d)", ssl, buf, num);
result = SSL_write(ssl, buf, num);
Debug1("SSL_write() -> %d", result);
return result;
}
X509 *sycSSL_get_peer_certificate(SSL *ssl) {
X509 *result;
Debug1("SSL_get_peer_certificate(%p)", ssl);
result = SSL_get_peer_certificate(ssl);
if (result) {
Debug1("SSL_get_peer_certificate() -> %p", result);
} else {
Debug("SSL_get_peer_certificate() -> NULL");
}
return result;
}
int sycSSL_shutdown(SSL *ssl) {
int result;
Debug1("SSL_shutdown(%p)", ssl);
result = SSL_shutdown(ssl);
Debug1("SSL_shutdown() -> %d", result);
return result;
}
void sycSSL_CTX_free(SSL_CTX *ctx) {
Debug1("SSL_CTX_free(%p)", ctx);
SSL_CTX_free(ctx);
Debug("SSL_CTX_free() -> void");
return;
}
void sycSSL_free(SSL *ssl) {
Debug1("SSL_free(%p)", ssl);
SSL_free(ssl);
Debug("SSL_free() -> void");
return;
}
int sycRAND_egd(const char *path) {
int result;
Debug1("RAND_egd(\"%s\")", path);
result = RAND_egd(path);
Debug1("RAND_egd() -> %d", result);
return result;
}
DH *sycPEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u) {
DH *result;
Debug4("PEM_read_bio_DHparams(%p, %p, %p, %p)",
bp, x, cb, u);
result = PEM_read_bio_DHparams(bp, x, cb, u);
if (result) {
/*Debug2("PEM_read_bio_DHparams(, {%p},,) -> %p", *x, result);*/
Debug1("PEM_read_bio_DHparams() -> %p", result);
} else {
Debug("PEM_read_bio_DHparams() -> NULL");
}
return result;
}
BIO *sycBIO_new_file(const char *filename, const char *mode) {
BIO *result;
Debug2("BIO_new_file(\"%s\", \"%s\")", filename, mode);
result = BIO_new_file(filename, mode);
if (result) {
Debug1("BIO_new_file() -> %p", result);
} else {
Debug("BIO_new_file() -> NULL");
}
return result;
}
#if WITH_FIPS
int sycFIPS_mode_set(int onoff) {
int result;
Debug1("FIPS_mode_set(%d)", onoff);
result = FIPS_mode_set(onoff);
Debug1("FIPS_mode_set() -> %d", result);
return result;
}
#endif /* WITH_FIPS */
#endif /* WITH_SYCLS && WITH_OPENSSL */