]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Add tls_connection_get_cipher_suite()
authorJouni Malinen <j@w1.fi>
Fri, 5 Jul 2019 15:07:14 +0000 (18:07 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 9 Jul 2019 13:10:44 +0000 (16:10 +0300)
This can be used to fetch the 16-bit TLS cipher suite identifier.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/crypto/tls.h
src/crypto/tls_openssl.c

index e199187e82a513eb62f3a09dca8e245303f62ee7..3e7e9c750c0a5ef9674e2d3b2f9447b6b2e0d0b8 100644 (file)
@@ -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 */
index cc96a582ce5cf329ab504c26ba2d4ecf23e38fe3..19271d3d6b2541b2f1fbbb44ac27294fd8a0085b 100644 (file)
@@ -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);
+}