From nobody Sat Feb 7 07:10:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1676483270; cv=none; d=zohomail.com; s=zohoarc; b=VONKQn3Z+uoZf7GXpFU8Q/5c8ab/AT0F/+lIZ9c6t1EcTCZwTkzXex6FvjxkYb3h1Cqn2falNrP89uaA78MJxtC5n/WbYSikCSC1kWmFSSHhpU3ZXGjoMlcUDzgxnF6aQL7rML39v33h0Zhiy3KTOQHtDHN17cqeGNZ72Cguw3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676483270; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Dyy/1RzvkVp1pdcd4XazalgcwoIuoecJZnqiF2nDZkw=; b=J+KZHCPbQuT9XdeoM/qZXVhgsknbAHe1xhV6yVsijnnes3lt8P9zPshJXo6UrIujzF9dmQGwXNofFVtnqRUSy5kjwWhwfQHe7w+BumZX5ELaoZkKVa5Vjhha81bcvbwT+RM1c8+gIVJwYyAN4+e6XwGSOa+Zu91zzJQAn1s45zk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 167648327043185.29857284381285; Wed, 15 Feb 2023 09:47:50 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-593-Xr-w_9iwMtWTO7C_j4murA-1; Wed, 15 Feb 2023 12:47:44 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 272673C218B0; Wed, 15 Feb 2023 17:47:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10446112132C; Wed, 15 Feb 2023 17:47:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0AD0F1946A49; Wed, 15 Feb 2023 17:47:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EB2F119465B6 for ; Wed, 15 Feb 2023 17:47:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D5FAF40C1106; Wed, 15 Feb 2023 17:47:17 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id F046140C1423; Wed, 15 Feb 2023 17:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676483269; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Dyy/1RzvkVp1pdcd4XazalgcwoIuoecJZnqiF2nDZkw=; b=AtgTZPI/+XrRQJ0EKbH61Z8OSOsgrmvDJaUdo+xmN+mEfMpnymjOZaYwqg6WCblPn36DqF zKdKOKUq0SSSlvJ52ALRd9YwD/6GQlmUMfPkd1oiVU8YJ3/zkV4N9v1tRfERn0Y/9bpWzX 2HWj53NmlUQURDVK29ezGUvy8exNkbM= X-MC-Unique: Xr-w_9iwMtWTO7C_j4murA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 1/5] crypto: TLS: introduce `check_pending` Date: Wed, 15 Feb 2023 17:47:08 +0000 Message-Id: <20230215174712.1894516-2-berrange@redhat.com> In-Reply-To: <20230215174712.1894516-1-berrange@redhat.com> References: <20230215174712.1894516-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, libvir-list@redhat.com, Peter Lieven , Hanna Reitz , Gerd Hoffmann , Ronnie Sahlberg , Paolo Bonzini , Antoine Damhet Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676483271932100002 From: Antoine Damhet 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 Signed-off-by: Daniel P. Berrang=C3=A9 --- 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, } =20 =20 +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, } =20 =20 +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 *se= ss, char *buf, size_t len); =20 +/** + * 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 --=20 2.39.1