From nobody Mon Feb 9 11:33:20 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=1592933340; cv=none; d=zohomail.com; s=zohoarc; b=deVodaDlOdehCcPNbQOgtCJDWc1DPjVic44SGvppHH3gvzWzkF+L0BbaqR/mjmLc04m9OiipFR9En7LjkYb3lP+VFO7AM1fWO6a8OvBrZeHCoDXQLom1I4/mFy8cZxqToZzY+kcCzXAGNCSC6BwAWEX0jp0l7aSneQ6sZb3mQzI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592933340; 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=LRhf/BOyEtnWuCwhaLT5z/wF75mx5JS0IrqRF4jhdTg=; b=kPqC33GjBIczriiRpV/eYdjTlFgInFAjKRS0xQ1fNEwA+alrUOPQXEUlDlUGmu148KChX3hJqfaG+6QcgmaAivwIN32xfFEKGi2BzJ35yI1j6tw6lD0iU6u5uZDtM+AJbwqZKJcMKTC1nGAutmApG6gVkVwhhZrfNlz5y4Asy04= 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 1592933340436465.10235975984233; Tue, 23 Jun 2020 10:29:00 -0700 (PDT) Received: from localhost ([::1]:59894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnmjB-00073u-1m for importer@patchew.org; Tue, 23 Jun 2020 13:28:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnmiD-0005o3-UK for qemu-devel@nongnu.org; Tue, 23 Jun 2020 13:27:57 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:36700 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 1jnmiB-0003nw-NN for qemu-devel@nongnu.org; Tue, 23 Jun 2020 13:27:57 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-YIPWi4X3M3ecJ5CHdcWV9Q-1; Tue, 23 Jun 2020 13:27:52 -0400 Received: by mail-wm1-f69.google.com with SMTP id p24so5106725wmc.1 for ; Tue, 23 Jun 2020 10:27:52 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id u20sm3458369wmm.15.2020.06.23.10.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 10:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592933274; 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=LRhf/BOyEtnWuCwhaLT5z/wF75mx5JS0IrqRF4jhdTg=; b=UwlntGE4TdUnqJ0lKkp9wgy/6GfB46bIoVVt67ZhIijof3Of392u6txcDjzfob47nY/8aI lb/ju4PJ2J+Psj7MGBl0E+iTV9t0N6cxz2qsnzI4tjZC1OXDDuOlRlta2j262B4aweN4Vv XEGyB7Dfc7zvchW3SCqAA8Q3HdwdeC4= X-MC-Unique: YIPWi4X3M3ecJ5CHdcWV9Q-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=LRhf/BOyEtnWuCwhaLT5z/wF75mx5JS0IrqRF4jhdTg=; b=ityTBFujwgZSAPAEIUu8OQo2f08QNXLdqZ4OMCpEqXFaV4pvCyYaltwC3DToDdyHHw n+Our5E+jEIwfAu6X8Ne8/O68HdLyCL8sv7oV6rDQTcQLllKrTWL4cd53c64Mo+RrFMM p3h6TdF9uTniGL/uOPq0rc1aHHgLtlqTu5n4JLam4MzJA1OcZtHx1+LIs1O18EygwuaX v+B2++gLEoH5j+3XMpFMJii3G92CZAxvvp+r8kqnbLGro46Ll/6Mr7oVLUnL7ZeVuTBj 59rGqFK6yq8LB2MgwfdENjpsO7l76zog5KbXXhmp9qZ+mV8qMb2wXIFUlQN4wfZuV2mJ hC/g== X-Gm-Message-State: AOAM530N1YcF8gyJusuzP2mPRoLbNj9f+hSB4uy9B+uRF8ja44B46wok 9SCRTANjoaC79WNPZiIa+90+DPwlzo2mv7rUHPaIkrnAyCaUClzaBm/O08UM9gQXbVQmwmKuOqY BlMUe5eC/wJ9+gz0= X-Received: by 2002:adf:ef01:: with SMTP id e1mr16362850wro.116.1592933271419; Tue, 23 Jun 2020 10:27:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVH+lAMrCKFvJtm5krPJ4aHcjOIwJIpESAFUrEE0UFl1sZWgRtYJp6WBmDO1iKzncX49nXsw== X-Received: by 2002:adf:ef01:: with SMTP id e1mr16362827wro.116.1592933271166; Tue, 23 Jun 2020 10:27:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v10 5/5] crypto/tls-cipher-suites: Produce fw_cfg consumable blob Date: Tue, 23 Jun 2020 19:27:26 +0200 Message-Id: <20200623172726.21040-6-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200623172726.21040-1-philmd@redhat.com> References: <20200623172726.21040-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/23 01:55:08 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?Philippe=20Mathieu-Daud=C3=A9?= , Laszlo Ersek , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= 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. Example of use to dump the cipher suites (if tracing enabled): $ qemu-system-x86_64 -S \ -object tls-cipher-suites,id=3Dmysuite1,priority=3D@SYSTEM \ -fw_cfg name=3Detc/path/to/ciphers,gen_id=3Dmysuite1 \ -trace qcrypto\* 1590664444.197123:qcrypto_tls_cipher_suite_priority priority: @SYSTEM 1590664444.197219:qcrypto_tls_cipher_suite_info data=3D[0x13,0x02] versio= n=3DTLS1.3 name=3DTLS_AES_256_GCM_SHA384 1590664444.197228:qcrypto_tls_cipher_suite_info data=3D[0x13,0x03] versio= n=3DTLS1.3 name=3DTLS_CHACHA20_POLY1305_SHA256 1590664444.197233:qcrypto_tls_cipher_suite_info data=3D[0x13,0x01] versio= n=3DTLS1.3 name=3DTLS_AES_128_GCM_SHA256 1590664444.197236:qcrypto_tls_cipher_suite_info data=3D[0x13,0x04] versio= n=3DTLS1.3 name=3DTLS_AES_128_CCM_SHA256 1590664444.197240:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x30] versio= n=3DTLS1.2 name=3DTLS_ECDHE_RSA_AES_256_GCM_SHA384 1590664444.197245:qcrypto_tls_cipher_suite_info data=3D[0xcc,0xa8] versio= n=3DTLS1.2 name=3DTLS_ECDHE_RSA_CHACHA20_POLY1305 1590664444.197250:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x14] versio= n=3DTLS1.0 name=3DTLS_ECDHE_RSA_AES_256_CBC_SHA1 1590664444.197254:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x2f] versio= n=3DTLS1.2 name=3DTLS_ECDHE_RSA_AES_128_GCM_SHA256 1590664444.197258:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x13] versio= n=3DTLS1.0 name=3DTLS_ECDHE_RSA_AES_128_CBC_SHA1 1590664444.197261:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x2c] versio= n=3DTLS1.2 name=3DTLS_ECDHE_ECDSA_AES_256_GCM_SHA384 1590664444.197266:qcrypto_tls_cipher_suite_info data=3D[0xcc,0xa9] versio= n=3DTLS1.2 name=3DTLS_ECDHE_ECDSA_CHACHA20_POLY1305 1590664444.197270:qcrypto_tls_cipher_suite_info data=3D[0xc0,0xad] versio= n=3DTLS1.2 name=3DTLS_ECDHE_ECDSA_AES_256_CCM 1590664444.197274:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x0a] versio= n=3DTLS1.0 name=3DTLS_ECDHE_ECDSA_AES_256_CBC_SHA1 1590664444.197278:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x2b] versio= n=3DTLS1.2 name=3DTLS_ECDHE_ECDSA_AES_128_GCM_SHA256 1590664444.197283:qcrypto_tls_cipher_suite_info data=3D[0xc0,0xac] versio= n=3DTLS1.2 name=3DTLS_ECDHE_ECDSA_AES_128_CCM 1590664444.197287:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x09] versio= n=3DTLS1.0 name=3DTLS_ECDHE_ECDSA_AES_128_CBC_SHA1 1590664444.197291:qcrypto_tls_cipher_suite_info data=3D[0x00,0x9d] versio= n=3DTLS1.2 name=3DTLS_RSA_AES_256_GCM_SHA384 1590664444.197296:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x9d] versio= n=3DTLS1.2 name=3DTLS_RSA_AES_256_CCM 1590664444.197300:qcrypto_tls_cipher_suite_info data=3D[0x00,0x35] versio= n=3DTLS1.0 name=3DTLS_RSA_AES_256_CBC_SHA1 1590664444.197304:qcrypto_tls_cipher_suite_info data=3D[0x00,0x9c] versio= n=3DTLS1.2 name=3DTLS_RSA_AES_128_GCM_SHA256 1590664444.197308:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x9c] versio= n=3DTLS1.2 name=3DTLS_RSA_AES_128_CCM 1590664444.197312:qcrypto_tls_cipher_suite_info data=3D[0x00,0x2f] versio= n=3DTLS1.0 name=3DTLS_RSA_AES_128_CBC_SHA1 1590664444.197316:qcrypto_tls_cipher_suite_info data=3D[0x00,0x9f] versio= n=3DTLS1.2 name=3DTLS_DHE_RSA_AES_256_GCM_SHA384 1590664444.197320:qcrypto_tls_cipher_suite_info data=3D[0xcc,0xaa] versio= n=3DTLS1.2 name=3DTLS_DHE_RSA_CHACHA20_POLY1305 1590664444.197325:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x9f] versio= n=3DTLS1.2 name=3DTLS_DHE_RSA_AES_256_CCM 1590664444.197329:qcrypto_tls_cipher_suite_info data=3D[0x00,0x39] versio= n=3DTLS1.0 name=3DTLS_DHE_RSA_AES_256_CBC_SHA1 1590664444.197333:qcrypto_tls_cipher_suite_info data=3D[0x00,0x9e] versio= n=3DTLS1.2 name=3DTLS_DHE_RSA_AES_128_GCM_SHA256 1590664444.197337:qcrypto_tls_cipher_suite_info data=3D[0xc0,0x9e] versio= n=3DTLS1.2 name=3DTLS_DHE_RSA_AES_128_CCM 1590664444.197341:qcrypto_tls_cipher_suite_info data=3D[0x00,0x33] versio= n=3DTLS1.0 name=3DTLS_DHE_RSA_AES_128_CBC_SHA1 1590664444.197345:qcrypto_tls_cipher_suite_count count: 29 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Laszlo Ersek Reviewed-by: Daniel P. Berrang=C3=A9 --- v10: Removed Laszlo Acked-by due to logical changes --- crypto/tls-cipher-suites.c | 11 +++++++++++ qemu-options.hx | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/crypto/tls-cipher-suites.c b/crypto/tls-cipher-suites.c index 5b403f86c9..b3dba00010 100644 --- a/crypto/tls-cipher-suites.c +++ b/crypto/tls-cipher-suites.c @@ -13,6 +13,7 @@ #include "qom/object_interfaces.h" #include "crypto/tlscreds.h" #include "crypto/tls-cipher-suites.h" +#include "hw/nvram/fw_cfg.h" #include "trace.h" =20 /* @@ -88,11 +89,20 @@ static void qcrypto_tls_cipher_suites_complete(UserCrea= table *uc, } } =20 +static GByteArray *qcrypto_tls_cipher_suites_fw_cfg_gen_data(Object *obj, + Error **errp) +{ + return qcrypto_tls_cipher_suites_get_data(QCRYPTO_TLS_CIPHER_SUITES(ob= j), + errp); +} + 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_fw_cfg_gen_data; } =20 static const TypeInfo qcrypto_tls_cipher_suites_info =3D { @@ -103,6 +113,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