OpenSSL: Add tls_connection_get_cipher_suite()
This can be used to fetch the 16-bit TLS cipher suite identifier. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
063d28ec83
commit
94714ec341
2 changed files with 18 additions and 0 deletions
|
@ -659,4 +659,11 @@ void tls_connection_remove_session(struct tls_connection *conn);
|
|||
*/
|
||||
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 */
|
||||
|
|
|
@ -5354,3 +5354,14 @@ int tls_get_tls_unique(struct tls_connection *conn, u8 *buf, size_t max_len)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue