[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 1/5] crypto: TLS: introduce `check_pending`
From: |
Daniel P . Berrangé |
Subject: |
[PULL 1/5] crypto: TLS: introduce `check_pending` |
Date: |
Wed, 15 Feb 2023 17:47:08 +0000 |
From: Antoine Damhet <antoine.damhet@shadow.tech>
The new `qcrypto_tls_session_check_pending` function allows the caller
to know if data have already been consumed from the backend and is
already available.
Signed-off-by: Antoine Damhet <antoine.damhet@shadow.tech>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
crypto/tlssession.c | 14 ++++++++++++++
include/crypto/tlssession.h | 11 +++++++++++
2 files changed, 25 insertions(+)
diff --git a/crypto/tlssession.c b/crypto/tlssession.c
index b302d835d2..1e98f44e0d 100644
--- a/crypto/tlssession.c
+++ b/crypto/tlssession.c
@@ -493,6 +493,13 @@ qcrypto_tls_session_read(QCryptoTLSSession *session,
}
+size_t
+qcrypto_tls_session_check_pending(QCryptoTLSSession *session)
+{
+ return gnutls_record_check_pending(session->handle);
+}
+
+
int
qcrypto_tls_session_handshake(QCryptoTLSSession *session,
Error **errp)
@@ -615,6 +622,13 @@ qcrypto_tls_session_read(QCryptoTLSSession *sess,
}
+size_t
+qcrypto_tls_session_check_pending(QCryptoTLSSession *session)
+{
+ return 0;
+}
+
+
int
qcrypto_tls_session_handshake(QCryptoTLSSession *sess,
Error **errp)
diff --git a/include/crypto/tlssession.h b/include/crypto/tlssession.h
index 15b9cef086..571049bd0e 100644
--- a/include/crypto/tlssession.h
+++ b/include/crypto/tlssession.h
@@ -248,6 +248,17 @@ ssize_t qcrypto_tls_session_read(QCryptoTLSSession *sess,
char *buf,
size_t len);
+/**
+ * qcrypto_tls_session_check_pending:
+ * @sess: the TLS session object
+ *
+ * Check if there are unread data in the TLS buffers that have
+ * already been read from the underlying data source.
+ *
+ * Returns: the number of bytes available or zero
+ */
+size_t qcrypto_tls_session_check_pending(QCryptoTLSSession *sess);
+
/**
* qcrypto_tls_session_handshake:
* @sess: the TLS session object
--
2.39.1
- [PULL 0/5] Misc next patches, Daniel P . Berrangé, 2023/02/15
- [PULL 1/5] crypto: TLS: introduce `check_pending`,
Daniel P . Berrangé <=
- [PULL 2/5] io/channel-tls: fix handling of bigger read buffers, Daniel P . Berrangé, 2023/02/15
- [PULL 3/5] block: mention 'password-secret' option for -iscsi, Daniel P . Berrangé, 2023/02/15
- [PULL 5/5] ui: remove deprecated 'password' option for SPICE, Daniel P . Berrangé, 2023/02/15
- [PULL 4/5] block: deprecate iSCSI 'password' in favour of 'password-secret', Daniel P . Berrangé, 2023/02/15
- Re: [PULL 0/5] Misc next patches, Peter Maydell, 2023/02/16