]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/wpa/src/crypto/tls.h
MFV r341618:
[FreeBSD/FreeBSD.git] / contrib / wpa / src / crypto / tls.h
1 /*
2  * SSL/TLS interface definition
3  * Copyright (c) 2004-2013, 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 #ifndef TLS_H
10 #define TLS_H
11
12 struct tls_connection;
13
14 struct tls_random {
15         const u8 *client_random;
16         size_t client_random_len;
17         const u8 *server_random;
18         size_t server_random_len;
19 };
20
21 enum tls_event {
22         TLS_CERT_CHAIN_SUCCESS,
23         TLS_CERT_CHAIN_FAILURE,
24         TLS_PEER_CERTIFICATE,
25         TLS_ALERT
26 };
27
28 /*
29  * Note: These are used as identifier with external programs and as such, the
30  * values must not be changed.
31  */
32 enum tls_fail_reason {
33         TLS_FAIL_UNSPECIFIED = 0,
34         TLS_FAIL_UNTRUSTED = 1,
35         TLS_FAIL_REVOKED = 2,
36         TLS_FAIL_NOT_YET_VALID = 3,
37         TLS_FAIL_EXPIRED = 4,
38         TLS_FAIL_SUBJECT_MISMATCH = 5,
39         TLS_FAIL_ALTSUBJECT_MISMATCH = 6,
40         TLS_FAIL_BAD_CERTIFICATE = 7,
41         TLS_FAIL_SERVER_CHAIN_PROBE = 8,
42         TLS_FAIL_DOMAIN_SUFFIX_MISMATCH = 9,
43         TLS_FAIL_DOMAIN_MISMATCH = 10,
44         TLS_FAIL_INSUFFICIENT_KEY_LEN = 11,
45 };
46
47
48 #define TLS_MAX_ALT_SUBJECT 10
49
50 union tls_event_data {
51         struct {
52                 int depth;
53                 const char *subject;
54                 enum tls_fail_reason reason;
55                 const char *reason_txt;
56                 const struct wpabuf *cert;
57         } cert_fail;
58
59         struct {
60                 int depth;
61                 const char *subject;
62                 const struct wpabuf *cert;
63                 const u8 *hash;
64                 size_t hash_len;
65                 const char *altsubject[TLS_MAX_ALT_SUBJECT];
66                 int num_altsubject;
67                 const char *serial_num;
68         } peer_cert;
69
70         struct {
71                 int is_local;
72                 const char *type;
73                 const char *description;
74         } alert;
75 };
76
77 struct tls_config {
78         const char *opensc_engine_path;
79         const char *pkcs11_engine_path;
80         const char *pkcs11_module_path;
81         int fips_mode;
82         int cert_in_cb;
83         const char *openssl_ciphers;
84         unsigned int tls_session_lifetime;
85         unsigned int tls_flags;
86
87         void (*event_cb)(void *ctx, enum tls_event ev,
88                          union tls_event_data *data);
89         void *cb_ctx;
90 };
91
92 #define TLS_CONN_ALLOW_SIGN_RSA_MD5 BIT(0)
93 #define TLS_CONN_DISABLE_TIME_CHECKS BIT(1)
94 #define TLS_CONN_DISABLE_SESSION_TICKET BIT(2)
95 #define TLS_CONN_REQUEST_OCSP BIT(3)
96 #define TLS_CONN_REQUIRE_OCSP BIT(4)
97 #define TLS_CONN_DISABLE_TLSv1_1 BIT(5)
98 #define TLS_CONN_DISABLE_TLSv1_2 BIT(6)
99 #define TLS_CONN_EAP_FAST BIT(7)
100 #define TLS_CONN_DISABLE_TLSv1_0 BIT(8)
101 #define TLS_CONN_EXT_CERT_CHECK BIT(9)
102 #define TLS_CONN_REQUIRE_OCSP_ALL BIT(10)
103 #define TLS_CONN_SUITEB BIT(11)
104 #define TLS_CONN_SUITEB_NO_ECDH BIT(12)
105 #define TLS_CONN_DISABLE_TLSv1_3 BIT(13)
106
107 /**
108  * struct tls_connection_params - Parameters for TLS connection
109  * @ca_cert: File or reference name for CA X.509 certificate in PEM or DER
110  * format
111  * @ca_cert_blob: ca_cert as inlined data or %NULL if not used
112  * @ca_cert_blob_len: ca_cert_blob length
113  * @ca_path: Path to CA certificates (OpenSSL specific)
114  * @subject_match: String to match in the subject of the peer certificate or
115  * %NULL to allow all subjects
116  * @altsubject_match: String to match in the alternative subject of the peer
117  * certificate or %NULL to allow all alternative subjects
118  * @suffix_match: String to suffix match in the dNSName or CN of the peer
119  * certificate or %NULL to allow all domain names. This may allow subdomains an
120  * wildcard certificates. Each domain name label must have a full match.
121  * @domain_match: String to match in the dNSName or CN of the peer
122  * certificate or %NULL to allow all domain names. This requires a full,
123  * case-insensitive match.
124  * @client_cert: File or reference name for client X.509 certificate in PEM or
125  * DER format
126  * @client_cert_blob: client_cert as inlined data or %NULL if not used
127  * @client_cert_blob_len: client_cert_blob length
128  * @private_key: File or reference name for client private key in PEM or DER
129  * format (traditional format (RSA PRIVATE KEY) or PKCS#8 (PRIVATE KEY)
130  * @private_key_blob: private_key as inlined data or %NULL if not used
131  * @private_key_blob_len: private_key_blob length
132  * @private_key_passwd: Passphrase for decrypted private key, %NULL if no
133  * passphrase is used.
134  * @dh_file: File name for DH/DSA data in PEM format, or %NULL if not used
135  * @dh_blob: dh_file as inlined data or %NULL if not used
136  * @dh_blob_len: dh_blob length
137  * @engine: 1 = use engine (e.g., a smartcard) for private key operations
138  * (this is OpenSSL specific for now)
139  * @engine_id: engine id string (this is OpenSSL specific for now)
140  * @ppin: pointer to the pin variable in the configuration
141  * (this is OpenSSL specific for now)
142  * @key_id: the private key's id when using engine (this is OpenSSL
143  * specific for now)
144  * @cert_id: the certificate's id when using engine
145  * @ca_cert_id: the CA certificate's id when using engine
146  * @openssl_ciphers: OpenSSL cipher configuration
147  * @flags: Parameter options (TLS_CONN_*)
148  * @ocsp_stapling_response: DER encoded file with cached OCSP stapling response
149  *      or %NULL if OCSP is not enabled
150  * @ocsp_stapling_response_multi: DER encoded file with cached OCSP stapling
151  *      response list (OCSPResponseList for ocsp_multi in RFC 6961) or %NULL if
152  *      ocsp_multi is not enabled
153  *
154  * TLS connection parameters to be configured with tls_connection_set_params()
155  * and tls_global_set_params().
156  *
157  * Certificates and private key can be configured either as a reference name
158  * (file path or reference to certificate store) or by providing the same data
159  * as a pointer to the data in memory. Only one option will be used for each
160  * field.
161  */
162 struct tls_connection_params {
163         const char *ca_cert;
164         const u8 *ca_cert_blob;
165         size_t ca_cert_blob_len;
166         const char *ca_path;
167         const char *subject_match;
168         const char *altsubject_match;
169         const char *suffix_match;
170         const char *domain_match;
171         const char *client_cert;
172         const u8 *client_cert_blob;
173         size_t client_cert_blob_len;
174         const char *private_key;
175         const u8 *private_key_blob;
176         size_t private_key_blob_len;
177         const char *private_key_passwd;
178         const char *dh_file;
179         const u8 *dh_blob;
180         size_t dh_blob_len;
181
182         /* OpenSSL specific variables */
183         int engine;
184         const char *engine_id;
185         const char *pin;
186         const char *key_id;
187         const char *cert_id;
188         const char *ca_cert_id;
189         const char *openssl_ciphers;
190
191         unsigned int flags;
192         const char *ocsp_stapling_response;
193         const char *ocsp_stapling_response_multi;
194 };
195
196
197 /**
198  * tls_init - Initialize TLS library
199  * @conf: Configuration data for TLS library
200  * Returns: Context data to be used as tls_ctx in calls to other functions,
201  * or %NULL on failure.
202  *
203  * Called once during program startup and once for each RSN pre-authentication
204  * session. In other words, there can be two concurrent TLS contexts. If global
205  * library initialization is needed (i.e., one that is shared between both
206  * authentication types), the TLS library wrapper should maintain a reference
207  * counter and do global initialization only when moving from 0 to 1 reference.
208  */
209 void * tls_init(const struct tls_config *conf);
210
211 /**
212  * tls_deinit - Deinitialize TLS library
213  * @tls_ctx: TLS context data from tls_init()
214  *
215  * Called once during program shutdown and once for each RSN pre-authentication
216  * session. If global library deinitialization is needed (i.e., one that is
217  * shared between both authentication types), the TLS library wrapper should
218  * maintain a reference counter and do global deinitialization only when moving
219  * from 1 to 0 references.
220  */
221 void tls_deinit(void *tls_ctx);
222
223 /**
224  * tls_get_errors - Process pending errors
225  * @tls_ctx: TLS context data from tls_init()
226  * Returns: Number of found error, 0 if no errors detected.
227  *
228  * Process all pending TLS errors.
229  */
230 int tls_get_errors(void *tls_ctx);
231
232 /**
233  * tls_connection_init - Initialize a new TLS connection
234  * @tls_ctx: TLS context data from tls_init()
235  * Returns: Connection context data, conn for other function calls
236  */
237 struct tls_connection * tls_connection_init(void *tls_ctx);
238
239 /**
240  * tls_connection_deinit - Free TLS connection data
241  * @tls_ctx: TLS context data from tls_init()
242  * @conn: Connection context data from tls_connection_init()
243  *
244  * Release all resources allocated for TLS connection.
245  */
246 void tls_connection_deinit(void *tls_ctx, struct tls_connection *conn);
247
248 /**
249  * tls_connection_established - Has the TLS connection been completed?
250  * @tls_ctx: TLS context data from tls_init()
251  * @conn: Connection context data from tls_connection_init()
252  * Returns: 1 if TLS connection has been completed, 0 if not.
253  */
254 int tls_connection_established(void *tls_ctx, struct tls_connection *conn);
255
256 /**
257  * tls_connection_peer_serial_num - Fetch peer certificate serial number
258  * @tls_ctx: TLS context data from tls_init()
259  * @conn: Connection context data from tls_connection_init()
260  * Returns: Allocated string buffer containing the peer certificate serial
261  * number or %NULL on error.
262  *
263  * The caller is responsible for freeing the returned buffer with os_free().
264  */
265 char * tls_connection_peer_serial_num(void *tls_ctx,
266                                       struct tls_connection *conn);
267
268 /**
269  * tls_connection_shutdown - Shutdown TLS connection
270  * @tls_ctx: TLS context data from tls_init()
271  * @conn: Connection context data from tls_connection_init()
272  * Returns: 0 on success, -1 on failure
273  *
274  * Shutdown current TLS connection without releasing all resources. New
275  * connection can be started by using the same conn without having to call
276  * tls_connection_init() or setting certificates etc. again. The new
277  * connection should try to use session resumption.
278  */
279 int tls_connection_shutdown(void *tls_ctx, struct tls_connection *conn);
280
281 enum {
282         TLS_SET_PARAMS_ENGINE_PRV_BAD_PIN = -4,
283         TLS_SET_PARAMS_ENGINE_PRV_VERIFY_FAILED = -3,
284         TLS_SET_PARAMS_ENGINE_PRV_INIT_FAILED = -2
285 };
286
287 /**
288  * tls_connection_set_params - Set TLS connection parameters
289  * @tls_ctx: TLS context data from tls_init()
290  * @conn: Connection context data from tls_connection_init()
291  * @params: Connection parameters
292  * Returns: 0 on success, -1 on failure,
293  * TLS_SET_PARAMS_ENGINE_PRV_INIT_FAILED (-2) on error causing PKCS#11 engine
294  * failure, or
295  * TLS_SET_PARAMS_ENGINE_PRV_VERIFY_FAILED (-3) on failure to verify the
296  * PKCS#11 engine private key, or
297  * TLS_SET_PARAMS_ENGINE_PRV_BAD_PIN (-4) on PIN error causing PKCS#11 engine
298  * failure.
299  */
300 int __must_check
301 tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
302                           const struct tls_connection_params *params);
303
304 /**
305  * tls_global_set_params - Set TLS parameters for all TLS connection
306  * @tls_ctx: TLS context data from tls_init()
307  * @params: Global TLS parameters
308  * Returns: 0 on success, -1 on failure,
309  * TLS_SET_PARAMS_ENGINE_PRV_INIT_FAILED (-2) on error causing PKCS#11 engine
310  * failure, or
311  * TLS_SET_PARAMS_ENGINE_PRV_VERIFY_FAILED (-3) on failure to verify the
312  * PKCS#11 engine private key, or
313  * TLS_SET_PARAMS_ENGINE_PRV_BAD_PIN (-4) on PIN error causing PKCS#11 engine
314  * failure.
315  */
316 int __must_check tls_global_set_params(
317         void *tls_ctx, const struct tls_connection_params *params);
318
319 /**
320  * tls_global_set_verify - Set global certificate verification options
321  * @tls_ctx: TLS context data from tls_init()
322  * @check_crl: 0 = do not verify CRLs, 1 = verify CRL for the user certificate,
323  * 2 = verify CRL for all certificates
324  * Returns: 0 on success, -1 on failure
325  */
326 int __must_check tls_global_set_verify(void *tls_ctx, int check_crl);
327
328 /**
329  * tls_connection_set_verify - Set certificate verification options
330  * @tls_ctx: TLS context data from tls_init()
331  * @conn: Connection context data from tls_connection_init()
332  * @verify_peer: 1 = verify peer certificate
333  * @flags: Connection flags (TLS_CONN_*)
334  * @session_ctx: Session caching context or %NULL to use default
335  * @session_ctx_len: Length of @session_ctx in bytes.
336  * Returns: 0 on success, -1 on failure
337  */
338 int __must_check tls_connection_set_verify(void *tls_ctx,
339                                            struct tls_connection *conn,
340                                            int verify_peer,
341                                            unsigned int flags,
342                                            const u8 *session_ctx,
343                                            size_t session_ctx_len);
344
345 /**
346  * tls_connection_get_random - Get random data from TLS connection
347  * @tls_ctx: TLS context data from tls_init()
348  * @conn: Connection context data from tls_connection_init()
349  * @data: Structure of client/server random data (filled on success)
350  * Returns: 0 on success, -1 on failure
351  */
352 int __must_check tls_connection_get_random(void *tls_ctx,
353                                          struct tls_connection *conn,
354                                          struct tls_random *data);
355
356 /**
357  * tls_connection_export_key - Derive keying material from a TLS connection
358  * @tls_ctx: TLS context data from tls_init()
359  * @conn: Connection context data from tls_connection_init()
360  * @label: Label (e.g., description of the key) for PRF
361  * @out: Buffer for output data from TLS-PRF
362  * @out_len: Length of the output buffer
363  * Returns: 0 on success, -1 on failure
364  *
365  * Exports keying material using the mechanism described in RFC 5705.
366  */
367 int __must_check tls_connection_export_key(void *tls_ctx,
368                                            struct tls_connection *conn,
369                                            const char *label,
370                                            u8 *out, size_t out_len);
371
372 /**
373  * tls_connection_get_eap_fast_key - Derive key material for EAP-FAST
374  * @tls_ctx: TLS context data from tls_init()
375  * @conn: Connection context data from tls_connection_init()
376  * @out: Buffer for output data from TLS-PRF
377  * @out_len: Length of the output buffer
378  * Returns: 0 on success, -1 on failure
379  *
380  * Exports key material after the normal TLS key block for use with
381  * EAP-FAST. Most callers will want tls_connection_export_key(), but EAP-FAST
382  * uses a different legacy mechanism.
383  */
384 int __must_check tls_connection_get_eap_fast_key(void *tls_ctx,
385                                                  struct tls_connection *conn,
386                                                  u8 *out, size_t out_len);
387
388 /**
389  * tls_connection_handshake - Process TLS handshake (client side)
390  * @tls_ctx: TLS context data from tls_init()
391  * @conn: Connection context data from tls_connection_init()
392  * @in_data: Input data from TLS server
393  * @appl_data: Pointer to application data pointer, or %NULL if dropped
394  * Returns: Output data, %NULL on failure
395  *
396  * The caller is responsible for freeing the returned output data. If the final
397  * handshake message includes application data, this is decrypted and
398  * appl_data (if not %NULL) is set to point this data. The caller is
399  * responsible for freeing appl_data.
400  *
401  * This function is used during TLS handshake. The first call is done with
402  * in_data == %NULL and the library is expected to return ClientHello packet.
403  * This packet is then send to the server and a response from server is given
404  * to TLS library by calling this function again with in_data pointing to the
405  * TLS message from the server.
406  *
407  * If the TLS handshake fails, this function may return %NULL. However, if the
408  * TLS library has a TLS alert to send out, that should be returned as the
409  * output data. In this case, tls_connection_get_failed() must return failure
410  * (> 0).
411  *
412  * tls_connection_established() should return 1 once the TLS handshake has been
413  * completed successfully.
414  */
415 struct wpabuf * tls_connection_handshake(void *tls_ctx,
416                                          struct tls_connection *conn,
417                                          const struct wpabuf *in_data,
418                                          struct wpabuf **appl_data);
419
420 struct wpabuf * tls_connection_handshake2(void *tls_ctx,
421                                           struct tls_connection *conn,
422                                           const struct wpabuf *in_data,
423                                           struct wpabuf **appl_data,
424                                           int *more_data_needed);
425
426 /**
427  * tls_connection_server_handshake - Process TLS handshake (server side)
428  * @tls_ctx: TLS context data from tls_init()
429  * @conn: Connection context data from tls_connection_init()
430  * @in_data: Input data from TLS peer
431  * @appl_data: Pointer to application data pointer, or %NULL if dropped
432  * Returns: Output data, %NULL on failure
433  *
434  * The caller is responsible for freeing the returned output data.
435  */
436 struct wpabuf * tls_connection_server_handshake(void *tls_ctx,
437                                                 struct tls_connection *conn,
438                                                 const struct wpabuf *in_data,
439                                                 struct wpabuf **appl_data);
440
441 /**
442  * tls_connection_encrypt - Encrypt data into TLS tunnel
443  * @tls_ctx: TLS context data from tls_init()
444  * @conn: Connection context data from tls_connection_init()
445  * @in_data: Plaintext data to be encrypted
446  * Returns: Encrypted TLS data or %NULL on failure
447  *
448  * This function is used after TLS handshake has been completed successfully to
449  * send data in the encrypted tunnel. The caller is responsible for freeing the
450  * returned output data.
451  */
452 struct wpabuf * tls_connection_encrypt(void *tls_ctx,
453                                        struct tls_connection *conn,
454                                        const struct wpabuf *in_data);
455
456 /**
457  * tls_connection_decrypt - Decrypt data from TLS tunnel
458  * @tls_ctx: TLS context data from tls_init()
459  * @conn: Connection context data from tls_connection_init()
460  * @in_data: Encrypted TLS data
461  * Returns: Decrypted TLS data or %NULL on failure
462  *
463  * This function is used after TLS handshake has been completed successfully to
464  * receive data from the encrypted tunnel. The caller is responsible for
465  * freeing the returned output data.
466  */
467 struct wpabuf * tls_connection_decrypt(void *tls_ctx,
468                                        struct tls_connection *conn,
469                                        const struct wpabuf *in_data);
470
471 struct wpabuf * tls_connection_decrypt2(void *tls_ctx,
472                                         struct tls_connection *conn,
473                                         const struct wpabuf *in_data,
474                                         int *more_data_needed);
475
476 /**
477  * tls_connection_resumed - Was session resumption used
478  * @tls_ctx: TLS context data from tls_init()
479  * @conn: Connection context data from tls_connection_init()
480  * Returns: 1 if current session used session resumption, 0 if not
481  */
482 int tls_connection_resumed(void *tls_ctx, struct tls_connection *conn);
483
484 enum {
485         TLS_CIPHER_NONE,
486         TLS_CIPHER_RC4_SHA /* 0x0005 */,
487         TLS_CIPHER_AES128_SHA /* 0x002f */,
488         TLS_CIPHER_RSA_DHE_AES128_SHA /* 0x0031 */,
489         TLS_CIPHER_ANON_DH_AES128_SHA /* 0x0034 */,
490         TLS_CIPHER_RSA_DHE_AES256_SHA /* 0x0039 */,
491         TLS_CIPHER_AES256_SHA /* 0x0035 */,
492 };
493
494 /**
495  * tls_connection_set_cipher_list - Configure acceptable cipher suites
496  * @tls_ctx: TLS context data from tls_init()
497  * @conn: Connection context data from tls_connection_init()
498  * @ciphers: Zero (TLS_CIPHER_NONE) terminated list of allowed ciphers
499  * (TLS_CIPHER_*).
500  * Returns: 0 on success, -1 on failure
501  */
502 int __must_check tls_connection_set_cipher_list(void *tls_ctx,
503                                                 struct tls_connection *conn,
504                                                 u8 *ciphers);
505
506 /**
507  * tls_get_version - Get the current TLS version number
508  * @tls_ctx: TLS context data from tls_init()
509  * @conn: Connection context data from tls_connection_init()
510  * @buf: Buffer for returning the TLS version number
511  * @buflen: buf size
512  * Returns: 0 on success, -1 on failure
513  *
514  * Get the currently used TLS version number.
515  */
516 int __must_check tls_get_version(void *tls_ctx, struct tls_connection *conn,
517                                  char *buf, size_t buflen);
518
519 /**
520  * tls_get_cipher - Get current cipher name
521  * @tls_ctx: TLS context data from tls_init()
522  * @conn: Connection context data from tls_connection_init()
523  * @buf: Buffer for the cipher name
524  * @buflen: buf size
525  * Returns: 0 on success, -1 on failure
526  *
527  * Get the name of the currently used cipher.
528  */
529 int __must_check tls_get_cipher(void *tls_ctx, struct tls_connection *conn,
530                                 char *buf, size_t buflen);
531
532 /**
533  * tls_connection_enable_workaround - Enable TLS workaround options
534  * @tls_ctx: TLS context data from tls_init()
535  * @conn: Connection context data from tls_connection_init()
536  * Returns: 0 on success, -1 on failure
537  *
538  * This function is used to enable connection-specific workaround options for
539  * buffer SSL/TLS implementations.
540  */
541 int __must_check tls_connection_enable_workaround(void *tls_ctx,
542                                                   struct tls_connection *conn);
543
544 /**
545  * tls_connection_client_hello_ext - Set TLS extension for ClientHello
546  * @tls_ctx: TLS context data from tls_init()
547  * @conn: Connection context data from tls_connection_init()
548  * @ext_type: Extension type
549  * @data: Extension payload (%NULL to remove extension)
550  * @data_len: Extension payload length
551  * Returns: 0 on success, -1 on failure
552  */
553 int __must_check tls_connection_client_hello_ext(void *tls_ctx,
554                                                  struct tls_connection *conn,
555                                                  int ext_type, const u8 *data,
556                                                  size_t data_len);
557
558 /**
559  * tls_connection_get_failed - Get connection failure status
560  * @tls_ctx: TLS context data from tls_init()
561  * @conn: Connection context data from tls_connection_init()
562  *
563  * Returns >0 if connection has failed, 0 if not.
564  */
565 int tls_connection_get_failed(void *tls_ctx, struct tls_connection *conn);
566
567 /**
568  * tls_connection_get_read_alerts - Get connection read alert status
569  * @tls_ctx: TLS context data from tls_init()
570  * @conn: Connection context data from tls_connection_init()
571  * Returns: Number of times a fatal read (remote end reported error) has
572  * happened during this connection.
573  */
574 int tls_connection_get_read_alerts(void *tls_ctx, struct tls_connection *conn);
575
576 /**
577  * tls_connection_get_write_alerts - Get connection write alert status
578  * @tls_ctx: TLS context data from tls_init()
579  * @conn: Connection context data from tls_connection_init()
580  * Returns: Number of times a fatal write (locally detected error) has happened
581  * during this connection.
582  */
583 int tls_connection_get_write_alerts(void *tls_ctx,
584                                     struct tls_connection *conn);
585
586 typedef int (*tls_session_ticket_cb)
587 (void *ctx, const u8 *ticket, size_t len, const u8 *client_random,
588  const u8 *server_random, u8 *master_secret);
589
590 int __must_check  tls_connection_set_session_ticket_cb(
591         void *tls_ctx, struct tls_connection *conn,
592         tls_session_ticket_cb cb, void *ctx);
593
594 void tls_connection_set_log_cb(struct tls_connection *conn,
595                                void (*log_cb)(void *ctx, const char *msg),
596                                void *ctx);
597
598 #define TLS_BREAK_VERIFY_DATA BIT(0)
599 #define TLS_BREAK_SRV_KEY_X_HASH BIT(1)
600 #define TLS_BREAK_SRV_KEY_X_SIGNATURE BIT(2)
601 #define TLS_DHE_PRIME_511B BIT(3)
602 #define TLS_DHE_PRIME_767B BIT(4)
603 #define TLS_DHE_PRIME_15 BIT(5)
604 #define TLS_DHE_PRIME_58B BIT(6)
605 #define TLS_DHE_NON_PRIME BIT(7)
606
607 void tls_connection_set_test_flags(struct tls_connection *conn, u32 flags);
608
609 int tls_get_library_version(char *buf, size_t buf_len);
610
611 void tls_connection_set_success_data(struct tls_connection *conn,
612                                      struct wpabuf *data);
613
614 void tls_connection_set_success_data_resumed(struct tls_connection *conn);
615
616 const struct wpabuf *
617 tls_connection_get_success_data(struct tls_connection *conn);
618
619 void tls_connection_remove_session(struct tls_connection *conn);
620
621 #endif /* TLS_H */