@@ -162,6 +162,19 @@ void qcrypto_tls_session_free(QCryptoTLSSession *sess);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoTLSSession, qcrypto_tls_session_free)
+/**
+ * qcrypto_tls_session_check_role:
+ * @creds: pointer to a TLS credentials object
+ * @endpoint: role of the TLS session, client or server
+ *
+ * Check whether the session object operates according to
+ * the role of the @endpoint argument.
+ *
+ * Returns true if the session is setup for the endpoint role, false otherwise
+ */
+bool qcrypto_tls_session_check_role(QCryptoTLSCreds *creds,
+ QCryptoTLSCredsEndpoint endpoint);
+
/**
* qcrypto_tls_session_check_credentials:
* @sess: the TLS session object
@@ -640,3 +640,9 @@ qcrypto_tls_session_get_peer_name(QCryptoTLSSession *sess)
}
#endif
+
+bool qcrypto_tls_session_check_role(QCryptoTLSCreds *creds,
+ QCryptoTLSCredsEndpoint endpoint)
+{
+ return qcrypto_tls_creds_check_endpoint(creds, endpoint);
+}
Introduce the qcrypto_tls_creds_check_endpoint() helper to avoid accessing QCryptoTLSCreds internal 'endpoint' field directly. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- include/crypto/tlssession.h | 13 +++++++++++++ crypto/tlssession.c | 6 ++++++ 2 files changed, 19 insertions(+)