2 * SSL/TLS interface definition
3 * Copyright (c) 2004-2013, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 struct tls_connection;
15 const u8 *client_random;
16 size_t client_random_len;
17 const u8 *server_random;
18 size_t server_random_len;
22 TLS_CERT_CHAIN_SUCCESS,
23 TLS_CERT_CHAIN_FAILURE,
29 * Note: These are used as identifier with external programs and as such, the
30 * values must not be changed.
32 enum tls_fail_reason {
33 TLS_FAIL_UNSPECIFIED = 0,
34 TLS_FAIL_UNTRUSTED = 1,
36 TLS_FAIL_NOT_YET_VALID = 3,
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 TLS_FAIL_DN_MISMATCH = 12,
49 #define TLS_MAX_ALT_SUBJECT 10
51 struct tls_cert_data {
54 const struct wpabuf *cert;
57 const char *altsubject[TLS_MAX_ALT_SUBJECT];
59 const char *serial_num;
63 union tls_event_data {
67 enum tls_fail_reason reason;
68 const char *reason_txt;
69 const struct wpabuf *cert;
72 struct tls_cert_data peer_cert;
77 const char *description;
82 const char *opensc_engine_path;
83 const char *pkcs11_engine_path;
84 const char *pkcs11_module_path;
87 const char *openssl_ciphers;
88 unsigned int tls_session_lifetime;
89 unsigned int crl_reload_interval;
90 unsigned int tls_flags;
92 void (*event_cb)(void *ctx, enum tls_event ev,
93 union tls_event_data *data);
97 #define TLS_CONN_ALLOW_SIGN_RSA_MD5 BIT(0)
98 #define TLS_CONN_DISABLE_TIME_CHECKS BIT(1)
99 #define TLS_CONN_DISABLE_SESSION_TICKET BIT(2)
100 #define TLS_CONN_REQUEST_OCSP BIT(3)
101 #define TLS_CONN_REQUIRE_OCSP BIT(4)
102 #define TLS_CONN_DISABLE_TLSv1_1 BIT(5)
103 #define TLS_CONN_DISABLE_TLSv1_2 BIT(6)
104 #define TLS_CONN_EAP_FAST BIT(7)
105 #define TLS_CONN_DISABLE_TLSv1_0 BIT(8)
106 #define TLS_CONN_EXT_CERT_CHECK BIT(9)
107 #define TLS_CONN_REQUIRE_OCSP_ALL BIT(10)
108 #define TLS_CONN_SUITEB BIT(11)
109 #define TLS_CONN_SUITEB_NO_ECDH BIT(12)
110 #define TLS_CONN_DISABLE_TLSv1_3 BIT(13)
111 #define TLS_CONN_ENABLE_TLSv1_0 BIT(14)
112 #define TLS_CONN_ENABLE_TLSv1_1 BIT(15)
113 #define TLS_CONN_ENABLE_TLSv1_2 BIT(16)
114 #define TLS_CONN_TEAP_ANON_DH BIT(17)
117 * struct tls_connection_params - Parameters for TLS connection
118 * @ca_cert: File or reference name for CA X.509 certificate in PEM or DER
120 * @ca_cert_blob: ca_cert as inlined data or %NULL if not used
121 * @ca_cert_blob_len: ca_cert_blob length
122 * @ca_path: Path to CA certificates (OpenSSL specific)
123 * @subject_match: String to match in the subject of the peer certificate or
124 * %NULL to allow all subjects
125 * @altsubject_match: String to match in the alternative subject of the peer
126 * certificate or %NULL to allow all alternative subjects
127 * @suffix_match: Semicolon deliminated string of values to suffix match against
128 * the dNSName or CN of the peer certificate or %NULL to allow all domain names.
129 * This may allow subdomains and wildcard certificates. Each domain name label
130 * must have a full case-insensitive match.
131 * @domain_match: String to match in the dNSName or CN of the peer
132 * certificate or %NULL to allow all domain names. This requires a full,
133 * case-insensitive match.
135 * More than one match string can be provided by using semicolons to
136 * separate the strings (e.g., example.org;example.com). When multiple
137 * strings are specified, a match with any one of the values is
138 * considered a sufficient match for the certificate, i.e., the
139 * conditions are ORed together.
140 * @client_cert: File or reference name for client X.509 certificate in PEM or
142 * @client_cert_blob: client_cert as inlined data or %NULL if not used
143 * @client_cert_blob_len: client_cert_blob length
144 * @private_key: File or reference name for client private key in PEM or DER
145 * format (traditional format (RSA PRIVATE KEY) or PKCS#8 (PRIVATE KEY)
146 * @private_key_blob: private_key as inlined data or %NULL if not used
147 * @private_key_blob_len: private_key_blob length
148 * @private_key_passwd: Passphrase for decrypted private key, %NULL if no
149 * passphrase is used.
150 * @dh_file: File name for DH/DSA data in PEM format, or %NULL if not used
151 * @dh_blob: dh_file as inlined data or %NULL if not used
152 * @dh_blob_len: dh_blob length
153 * @engine: 1 = use engine (e.g., a smartcard) for private key operations
154 * (this is OpenSSL specific for now)
155 * @engine_id: engine id string (this is OpenSSL specific for now)
156 * @ppin: pointer to the pin variable in the configuration
157 * (this is OpenSSL specific for now)
158 * @key_id: the private key's id when using engine (this is OpenSSL
160 * @cert_id: the certificate's id when using engine
161 * @ca_cert_id: the CA certificate's id when using engine
162 * @openssl_ciphers: OpenSSL cipher configuration
163 * @openssl_ecdh_curves: OpenSSL ECDH curve configuration. %NULL for auto if
164 * supported, empty string to disable, or a colon-separated curve list.
165 * @flags: Parameter options (TLS_CONN_*)
166 * @ocsp_stapling_response: DER encoded file with cached OCSP stapling response
167 * or %NULL if OCSP is not enabled
168 * @ocsp_stapling_response_multi: DER encoded file with cached OCSP stapling
169 * response list (OCSPResponseList for ocsp_multi in RFC 6961) or %NULL if
170 * ocsp_multi is not enabled
171 * @check_cert_subject: Client certificate subject name matching string
173 * TLS connection parameters to be configured with tls_connection_set_params()
174 * and tls_global_set_params().
176 * Certificates and private key can be configured either as a reference name
177 * (file path or reference to certificate store) or by providing the same data
178 * as a pointer to the data in memory. Only one option will be used for each
181 struct tls_connection_params {
183 const u8 *ca_cert_blob;
184 size_t ca_cert_blob_len;
186 const char *subject_match;
187 const char *altsubject_match;
188 const char *suffix_match;
189 const char *domain_match;
190 const char *client_cert;
191 const char *client_cert2;
192 const u8 *client_cert_blob;
193 size_t client_cert_blob_len;
194 const char *private_key;
195 const char *private_key2;
196 const u8 *private_key_blob;
197 size_t private_key_blob_len;
198 const char *private_key_passwd;
199 const char *private_key_passwd2;
204 /* OpenSSL specific variables */
206 const char *engine_id;
210 const char *ca_cert_id;
211 const char *openssl_ciphers;
212 const char *openssl_ecdh_curves;
215 const char *ocsp_stapling_response;
216 const char *ocsp_stapling_response_multi;
217 const char *check_cert_subject;
222 * tls_init - Initialize TLS library
223 * @conf: Configuration data for TLS library
224 * Returns: Context data to be used as tls_ctx in calls to other functions,
225 * or %NULL on failure.
227 * Called once during program startup and once for each RSN pre-authentication
228 * session. In other words, there can be two concurrent TLS contexts. If global
229 * library initialization is needed (i.e., one that is shared between both
230 * authentication types), the TLS library wrapper should maintain a reference
231 * counter and do global initialization only when moving from 0 to 1 reference.
233 void * tls_init(const struct tls_config *conf);
236 * tls_deinit - Deinitialize TLS library
237 * @tls_ctx: TLS context data from tls_init()
239 * Called once during program shutdown and once for each RSN pre-authentication
240 * session. If global library deinitialization is needed (i.e., one that is
241 * shared between both authentication types), the TLS library wrapper should
242 * maintain a reference counter and do global deinitialization only when moving
243 * from 1 to 0 references.
245 void tls_deinit(void *tls_ctx);
248 * tls_get_errors - Process pending errors
249 * @tls_ctx: TLS context data from tls_init()
250 * Returns: Number of found error, 0 if no errors detected.
252 * Process all pending TLS errors.
254 int tls_get_errors(void *tls_ctx);
257 * tls_connection_init - Initialize a new TLS connection
258 * @tls_ctx: TLS context data from tls_init()
259 * Returns: Connection context data, conn for other function calls
261 struct tls_connection * tls_connection_init(void *tls_ctx);
264 * tls_connection_deinit - Free TLS connection data
265 * @tls_ctx: TLS context data from tls_init()
266 * @conn: Connection context data from tls_connection_init()
268 * Release all resources allocated for TLS connection.
270 void tls_connection_deinit(void *tls_ctx, struct tls_connection *conn);
273 * tls_connection_established - Has the TLS connection been completed?
274 * @tls_ctx: TLS context data from tls_init()
275 * @conn: Connection context data from tls_connection_init()
276 * Returns: 1 if TLS connection has been completed, 0 if not.
278 int tls_connection_established(void *tls_ctx, struct tls_connection *conn);
281 * tls_connection_peer_serial_num - Fetch peer certificate serial number
282 * @tls_ctx: TLS context data from tls_init()
283 * @conn: Connection context data from tls_connection_init()
284 * Returns: Allocated string buffer containing the peer certificate serial
285 * number or %NULL on error.
287 * The caller is responsible for freeing the returned buffer with os_free().
289 char * tls_connection_peer_serial_num(void *tls_ctx,
290 struct tls_connection *conn);
293 * tls_connection_shutdown - Shutdown TLS connection
294 * @tls_ctx: TLS context data from tls_init()
295 * @conn: Connection context data from tls_connection_init()
296 * Returns: 0 on success, -1 on failure
298 * Shutdown current TLS connection without releasing all resources. New
299 * connection can be started by using the same conn without having to call
300 * tls_connection_init() or setting certificates etc. again. The new
301 * connection should try to use session resumption.
303 int tls_connection_shutdown(void *tls_ctx, struct tls_connection *conn);
306 TLS_SET_PARAMS_ENGINE_PRV_BAD_PIN = -4,
307 TLS_SET_PARAMS_ENGINE_PRV_VERIFY_FAILED = -3,
308 TLS_SET_PARAMS_ENGINE_PRV_INIT_FAILED = -2
312 * tls_connection_set_params - Set TLS connection parameters
313 * @tls_ctx: TLS context data from tls_init()
314 * @conn: Connection context data from tls_connection_init()
315 * @params: Connection parameters
316 * Returns: 0 on success, -1 on failure,
317 * TLS_SET_PARAMS_ENGINE_PRV_INIT_FAILED (-2) on error causing PKCS#11 engine
319 * TLS_SET_PARAMS_ENGINE_PRV_VERIFY_FAILED (-3) on failure to verify the
320 * PKCS#11 engine private key, or
321 * TLS_SET_PARAMS_ENGINE_PRV_BAD_PIN (-4) on PIN error causing PKCS#11 engine
325 tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
326 const struct tls_connection_params *params);
329 * tls_global_set_params - Set TLS parameters for all TLS connection
330 * @tls_ctx: TLS context data from tls_init()
331 * @params: Global TLS parameters
332 * Returns: 0 on success, -1 on failure,
333 * TLS_SET_PARAMS_ENGINE_PRV_INIT_FAILED (-2) on error causing PKCS#11 engine
335 * TLS_SET_PARAMS_ENGINE_PRV_VERIFY_FAILED (-3) on failure to verify the
336 * PKCS#11 engine private key, or
337 * TLS_SET_PARAMS_ENGINE_PRV_BAD_PIN (-4) on PIN error causing PKCS#11 engine
340 int __must_check tls_global_set_params(
341 void *tls_ctx, const struct tls_connection_params *params);
344 * tls_global_set_verify - Set global certificate verification options
345 * @tls_ctx: TLS context data from tls_init()
346 * @check_crl: 0 = do not verify CRLs, 1 = verify CRL for the user certificate,
347 * 2 = verify CRL for all certificates
348 * @strict: 0 = allow CRL time errors, 1 = do not allow CRL time errors
349 * Returns: 0 on success, -1 on failure
351 int __must_check tls_global_set_verify(void *tls_ctx, int check_crl,
355 * tls_connection_set_verify - Set certificate verification options
356 * @tls_ctx: TLS context data from tls_init()
357 * @conn: Connection context data from tls_connection_init()
358 * @verify_peer: 1 = verify peer certificate
359 * @flags: Connection flags (TLS_CONN_*)
360 * @session_ctx: Session caching context or %NULL to use default
361 * @session_ctx_len: Length of @session_ctx in bytes.
362 * Returns: 0 on success, -1 on failure
364 int __must_check tls_connection_set_verify(void *tls_ctx,
365 struct tls_connection *conn,
368 const u8 *session_ctx,
369 size_t session_ctx_len);
372 * tls_connection_get_random - Get random data from TLS connection
373 * @tls_ctx: TLS context data from tls_init()
374 * @conn: Connection context data from tls_connection_init()
375 * @data: Structure of client/server random data (filled on success)
376 * Returns: 0 on success, -1 on failure
378 int __must_check tls_connection_get_random(void *tls_ctx,
379 struct tls_connection *conn,
380 struct tls_random *data);
383 * tls_connection_export_key - Derive keying material from a TLS connection
384 * @tls_ctx: TLS context data from tls_init()
385 * @conn: Connection context data from tls_connection_init()
386 * @label: Label (e.g., description of the key) for PRF
387 * @context: Optional extra upper-layer context (max len 2^16)
388 * @context_len: The length of the context value
389 * @out: Buffer for output data from TLS-PRF
390 * @out_len: Length of the output buffer
391 * Returns: 0 on success, -1 on failure
393 * Exports keying material using the mechanism described in RFC 5705. If
394 * context is %NULL, context is not provided; otherwise, context is provided
395 * (including the case of empty context with context_len == 0).
397 int __must_check tls_connection_export_key(void *tls_ctx,
398 struct tls_connection *conn,
402 u8 *out, size_t out_len);
405 * tls_connection_get_eap_fast_key - Derive key material for EAP-FAST
406 * @tls_ctx: TLS context data from tls_init()
407 * @conn: Connection context data from tls_connection_init()
408 * @out: Buffer for output data from TLS-PRF
409 * @out_len: Length of the output buffer
410 * Returns: 0 on success, -1 on failure
412 * Exports key material after the normal TLS key block for use with
413 * EAP-FAST. Most callers will want tls_connection_export_key(), but EAP-FAST
414 * uses a different legacy mechanism.
416 int __must_check tls_connection_get_eap_fast_key(void *tls_ctx,
417 struct tls_connection *conn,
418 u8 *out, size_t out_len);
421 * tls_connection_handshake - Process TLS handshake (client side)
422 * @tls_ctx: TLS context data from tls_init()
423 * @conn: Connection context data from tls_connection_init()
424 * @in_data: Input data from TLS server
425 * @appl_data: Pointer to application data pointer, or %NULL if dropped
426 * Returns: Output data, %NULL on failure
428 * The caller is responsible for freeing the returned output data. If the final
429 * handshake message includes application data, this is decrypted and
430 * appl_data (if not %NULL) is set to point this data. The caller is
431 * responsible for freeing appl_data.
433 * This function is used during TLS handshake. The first call is done with
434 * in_data == %NULL and the library is expected to return ClientHello packet.
435 * This packet is then send to the server and a response from server is given
436 * to TLS library by calling this function again with in_data pointing to the
437 * TLS message from the server.
439 * If the TLS handshake fails, this function may return %NULL. However, if the
440 * TLS library has a TLS alert to send out, that should be returned as the
441 * output data. In this case, tls_connection_get_failed() must return failure
444 * tls_connection_established() should return 1 once the TLS handshake has been
445 * completed successfully.
447 struct wpabuf * tls_connection_handshake(void *tls_ctx,
448 struct tls_connection *conn,
449 const struct wpabuf *in_data,
450 struct wpabuf **appl_data);
452 struct wpabuf * tls_connection_handshake2(void *tls_ctx,
453 struct tls_connection *conn,
454 const struct wpabuf *in_data,
455 struct wpabuf **appl_data,
456 int *more_data_needed);
459 * tls_connection_server_handshake - Process TLS handshake (server side)
460 * @tls_ctx: TLS context data from tls_init()
461 * @conn: Connection context data from tls_connection_init()
462 * @in_data: Input data from TLS peer
463 * @appl_data: Pointer to application data pointer, or %NULL if dropped
464 * Returns: Output data, %NULL on failure
466 * The caller is responsible for freeing the returned output data.
468 struct wpabuf * tls_connection_server_handshake(void *tls_ctx,
469 struct tls_connection *conn,
470 const struct wpabuf *in_data,
471 struct wpabuf **appl_data);
474 * tls_connection_encrypt - Encrypt data into TLS tunnel
475 * @tls_ctx: TLS context data from tls_init()
476 * @conn: Connection context data from tls_connection_init()
477 * @in_data: Plaintext data to be encrypted
478 * Returns: Encrypted TLS data or %NULL on failure
480 * This function is used after TLS handshake has been completed successfully to
481 * send data in the encrypted tunnel. The caller is responsible for freeing the
482 * returned output data.
484 struct wpabuf * tls_connection_encrypt(void *tls_ctx,
485 struct tls_connection *conn,
486 const struct wpabuf *in_data);
489 * tls_connection_decrypt - Decrypt data from TLS tunnel
490 * @tls_ctx: TLS context data from tls_init()
491 * @conn: Connection context data from tls_connection_init()
492 * @in_data: Encrypted TLS data
493 * Returns: Decrypted TLS data or %NULL on failure
495 * This function is used after TLS handshake has been completed successfully to
496 * receive data from the encrypted tunnel. The caller is responsible for
497 * freeing the returned output data.
499 struct wpabuf * tls_connection_decrypt(void *tls_ctx,
500 struct tls_connection *conn,
501 const struct wpabuf *in_data);
503 struct wpabuf * tls_connection_decrypt2(void *tls_ctx,
504 struct tls_connection *conn,
505 const struct wpabuf *in_data,
506 int *more_data_needed);
509 * tls_connection_resumed - Was session resumption used
510 * @tls_ctx: TLS context data from tls_init()
511 * @conn: Connection context data from tls_connection_init()
512 * Returns: 1 if current session used session resumption, 0 if not
514 int tls_connection_resumed(void *tls_ctx, struct tls_connection *conn);
518 TLS_CIPHER_RC4_SHA /* 0x0005 */,
519 TLS_CIPHER_AES128_SHA /* 0x002f */,
520 TLS_CIPHER_RSA_DHE_AES128_SHA /* 0x0031 */,
521 TLS_CIPHER_ANON_DH_AES128_SHA /* 0x0034 */,
522 TLS_CIPHER_RSA_DHE_AES256_SHA /* 0x0039 */,
523 TLS_CIPHER_AES256_SHA /* 0x0035 */,
527 * tls_connection_set_cipher_list - Configure acceptable cipher suites
528 * @tls_ctx: TLS context data from tls_init()
529 * @conn: Connection context data from tls_connection_init()
530 * @ciphers: Zero (TLS_CIPHER_NONE) terminated list of allowed ciphers
532 * Returns: 0 on success, -1 on failure
534 int __must_check tls_connection_set_cipher_list(void *tls_ctx,
535 struct tls_connection *conn,
539 * tls_get_version - Get the current TLS version number
540 * @tls_ctx: TLS context data from tls_init()
541 * @conn: Connection context data from tls_connection_init()
542 * @buf: Buffer for returning the TLS version number
544 * Returns: 0 on success, -1 on failure
546 * Get the currently used TLS version number.
548 int __must_check tls_get_version(void *tls_ctx, struct tls_connection *conn,
549 char *buf, size_t buflen);
552 * tls_get_cipher - Get current cipher name
553 * @tls_ctx: TLS context data from tls_init()
554 * @conn: Connection context data from tls_connection_init()
555 * @buf: Buffer for the cipher name
557 * Returns: 0 on success, -1 on failure
559 * Get the name of the currently used cipher.
561 int __must_check tls_get_cipher(void *tls_ctx, struct tls_connection *conn,
562 char *buf, size_t buflen);
565 * tls_connection_enable_workaround - Enable TLS workaround options
566 * @tls_ctx: TLS context data from tls_init()
567 * @conn: Connection context data from tls_connection_init()
568 * Returns: 0 on success, -1 on failure
570 * This function is used to enable connection-specific workaround options for
571 * buffer SSL/TLS implementations.
573 int __must_check tls_connection_enable_workaround(void *tls_ctx,
574 struct tls_connection *conn);
577 * tls_connection_client_hello_ext - Set TLS extension for ClientHello
578 * @tls_ctx: TLS context data from tls_init()
579 * @conn: Connection context data from tls_connection_init()
580 * @ext_type: Extension type
581 * @data: Extension payload (%NULL to remove extension)
582 * @data_len: Extension payload length
583 * Returns: 0 on success, -1 on failure
585 int __must_check tls_connection_client_hello_ext(void *tls_ctx,
586 struct tls_connection *conn,
587 int ext_type, const u8 *data,
591 * tls_connection_get_failed - Get connection failure status
592 * @tls_ctx: TLS context data from tls_init()
593 * @conn: Connection context data from tls_connection_init()
595 * Returns >0 if connection has failed, 0 if not.
597 int tls_connection_get_failed(void *tls_ctx, struct tls_connection *conn);
600 * tls_connection_get_read_alerts - Get connection read alert status
601 * @tls_ctx: TLS context data from tls_init()
602 * @conn: Connection context data from tls_connection_init()
603 * Returns: Number of times a fatal read (remote end reported error) has
604 * happened during this connection.
606 int tls_connection_get_read_alerts(void *tls_ctx, struct tls_connection *conn);
609 * tls_connection_get_write_alerts - Get connection write alert status
610 * @tls_ctx: TLS context data from tls_init()
611 * @conn: Connection context data from tls_connection_init()
612 * Returns: Number of times a fatal write (locally detected error) has happened
613 * during this connection.
615 int tls_connection_get_write_alerts(void *tls_ctx,
616 struct tls_connection *conn);
618 typedef int (*tls_session_ticket_cb)
619 (void *ctx, const u8 *ticket, size_t len, const u8 *client_random,
620 const u8 *server_random, u8 *master_secret);
622 int __must_check tls_connection_set_session_ticket_cb(
623 void *tls_ctx, struct tls_connection *conn,
624 tls_session_ticket_cb cb, void *ctx);
626 void tls_connection_set_log_cb(struct tls_connection *conn,
627 void (*log_cb)(void *ctx, const char *msg),
630 #define TLS_BREAK_VERIFY_DATA BIT(0)
631 #define TLS_BREAK_SRV_KEY_X_HASH BIT(1)
632 #define TLS_BREAK_SRV_KEY_X_SIGNATURE BIT(2)
633 #define TLS_DHE_PRIME_511B BIT(3)
634 #define TLS_DHE_PRIME_767B BIT(4)
635 #define TLS_DHE_PRIME_15 BIT(5)
636 #define TLS_DHE_PRIME_58B BIT(6)
637 #define TLS_DHE_NON_PRIME BIT(7)
639 void tls_connection_set_test_flags(struct tls_connection *conn, u32 flags);
641 int tls_get_library_version(char *buf, size_t buf_len);
643 void tls_connection_set_success_data(struct tls_connection *conn,
644 struct wpabuf *data);
646 void tls_connection_set_success_data_resumed(struct tls_connection *conn);
648 const struct wpabuf *
649 tls_connection_get_success_data(struct tls_connection *conn);
651 void tls_connection_remove_session(struct tls_connection *conn);
654 * tls_get_tls_unique - Fetch "tls-unique" for channel binding
655 * @conn: Connection context data from tls_connection_init()
656 * @buf: Buffer for returning the value
657 * @max_len: Maximum length of the buffer in bytes
658 * Returns: Number of bytes written to buf or -1 on error
660 * This function can be used to fetch "tls-unique" (RFC 5929, Section 3) which
661 * is the first TLS Finished message sent in the most recent TLS handshake of
662 * the TLS connection.
664 int tls_get_tls_unique(struct tls_connection *conn, u8 *buf, size_t max_len);
667 * tls_connection_get_cipher_suite - Get current TLS cipher suite
668 * @conn: Connection context data from tls_connection_init()
669 * Returns: TLS cipher suite of the current connection or 0 on error
671 u16 tls_connection_get_cipher_suite(struct tls_connection *conn);