This can be used to fetch the 16-bit TLS cipher suite identifier.
Signed-off-by: Jouni Malinen <j@w1.fi>
*/
int tls_get_tls_unique(struct tls_connection *conn, u8 *buf, size_t max_len);
+/**
+ * tls_connection_get_cipher_suite - Get current TLS cipher suite
+ * @conn: Connection context data from tls_connection_init()
+ * Returns: TLS cipher suite of the current connection or 0 on error
+ */
+u16 tls_connection_get_cipher_suite(struct tls_connection *conn);
+
#endif /* TLS_H */
return len;
}
+
+
+u16 tls_connection_get_cipher_suite(struct tls_connection *conn)
+{
+ const SSL_CIPHER *cipher;
+
+ cipher = SSL_get_current_cipher(conn->ssl);
+ if (!cipher)
+ return 0;
+ return SSL_CIPHER_get_protocol_id(cipher);
+}