From: antoine.damhet@shadow.tech
To: qemu-devel@nongnu.org
Cc: vm@shadow.tech, "Antoine Damhet" <antoine.damhet@shadow.tech>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH 1/2] crypto: TLS: introduce `check_pending`
Date: Tue, 15 Nov 2022 15:23:28 +0100 [thread overview]
Message-ID: <20221115142329.92524-2-antoine.damhet@shadow.tech> (raw)
In-Reply-To: <20221115142329.92524-1-antoine.damhet@shadow.tech>
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>
---
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.38.1
next prev parent reply other threads:[~2022-11-15 14:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 14:23 [PATCH 0/2] TLS: fix read stall with large buffers antoine.damhet
2022-11-15 14:23 ` antoine.damhet [this message]
2022-11-16 10:44 ` [PATCH 1/2] crypto: TLS: introduce `check_pending` Daniel P. Berrangé
2022-11-15 14:23 ` [PATCH 2/2] io/channel-tls: fix handling of bigger read buffers antoine.damhet
2022-11-16 10:52 ` Daniel P. Berrangé
2022-12-16 10:38 ` Antoine Damhet
2022-12-16 10:55 ` Daniel P. Berrangé
2024-02-28 16:11 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221115142329.92524-2-antoine.damhet@shadow.tech \
--to=antoine.damhet@shadow.tech \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vm@shadow.tech \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).