blob: a4f954c7a88569f4d8d4d2401c49f6434258b74a [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * SSL/TLS interface definition
Dmitry Shmidt34af3062013-07-11 10:46:32 -07003 * Copyright (c) 2004-2013, Jouni Malinen <j@w1.fi>
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07004 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#ifndef TLS_H
10#define TLS_H
11
12struct tls_connection;
13
14struct tls_keys {
15 const u8 *master_key; /* TLS master secret */
16 size_t master_key_len;
17 const u8 *client_random;
18 size_t client_random_len;
19 const u8 *server_random;
20 size_t server_random_len;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070021};
22
23enum tls_event {
Dmitry Shmidt04949592012-07-19 12:16:46 -070024 TLS_CERT_CHAIN_SUCCESS,
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070025 TLS_CERT_CHAIN_FAILURE,
Dmitry Shmidt04949592012-07-19 12:16:46 -070026 TLS_PEER_CERTIFICATE,
27 TLS_ALERT
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070028};
29
30/*
31 * Note: These are used as identifier with external programs and as such, the
32 * values must not be changed.
33 */
34enum tls_fail_reason {
35 TLS_FAIL_UNSPECIFIED = 0,
36 TLS_FAIL_UNTRUSTED = 1,
37 TLS_FAIL_REVOKED = 2,
38 TLS_FAIL_NOT_YET_VALID = 3,
39 TLS_FAIL_EXPIRED = 4,
40 TLS_FAIL_SUBJECT_MISMATCH = 5,
41 TLS_FAIL_ALTSUBJECT_MISMATCH = 6,
42 TLS_FAIL_BAD_CERTIFICATE = 7,
Dmitry Shmidt051af732013-10-22 13:52:46 -070043 TLS_FAIL_SERVER_CHAIN_PROBE = 8,
Dmitry Shmidtec58b162014-02-19 12:44:18 -080044 TLS_FAIL_DOMAIN_SUFFIX_MISMATCH = 9
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070045};
46
47union tls_event_data {
48 struct {
49 int depth;
50 const char *subject;
51 enum tls_fail_reason reason;
52 const char *reason_txt;
53 const struct wpabuf *cert;
54 } cert_fail;
55
56 struct {
57 int depth;
58 const char *subject;
59 const struct wpabuf *cert;
60 const u8 *hash;
61 size_t hash_len;
62 } peer_cert;
Dmitry Shmidt04949592012-07-19 12:16:46 -070063
64 struct {
65 int is_local;
66 const char *type;
67 const char *description;
68 } alert;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070069};
70
71struct tls_config {
72 const char *opensc_engine_path;
73 const char *pkcs11_engine_path;
74 const char *pkcs11_module_path;
75 int fips_mode;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080076 int cert_in_cb;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080077 const char *openssl_ciphers;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070078
79 void (*event_cb)(void *ctx, enum tls_event ev,
80 union tls_event_data *data);
81 void *cb_ctx;
82};
83
84#define TLS_CONN_ALLOW_SIGN_RSA_MD5 BIT(0)
85#define TLS_CONN_DISABLE_TIME_CHECKS BIT(1)
Dmitry Shmidt61d9df32012-08-29 16:22:06 -070086#define TLS_CONN_DISABLE_SESSION_TICKET BIT(2)
Dmitry Shmidt34af3062013-07-11 10:46:32 -070087#define TLS_CONN_REQUEST_OCSP BIT(3)
88#define TLS_CONN_REQUIRE_OCSP BIT(4)
Dmitry Shmidt13ca8d82014-02-20 10:18:40 -080089#define TLS_CONN_DISABLE_TLSv1_1 BIT(5)
90#define TLS_CONN_DISABLE_TLSv1_2 BIT(6)
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080091#define TLS_CONN_EAP_FAST BIT(7)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070092
93/**
94 * struct tls_connection_params - Parameters for TLS connection
95 * @ca_cert: File or reference name for CA X.509 certificate in PEM or DER
96 * format
97 * @ca_cert_blob: ca_cert as inlined data or %NULL if not used
98 * @ca_cert_blob_len: ca_cert_blob length
99 * @ca_path: Path to CA certificates (OpenSSL specific)
100 * @subject_match: String to match in the subject of the peer certificate or
101 * %NULL to allow all subjects
102 * @altsubject_match: String to match in the alternative subject of the peer
103 * certificate or %NULL to allow all alternative subjects
Dmitry Shmidt051af732013-10-22 13:52:46 -0700104 * @suffix_match: String to suffix match in the dNSName or CN of the peer
105 * certificate or %NULL to allow all domain names
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700106 * @client_cert: File or reference name for client X.509 certificate in PEM or
107 * DER format
108 * @client_cert_blob: client_cert as inlined data or %NULL if not used
109 * @client_cert_blob_len: client_cert_blob length
110 * @private_key: File or reference name for client private key in PEM or DER
111 * format (traditional format (RSA PRIVATE KEY) or PKCS#8 (PRIVATE KEY)
112 * @private_key_blob: private_key as inlined data or %NULL if not used
113 * @private_key_blob_len: private_key_blob length
114 * @private_key_passwd: Passphrase for decrypted private key, %NULL if no
115 * passphrase is used.
116 * @dh_file: File name for DH/DSA data in PEM format, or %NULL if not used
117 * @dh_blob: dh_file as inlined data or %NULL if not used
118 * @dh_blob_len: dh_blob length
119 * @engine: 1 = use engine (e.g., a smartcard) for private key operations
120 * (this is OpenSSL specific for now)
121 * @engine_id: engine id string (this is OpenSSL specific for now)
122 * @ppin: pointer to the pin variable in the configuration
123 * (this is OpenSSL specific for now)
124 * @key_id: the private key's id when using engine (this is OpenSSL
125 * specific for now)
126 * @cert_id: the certificate's id when using engine
127 * @ca_cert_id: the CA certificate's id when using engine
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800128 * @openssl_ciphers: OpenSSL cipher configuration
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700129 * @flags: Parameter options (TLS_CONN_*)
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700130 * @ocsp_stapling_response: DER encoded file with cached OCSP stapling response
131 * or %NULL if OCSP is not enabled
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700132 *
133 * TLS connection parameters to be configured with tls_connection_set_params()
134 * and tls_global_set_params().
135 *
136 * Certificates and private key can be configured either as a reference name
137 * (file path or reference to certificate store) or by providing the same data
138 * as a pointer to the data in memory. Only one option will be used for each
139 * field.
140 */
141struct tls_connection_params {
142 const char *ca_cert;
143 const u8 *ca_cert_blob;
144 size_t ca_cert_blob_len;
145 const char *ca_path;
146 const char *subject_match;
147 const char *altsubject_match;
Dmitry Shmidt051af732013-10-22 13:52:46 -0700148 const char *suffix_match;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700149 const char *client_cert;
150 const u8 *client_cert_blob;
151 size_t client_cert_blob_len;
152 const char *private_key;
153 const u8 *private_key_blob;
154 size_t private_key_blob_len;
155 const char *private_key_passwd;
156 const char *dh_file;
157 const u8 *dh_blob;
158 size_t dh_blob_len;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700159
160 /* OpenSSL specific variables */
161 int engine;
162 const char *engine_id;
163 const char *pin;
164 const char *key_id;
165 const char *cert_id;
166 const char *ca_cert_id;
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800167 const char *openssl_ciphers;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700168
169 unsigned int flags;
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700170 const char *ocsp_stapling_response;
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700171};
172
173
174/**
175 * tls_init - Initialize TLS library
176 * @conf: Configuration data for TLS library
177 * Returns: Context data to be used as tls_ctx in calls to other functions,
178 * or %NULL on failure.
179 *
180 * Called once during program startup and once for each RSN pre-authentication
181 * session. In other words, there can be two concurrent TLS contexts. If global
182 * library initialization is needed (i.e., one that is shared between both
183 * authentication types), the TLS library wrapper should maintain a reference
184 * counter and do global initialization only when moving from 0 to 1 reference.
185 */
186void * tls_init(const struct tls_config *conf);
187
188/**
189 * tls_deinit - Deinitialize TLS library
190 * @tls_ctx: TLS context data from tls_init()
191 *
192 * Called once during program shutdown and once for each RSN pre-authentication
193 * session. If global library deinitialization is needed (i.e., one that is
194 * shared between both authentication types), the TLS library wrapper should
195 * maintain a reference counter and do global deinitialization only when moving
196 * from 1 to 0 references.
197 */
198void tls_deinit(void *tls_ctx);
199
200/**
201 * tls_get_errors - Process pending errors
202 * @tls_ctx: TLS context data from tls_init()
203 * Returns: Number of found error, 0 if no errors detected.
204 *
205 * Process all pending TLS errors.
206 */
207int tls_get_errors(void *tls_ctx);
208
209/**
210 * tls_connection_init - Initialize a new TLS connection
211 * @tls_ctx: TLS context data from tls_init()
212 * Returns: Connection context data, conn for other function calls
213 */
214struct tls_connection * tls_connection_init(void *tls_ctx);
215
216/**
217 * tls_connection_deinit - Free TLS connection data
218 * @tls_ctx: TLS context data from tls_init()
219 * @conn: Connection context data from tls_connection_init()
220 *
221 * Release all resources allocated for TLS connection.
222 */
223void tls_connection_deinit(void *tls_ctx, struct tls_connection *conn);
224
225/**
226 * tls_connection_established - Has the TLS connection been completed?
227 * @tls_ctx: TLS context data from tls_init()
228 * @conn: Connection context data from tls_connection_init()
229 * Returns: 1 if TLS connection has been completed, 0 if not.
230 */
231int tls_connection_established(void *tls_ctx, struct tls_connection *conn);
232
233/**
234 * tls_connection_shutdown - Shutdown TLS connection
235 * @tls_ctx: TLS context data from tls_init()
236 * @conn: Connection context data from tls_connection_init()
237 * Returns: 0 on success, -1 on failure
238 *
239 * Shutdown current TLS connection without releasing all resources. New
240 * connection can be started by using the same conn without having to call
241 * tls_connection_init() or setting certificates etc. again. The new
242 * connection should try to use session resumption.
243 */
244int tls_connection_shutdown(void *tls_ctx, struct tls_connection *conn);
245
246enum {
247 TLS_SET_PARAMS_ENGINE_PRV_VERIFY_FAILED = -3,
248 TLS_SET_PARAMS_ENGINE_PRV_INIT_FAILED = -2
249};
250
251/**
252 * tls_connection_set_params - Set TLS connection parameters
253 * @tls_ctx: TLS context data from tls_init()
254 * @conn: Connection context data from tls_connection_init()
255 * @params: Connection parameters
256 * Returns: 0 on success, -1 on failure,
257 * TLS_SET_PARAMS_ENGINE_PRV_INIT_FAILED (-2) on possible PIN error causing
258 * PKCS#11 engine failure, or
259 * TLS_SET_PARAMS_ENGINE_PRV_VERIFY_FAILED (-3) on failure to verify the
260 * PKCS#11 engine private key.
261 */
262int __must_check
263tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
264 const struct tls_connection_params *params);
265
266/**
267 * tls_global_set_params - Set TLS parameters for all TLS connection
268 * @tls_ctx: TLS context data from tls_init()
269 * @params: Global TLS parameters
270 * Returns: 0 on success, -1 on failure,
271 * TLS_SET_PARAMS_ENGINE_PRV_INIT_FAILED (-2) on possible PIN error causing
272 * PKCS#11 engine failure, or
273 * TLS_SET_PARAMS_ENGINE_PRV_VERIFY_FAILED (-3) on failure to verify the
274 * PKCS#11 engine private key.
275 */
276int __must_check tls_global_set_params(
277 void *tls_ctx, const struct tls_connection_params *params);
278
279/**
280 * tls_global_set_verify - Set global certificate verification options
281 * @tls_ctx: TLS context data from tls_init()
282 * @check_crl: 0 = do not verify CRLs, 1 = verify CRL for the user certificate,
283 * 2 = verify CRL for all certificates
284 * Returns: 0 on success, -1 on failure
285 */
286int __must_check tls_global_set_verify(void *tls_ctx, int check_crl);
287
288/**
289 * tls_connection_set_verify - Set certificate verification options
290 * @tls_ctx: TLS context data from tls_init()
291 * @conn: Connection context data from tls_connection_init()
292 * @verify_peer: 1 = verify peer certificate
293 * Returns: 0 on success, -1 on failure
294 */
295int __must_check tls_connection_set_verify(void *tls_ctx,
296 struct tls_connection *conn,
297 int verify_peer);
298
299/**
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700300 * tls_connection_get_keys - Get master key and random data from TLS connection
301 * @tls_ctx: TLS context data from tls_init()
302 * @conn: Connection context data from tls_connection_init()
303 * @keys: Structure of key/random data (filled on success)
304 * Returns: 0 on success, -1 on failure
305 */
306int __must_check tls_connection_get_keys(void *tls_ctx,
307 struct tls_connection *conn,
308 struct tls_keys *keys);
309
310/**
311 * tls_connection_prf - Use TLS-PRF to derive keying material
312 * @tls_ctx: TLS context data from tls_init()
313 * @conn: Connection context data from tls_connection_init()
314 * @label: Label (e.g., description of the key) for PRF
315 * @server_random_first: seed is 0 = client_random|server_random,
316 * 1 = server_random|client_random
317 * @out: Buffer for output data from TLS-PRF
318 * @out_len: Length of the output buffer
319 * Returns: 0 on success, -1 on failure
320 *
321 * This function is optional to implement if tls_connection_get_keys() provides
322 * access to master secret and server/client random values. If these values are
323 * not exported from the TLS library, tls_connection_prf() is required so that
324 * further keying material can be derived from the master secret. If not
325 * implemented, the function will still need to be defined, but it can just
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800326 * return -1. Example implementation of this function is in tls_prf_sha1_md5()
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700327 * when it is called with seed set to client_random|server_random (or
328 * server_random|client_random).
329 */
330int __must_check tls_connection_prf(void *tls_ctx,
331 struct tls_connection *conn,
332 const char *label,
333 int server_random_first,
334 u8 *out, size_t out_len);
335
336/**
337 * tls_connection_handshake - Process TLS handshake (client side)
338 * @tls_ctx: TLS context data from tls_init()
339 * @conn: Connection context data from tls_connection_init()
340 * @in_data: Input data from TLS server
341 * @appl_data: Pointer to application data pointer, or %NULL if dropped
342 * Returns: Output data, %NULL on failure
343 *
344 * The caller is responsible for freeing the returned output data. If the final
345 * handshake message includes application data, this is decrypted and
346 * appl_data (if not %NULL) is set to point this data. The caller is
347 * responsible for freeing appl_data.
348 *
349 * This function is used during TLS handshake. The first call is done with
350 * in_data == %NULL and the library is expected to return ClientHello packet.
351 * This packet is then send to the server and a response from server is given
352 * to TLS library by calling this function again with in_data pointing to the
353 * TLS message from the server.
354 *
355 * If the TLS handshake fails, this function may return %NULL. However, if the
356 * TLS library has a TLS alert to send out, that should be returned as the
357 * output data. In this case, tls_connection_get_failed() must return failure
358 * (> 0).
359 *
360 * tls_connection_established() should return 1 once the TLS handshake has been
361 * completed successfully.
362 */
363struct wpabuf * tls_connection_handshake(void *tls_ctx,
364 struct tls_connection *conn,
365 const struct wpabuf *in_data,
366 struct wpabuf **appl_data);
367
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800368struct wpabuf * tls_connection_handshake2(void *tls_ctx,
369 struct tls_connection *conn,
370 const struct wpabuf *in_data,
371 struct wpabuf **appl_data,
372 int *more_data_needed);
373
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700374/**
375 * tls_connection_server_handshake - Process TLS handshake (server side)
376 * @tls_ctx: TLS context data from tls_init()
377 * @conn: Connection context data from tls_connection_init()
378 * @in_data: Input data from TLS peer
379 * @appl_data: Pointer to application data pointer, or %NULL if dropped
380 * Returns: Output data, %NULL on failure
381 *
382 * The caller is responsible for freeing the returned output data.
383 */
384struct wpabuf * tls_connection_server_handshake(void *tls_ctx,
385 struct tls_connection *conn,
386 const struct wpabuf *in_data,
387 struct wpabuf **appl_data);
388
389/**
390 * tls_connection_encrypt - Encrypt data into TLS tunnel
391 * @tls_ctx: TLS context data from tls_init()
392 * @conn: Connection context data from tls_connection_init()
393 * @in_data: Plaintext data to be encrypted
394 * Returns: Encrypted TLS data or %NULL on failure
395 *
396 * This function is used after TLS handshake has been completed successfully to
397 * send data in the encrypted tunnel. The caller is responsible for freeing the
398 * returned output data.
399 */
400struct wpabuf * tls_connection_encrypt(void *tls_ctx,
401 struct tls_connection *conn,
402 const struct wpabuf *in_data);
403
404/**
405 * tls_connection_decrypt - Decrypt data from TLS tunnel
406 * @tls_ctx: TLS context data from tls_init()
407 * @conn: Connection context data from tls_connection_init()
408 * @in_data: Encrypted TLS data
409 * Returns: Decrypted TLS data or %NULL on failure
410 *
411 * This function is used after TLS handshake has been completed successfully to
412 * receive data from the encrypted tunnel. The caller is responsible for
413 * freeing the returned output data.
414 */
415struct wpabuf * tls_connection_decrypt(void *tls_ctx,
416 struct tls_connection *conn,
417 const struct wpabuf *in_data);
418
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800419struct wpabuf * tls_connection_decrypt2(void *tls_ctx,
420 struct tls_connection *conn,
421 const struct wpabuf *in_data,
422 int *more_data_needed);
423
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700424/**
425 * tls_connection_resumed - Was session resumption used
426 * @tls_ctx: TLS context data from tls_init()
427 * @conn: Connection context data from tls_connection_init()
428 * Returns: 1 if current session used session resumption, 0 if not
429 */
430int tls_connection_resumed(void *tls_ctx, struct tls_connection *conn);
431
432enum {
433 TLS_CIPHER_NONE,
434 TLS_CIPHER_RC4_SHA /* 0x0005 */,
435 TLS_CIPHER_AES128_SHA /* 0x002f */,
436 TLS_CIPHER_RSA_DHE_AES128_SHA /* 0x0031 */,
437 TLS_CIPHER_ANON_DH_AES128_SHA /* 0x0034 */
438};
439
440/**
441 * tls_connection_set_cipher_list - Configure acceptable cipher suites
442 * @tls_ctx: TLS context data from tls_init()
443 * @conn: Connection context data from tls_connection_init()
444 * @ciphers: Zero (TLS_CIPHER_NONE) terminated list of allowed ciphers
445 * (TLS_CIPHER_*).
446 * Returns: 0 on success, -1 on failure
447 */
448int __must_check tls_connection_set_cipher_list(void *tls_ctx,
449 struct tls_connection *conn,
450 u8 *ciphers);
451
452/**
453 * tls_get_cipher - Get current cipher name
454 * @tls_ctx: TLS context data from tls_init()
455 * @conn: Connection context data from tls_connection_init()
456 * @buf: Buffer for the cipher name
457 * @buflen: buf size
458 * Returns: 0 on success, -1 on failure
459 *
460 * Get the name of the currently used cipher.
461 */
462int __must_check tls_get_cipher(void *tls_ctx, struct tls_connection *conn,
463 char *buf, size_t buflen);
464
465/**
466 * tls_connection_enable_workaround - Enable TLS workaround options
467 * @tls_ctx: TLS context data from tls_init()
468 * @conn: Connection context data from tls_connection_init()
469 * Returns: 0 on success, -1 on failure
470 *
471 * This function is used to enable connection-specific workaround options for
472 * buffer SSL/TLS implementations.
473 */
474int __must_check tls_connection_enable_workaround(void *tls_ctx,
475 struct tls_connection *conn);
476
477/**
478 * tls_connection_client_hello_ext - Set TLS extension for ClientHello
479 * @tls_ctx: TLS context data from tls_init()
480 * @conn: Connection context data from tls_connection_init()
481 * @ext_type: Extension type
482 * @data: Extension payload (%NULL to remove extension)
483 * @data_len: Extension payload length
484 * Returns: 0 on success, -1 on failure
485 */
486int __must_check tls_connection_client_hello_ext(void *tls_ctx,
487 struct tls_connection *conn,
488 int ext_type, const u8 *data,
489 size_t data_len);
490
491/**
492 * tls_connection_get_failed - Get connection failure status
493 * @tls_ctx: TLS context data from tls_init()
494 * @conn: Connection context data from tls_connection_init()
495 *
496 * Returns >0 if connection has failed, 0 if not.
497 */
498int tls_connection_get_failed(void *tls_ctx, struct tls_connection *conn);
499
500/**
501 * tls_connection_get_read_alerts - Get connection read alert status
502 * @tls_ctx: TLS context data from tls_init()
503 * @conn: Connection context data from tls_connection_init()
504 * Returns: Number of times a fatal read (remote end reported error) has
505 * happened during this connection.
506 */
507int tls_connection_get_read_alerts(void *tls_ctx, struct tls_connection *conn);
508
509/**
510 * tls_connection_get_write_alerts - Get connection write alert status
511 * @tls_ctx: TLS context data from tls_init()
512 * @conn: Connection context data from tls_connection_init()
513 * Returns: Number of times a fatal write (locally detected error) has happened
514 * during this connection.
515 */
516int tls_connection_get_write_alerts(void *tls_ctx,
517 struct tls_connection *conn);
518
519/**
520 * tls_connection_get_keyblock_size - Get TLS key_block size
521 * @tls_ctx: TLS context data from tls_init()
522 * @conn: Connection context data from tls_connection_init()
523 * Returns: Size of the key_block for the negotiated cipher suite or -1 on
524 * failure
525 */
526int tls_connection_get_keyblock_size(void *tls_ctx,
527 struct tls_connection *conn);
528
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700529/**
530 * tls_capabilities - Get supported TLS capabilities
531 * @tls_ctx: TLS context data from tls_init()
532 * Returns: Bit field of supported TLS capabilities (TLS_CAPABILITY_*)
533 */
534unsigned int tls_capabilities(void *tls_ctx);
535
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700536typedef int (*tls_session_ticket_cb)
537(void *ctx, const u8 *ticket, size_t len, const u8 *client_random,
538 const u8 *server_random, u8 *master_secret);
539
540int __must_check tls_connection_set_session_ticket_cb(
541 void *tls_ctx, struct tls_connection *conn,
542 tls_session_ticket_cb cb, void *ctx);
543
Dmitry Shmidt818ea482014-03-10 13:15:21 -0700544void tls_connection_set_log_cb(struct tls_connection *conn,
545 void (*log_cb)(void *ctx, const char *msg),
546 void *ctx);
547
548#define TLS_BREAK_VERIFY_DATA BIT(0)
549#define TLS_BREAK_SRV_KEY_X_HASH BIT(1)
550#define TLS_BREAK_SRV_KEY_X_SIGNATURE BIT(2)
Dmitry Shmidtb36ed7c2014-03-17 10:57:26 -0700551#define TLS_DHE_PRIME_511B BIT(3)
552#define TLS_DHE_PRIME_767B BIT(4)
553#define TLS_DHE_PRIME_15 BIT(5)
554#define TLS_DHE_PRIME_58B BIT(6)
555#define TLS_DHE_NON_PRIME BIT(7)
Dmitry Shmidt818ea482014-03-10 13:15:21 -0700556
557void tls_connection_set_test_flags(struct tls_connection *conn, u32 flags);
558
Dmitry Shmidtff787d52015-01-12 13:01:47 -0800559int tls_get_library_version(char *buf, size_t buf_len);
560
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700561#endif /* TLS_H */