diff options
author | Jouni Malinen <j@w1.fi> | 2019-07-05 15:07:14 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2019-07-09 13:10:44 (GMT) |
commit | 94714ec341cc278db386fd998b8dd7a2aa4180bb (patch) | |
tree | 113fb986e645ab8051410171dc58b86ccb47ef2a /src/crypto | |
parent | 063d28ec838967ab3b25cf184895d254d5c7ff7e (diff) | |
download | hostap-94714ec341cc278db386fd998b8dd7a2aa4180bb.zip hostap-94714ec341cc278db386fd998b8dd7a2aa4180bb.tar.gz hostap-94714ec341cc278db386fd998b8dd7a2aa4180bb.tar.bz2 |
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>
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/tls.h | 7 | ||||
-rw-r--r-- | src/crypto/tls_openssl.c | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/crypto/tls.h b/src/crypto/tls.h index e199187..3e7e9c7 100644 --- a/src/crypto/tls.h +++ b/src/crypto/tls.h @@ -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 */ diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c index cc96a58..19271d3 100644 --- a/src/crypto/tls_openssl.c +++ b/src/crypto/tls_openssl.c @@ -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); +} |