From nobody Sun Feb 8 18:32:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592217504; cv=none; d=zohomail.com; s=zohoarc; b=D4c1ZgRnUFCoRzU+K1MrqeSv3llWgFWhci3Yu+k3lInb4yE/Dwsmcoe0TDIWd1XJApLqA47+S357yEM4JvbyprEAqhXv8yPxyhjvMv3ZXprgBfLjP69NyZH6iEW5JwDC9UX9MdjKaBl1atrrh2kd0Jbzs0x9xbvQRfv38VNxpPE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592217504; 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=0TdNeUFrgdnxc067dpUc6dq6R6Ay3YvPU+WKCInzAo4=; b=bTOhTaND1vL/cKU7QhmOmnMbzJpol2bHdQYu/+iIjM8V4IDwkcMBP46L29udNIoAywLP5xvhIBwQplZ6uIuneRd04qC7o3KK3l8KTDJ9OuJXkaTST6FzVYr+lfNweBsH3PxFwhX36wFUhxKrwNanas/j16l3ugHgNnG/Lgn94uU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592217504721264.5359408167676; Mon, 15 Jun 2020 03:38:24 -0700 (PDT) Received: from localhost ([::1]:59842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkmVT-0003if-F9 for importer@patchew.org; Mon, 15 Jun 2020 06:38:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkmSr-0007YK-Jd for qemu-devel@nongnu.org; Mon, 15 Jun 2020 06:35:41 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:42247 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jkmSp-0007H1-Mg for qemu-devel@nongnu.org; Mon, 15 Jun 2020 06:35:41 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-186-i8EHCIVxPt22uH0Znctgxg-1; Mon, 15 Jun 2020 06:35:37 -0400 Received: by mail-wm1-f71.google.com with SMTP id p24so6515846wmc.1 for ; Mon, 15 Jun 2020 03:35:36 -0700 (PDT) Received: from localhost.localdomain (181.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.181]) by smtp.gmail.com with ESMTPSA id y5sm24794213wrs.63.2020.06.15.03.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2020 03:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592217338; h=from:from: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; bh=0TdNeUFrgdnxc067dpUc6dq6R6Ay3YvPU+WKCInzAo4=; b=JvTMiMIzOQ0Lwz/GHag/iWdfPjupNxwM/eLaYq1p43OMTyEdnxSwIv6BjVb+BySjTn8b9Y MBwg9AWnM3QOdp9wN8MTstktQOI5SyQXhYQyEJqyvWW8WOCa0JbsqA7EJK70z8nuGC2QWL nOKudgmGZv2NX2jKCYuhIuGT0mVpkQM= X-MC-Unique: i8EHCIVxPt22uH0Znctgxg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0TdNeUFrgdnxc067dpUc6dq6R6Ay3YvPU+WKCInzAo4=; b=Ya+9uvdPIIvzKf/IPjLRVIM6Z7taWWrni2vvIKnVt9Fk7HRy9d+vhE9ilJJ14zBsFq /zaIRSN3UfJ+M+Wfz7v2e/wGEOXC9dTJC8J4kSFwnC4bMNkT7+blprAnHOGjPObapfDZ cIXojYnmUcyqkLeV9nAlvvSmAPU4F6/MOzZa/l03dhM7kZ4QqZCWYSRIe4Ur04WG7hd0 VqRG39C1/SEsecwV78lizS14eH1QNzVj09qgHkNyq+WHwZ/vW6Wi6JB3UNyUd+Iwhb3d 6RlZG7Tzw8pbht6lRyCj9JeGyhASDIFsPF7VF8Uytvb0GBvv1PGpMkf51m0+1kbBTEJD sqXw== X-Gm-Message-State: AOAM5320zC0mO1riMxJclVpRfotogZvTskYefXhFOhlpsZPc2nNlYWxp KdR8kWdhxU3Jifl09Fty20apg8fL2psehZ6/uMjuVrbcnsKvEF4wN9vXJiD3zVfA0LG4V6Qwd8g 1SJn+04LvrD1T/ws= X-Received: by 2002:a05:6000:120b:: with SMTP id e11mr28312335wrx.107.1592217335604; Mon, 15 Jun 2020 03:35:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz635h8fZF/aEc9mIj2mUzTOHcb6Kll2rIgjSg+sygCRyo2m9t/m62wol35ZR0PjIRj5KhHJA== X-Received: by 2002:a05:6000:120b:: with SMTP id e11mr28312319wrx.107.1592217335358; Mon, 15 Jun 2020 03:35:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Gerd Hoffmann Subject: [PATCH v9 5/5] crypto/tls-cipher-suites: Produce fw_cfg consumable blob Date: Mon, 15 Jun 2020 12:34:57 +0200 Message-Id: <20200615103457.25282-6-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200615103457.25282-1-philmd@redhat.com> References: <20200615103457.25282-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8"; text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/15 01:12:36 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laszlo Ersek , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Since our format is consumable by the fw_cfg device, we can implement the FW_CFG_DATA_GENERATOR interface. Acked-by: Laszlo Ersek Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v9: Fixed typos in qemu-options.hx (lersek) --- crypto/tls-cipher-suites.c | 19 +++++++++++++++++++ qemu-options.hx | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/crypto/tls-cipher-suites.c b/crypto/tls-cipher-suites.c index f02a041f9a..d6ea0ed190 100644 --- a/crypto/tls-cipher-suites.c +++ b/crypto/tls-cipher-suites.c @@ -14,6 +14,7 @@ #include "qemu/error-report.h" #include "crypto/tlscreds.h" #include "crypto/tls-cipher-suites.h" +#include "hw/nvram/fw_cfg.h" #include "trace.h" =20 static void parse_cipher_suites(QCryptoTLSCipherSuites *s, @@ -99,11 +100,28 @@ static void qcrypto_tls_cipher_suites_finalize(Object = *obj) g_free(s->cipher_list); } =20 +static const void *qcrypto_tls_cipher_suites_get_data(Object *obj) +{ + QCryptoTLSCipherSuites *s =3D QCRYPTO_TLS_CIPHER_SUITES(obj); + + return s->cipher_list; +} + +static size_t qcrypto_tls_cipher_suites_get_length(Object *obj) +{ + QCryptoTLSCipherSuites *s =3D QCRYPTO_TLS_CIPHER_SUITES(obj); + + return s->cipher_count * sizeof(IANA_TLS_CIPHER); +} + static void qcrypto_tls_cipher_suites_class_init(ObjectClass *oc, void *da= ta) { UserCreatableClass *ucc =3D USER_CREATABLE_CLASS(oc); + FWCfgDataGeneratorClass *fwgc =3D FW_CFG_DATA_GENERATOR_CLASS(oc); =20 ucc->complete =3D qcrypto_tls_cipher_suites_complete; + fwgc->get_data =3D qcrypto_tls_cipher_suites_get_data; + fwgc->get_length =3D qcrypto_tls_cipher_suites_get_length; } =20 static const TypeInfo qcrypto_tls_cipher_suites_info =3D { @@ -115,6 +133,7 @@ static const TypeInfo qcrypto_tls_cipher_suites_info = =3D { .class_init =3D qcrypto_tls_cipher_suites_class_init, .interfaces =3D (InterfaceInfo[]) { { TYPE_USER_CREATABLE }, + { TYPE_FW_CFG_DATA_GENERATOR_INTERFACE }, { } } }; diff --git a/qemu-options.hx b/qemu-options.hx index 4f519f35fd..ce54c7359c 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4585,6 +4585,24 @@ SRST string as described at https://gnutls.org/manual/html_node/Priority-Strings.html. =20 + An example of use of this object is to control UEFI HTTPS Boot. + The tls-cipher-suites object exposes the ordered list of permitted + TLS cipher suites from the host side to the guest firmware, via + fw_cfg. The list is represented as an array of IANA_TLS_CIPHER + objects. The firmware uses the IANA_TLS_CIPHER array for configuri= ng + guest-side TLS. + + In the following example, the priority at which the host-side poli= cy + is retrieved is given by the ``priority`` property. + Given that QEMU uses GNUTLS, ``priority=3D@SYSTEM`` may be used to + refer to /etc/crypto-policies/back-ends/gnutls.config. + + .. parsed-literal:: + + # |qemu_system| \ + -object tls-cipher-suites,id=3Dmysuite0,priority=3D@SYSTE= M \ + -fw_cfg name=3Detc/edk2/https/ciphers,gen_id=3Dmysuite0 + ``-object filter-buffer,id=3Did,netdev=3Dnetdevid,interval=3Dt[,queue= =3Dall|rx|tx][,status=3Don|off][,position=3Dhead|tail|id=3D][,insert=3D= behind|before]`` Interval t can't be 0, this filter batches the packet delivery: all packets arriving in a given interval on netdev netdevid are --=20 2.21.3