From nobody Mon Feb 9 16:32:43 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=1591723939; cv=none; d=zohomail.com; s=zohoarc; b=dYF018IzJ9XrqGuqQ1FVi9GEeCkeEVT3GHoIk8Gei6Nrroz0VZfzqil8pc5TTalxB+alIcr+t6ETgIf/DzPyUV16n2ImEC5CrrWsoPYL4d3U1ghvYK3Mvhv5ea6ywpGhsLD/9CneL0dbFPXNtPi/Wf5skZbKcN0EMRt/Qthubg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591723939; 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=l1FNMSzdxkTmtGs96MOlFxksQhCZtICy60TUvMz4Bw8=; b=VJh1e1hj03ldRbPVkeAylQGwY0pbcHd02pDarlDr3NIQVWyKA/TxqsP42Csg34t4s4bC+L/O97oLMAqYDZMjP74yX3HkMGWzcWtJleyQrpAp0y4ge1KWpCJUJLHOKWQH8si1Xv1xyLDnnQsm1k4aBgZdXTuGDHak0mGMVr4CsSg= 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 1591723939612452.6960577998585; Tue, 9 Jun 2020 10:32:19 -0700 (PDT) Received: from localhost ([::1]:45730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jii6j-0004PW-Vj for importer@patchew.org; Tue, 09 Jun 2020 13:32:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jihjc-0004Wc-Nj for qemu-devel@nongnu.org; Tue, 09 Jun 2020 13:08:24 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:27494 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 1jihjb-0008V2-Br for qemu-devel@nongnu.org; Tue, 09 Jun 2020 13:08:24 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-154-DqKAUvpfOXSjYy3o5_FPmg-1; Tue, 09 Jun 2020 13:07:58 -0400 Received: by mail-wr1-f70.google.com with SMTP id h6so8913847wrx.4 for ; Tue, 09 Jun 2020 10:07:55 -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 t129sm3907474wmf.41.2020.06.09.10.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 10:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591722502; 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=l1FNMSzdxkTmtGs96MOlFxksQhCZtICy60TUvMz4Bw8=; b=K9Dg+HxdMBkceNzqJJ+capetzES/cOmKOog3CrTGa1uwrp5RZniL/07fsVI+Qrb41EG+Ky 0s7/8hKcbQfxPuG171fQx0D+XqeVMX8GaMJP70P4LBnKPWqDrAX2/qGGYe7TR52tZ3onyw sbdpLJLvpil92ZyWg3BBykm6aaTExKI= X-MC-Unique: DqKAUvpfOXSjYy3o5_FPmg-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=l1FNMSzdxkTmtGs96MOlFxksQhCZtICy60TUvMz4Bw8=; b=UgwH3ZOFinzsmZlFCzFa0iKMY5pIPL42ZUmokhGmIyvUE7EXqcCpoIaZrKTwTpnX0A zeHwwjqfFJZvazLkfdnxDubaSPzH1nf/WKu9A1MsD7GfSXzFFQWJryn96ruXXx0tjPft v3UXQG7dChijIKC09vbFq1pqopsNh5TwkJ3+9tdzhconrdLoHzkZL00sSN9DFZUMdtB+ d16RM0A3iBxhIIULgF3cuptvMhlynkLB2zjt+Uy08/076HKsGlZfGr3O4jUntNWBMZ2r stlubbGDakSCBGMI4/WfQSeJVQ2+OuVZuqjoZxlrUoJHza+41B1e/oFp9PXLijyDgkDL 8mEw== X-Gm-Message-State: AOAM532GrpxjFmrHKSwvP0tNY2k31rgwo7X+9PelQfRMsMRrC245XVZt srpShjVQ5LSirNQx8FTYZswdFTYXU/vCn1CladNp7xS3pXTDE2Wrwjfu0gyCKElIri/ZNSa1F4O dx/bfDWj2hHSbD84= X-Received: by 2002:a05:6000:10d2:: with SMTP id b18mr5488103wrx.366.1591722473635; Tue, 09 Jun 2020 10:07:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx+or+ybnKrmibafZ+Zx5rFyOofLgppbqZQhSlVO4Q548GL5ihPzz6IEjcwQSbBYgFW9U+Mw== X-Received: by 2002:a05:6000:10d2:: with SMTP id b18mr5488088wrx.366.1591722473413; Tue, 09 Jun 2020 10:07:53 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Gerd Hoffmann , qemu-devel@nongnu.org Subject: [PATCH v8 5/5] crypto/tls-cipher-suites: Produce fw_cfg consumable blob Date: Tue, 9 Jun 2020 19:07:27 +0200 Message-Id: <20200609170727.9977-6-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200609170727.9977-1-philmd@redhat.com> References: <20200609170727.9977-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/09 02:41:53 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 --- v8: Add example in qemu-options.hx --- crypto/tls-cipher-suites.c | 19 +++++++++++++++++++ qemu-options.hx | 19 +++++++++++++++++++ 2 files changed, 38 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 c74366d7cc..b12cc910e3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4585,6 +4585,25 @@ SRST string as described at https://gnutls.org/manual/html_node/Priority-Strings.html. =20 + An example of use of this object is to enable the UEFI HTTPS Boot. + The tls-cipher-suites object exposes the ordered list of permitted + TLS cipher suites from the host side to the 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 of the new obje= ct + type. ``priority=3D@SYSTEM`` may be used to refer to + /etc/crypto-policies/back-ends/gnutls.config (given that QEMU uses + GNUTLS). + + .. 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