All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-devel <qemu-devel@nongnu.org>, Bin Meng <bmeng.cn@gmail.com>,
	qemu-block@nongnu.org,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH 7/8] hw/sd/sdcard: Handle RPMB MAC field
Date: Tue, 26 Aug 2025 11:18:24 +0100	[thread overview]
Message-ID: <aK2J8GFi7hRdK9Nq@redhat.com> (raw)
In-Reply-To: <c9f0e2e0-d533-4aa5-944e-cc5f0da30645@linaro.org>

On Mon, Aug 25, 2025 at 06:30:52PM +0200, Philippe Mathieu-Daudé wrote:
> +Dan
> 
> On 25/8/25 18:12, Jan Kiszka wrote:
> > On 25.08.25 11:47, Philippe Mathieu-Daudé wrote:
> > > Hi Jan,
> > > 
> > > On 24/8/25 09:18, Jan Kiszka wrote:
> > > > From: Jan Kiszka <jan.kiszka@siemens.com>
> > > > 
> > > > Implement correct setting of the MAC field when passing RPMB frames back
> > > > to the guest. Also check the MAC on authenticated write requests.
> > > > 
> > > > As this depends on HMAC support for QCRYPTO_HASH_ALGO_SHA256, only
> > > > register the eMMC class if that is available.
> > > > 
> > > > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> > > > ---
> > > >    hw/sd/sd.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
> > > >    1 file changed, 89 insertions(+), 1 deletion(-)
> > > 
> > > 
> > > > @@ -3122,6 +3201,7 @@ static const TypeInfo sd_types[] = {
> > > >            .parent         = TYPE_SD_CARD,
> > > >            .class_init     = sd_spi_class_init,
> > > >        },
> > > > +    /* must be last element */
> > > >        {
> > > >            .name           = TYPE_EMMC,
> > > >            .parent         = TYPE_SDMMC_COMMON,
> > > > @@ -3129,4 +3209,12 @@ static const TypeInfo sd_types[] = {
> > > >        },
> > > >    };
> > > >    -DEFINE_TYPES(sd_types)
> > > > +static void sd_register_types(void)
> > > > +{
> > > > +    int num = ARRAY_SIZE(sd_types);
> > > > +    if (!qcrypto_hmac_supports(QCRYPTO_HASH_ALGO_SHA256)) {
> > > > +        num--;
> > > 
> > > Instead, expose RPMB feature in CSD when HMAC supported?
> > > 
> > > Something in emmc_set_ext_csd() in the lines of:
> > > 
> > >    if (qcrypto_hmac_supports(QCRYPTO_HASH_ALGO_SHA256)) {
> > >        sd->ext_csd[EXT_CSD_REV] = 5;
> > >        sd->ext_csd[EXT_CSD_RPMB_MULT] = sd->rpmb_part_size / (128 * KiB);
> > >        sd->ext_csd[EXT_CSD_PARTITION_SUPPORT] = 0b111;
> > >    } else {
> > >        sd->ext_csd[EXT_CSD_REV] = 3;
> > >    }
> > 
> > I need to check if revision 5 still had RPMB as optional (current ones
> > definitely require it), but I don't think rolling back to revision 3
> > would be good idea. If start to add more features from newer revisions,
> > that may cause even more weird results from the user perspective. I'm
> > not saying we are fully compliant in one or the other version, rather
> > that we need to work towards becoming so. Have to support multiple
> > versions along that will not make it easier.
> 
> Daniel, do you have a rough idea how many of our build config do
> not support QCRYPTO_HASH_ALGO_SHA256?
> (looking about making the SD device unconditional to it).

That's always available, since we can get it from 'glib' even when no
crypto libs are linked.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-08-26 10:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-24  7:18 [PATCH 0/8] sd: Add RPMB emulation to eMMC model Jan Kiszka
2025-08-24  7:18 ` [PATCH 1/8] hw/sd/sdcard: Fix size check for backing block image Jan Kiszka
2025-08-25  9:39   ` Philippe Mathieu-Daudé
2025-08-24  7:18 ` [PATCH 2/8] hw/sd/sdcard: Add validation for boot-partition-size Jan Kiszka
2025-08-24  7:18 ` [PATCH 3/8] hw/sd/sdcard: Allow user-instantiated eMMC Jan Kiszka
2025-08-24  7:18 ` [PATCH 4/8] hw/sd/sdcard: Refactor sd_bootpart_offset Jan Kiszka
2025-08-25  9:41   ` Philippe Mathieu-Daudé
2025-08-24  7:18 ` [PATCH 5/8] hw/sd/sdcard: Add basic support for RPMB partition Jan Kiszka
2025-08-24  7:18 ` [PATCH 6/8] crypto/hmac: Allow to build hmac over multiple qcrypto_gnutls_hmac_bytes[v] calls Jan Kiszka
2025-08-25  9:43   ` Philippe Mathieu-Daudé
2025-08-24  7:18 ` [PATCH 7/8] hw/sd/sdcard: Handle RPMB MAC field Jan Kiszka
2025-08-25  9:47   ` Philippe Mathieu-Daudé
2025-08-25 16:12     ` Jan Kiszka
2025-08-25 16:30       ` Philippe Mathieu-Daudé
2025-08-26 10:18         ` Daniel P. Berrangé [this message]
2025-08-27  5:53           ` Jan Kiszka
2025-08-27  9:53             ` Daniel P. Berrangé
2025-09-09 14:39   ` Jerome Forissier
2025-08-24  7:18 ` [PATCH 8/8] scripts: Add helper script to generate eMMC block device images Jan Kiszka
2025-08-25  9:51   ` Philippe Mathieu-Daudé
2025-09-09 14:25   ` Jerome Forissier
2025-09-14 12:23     ` Jan Kiszka
2025-08-24  7:41 ` [PATCH 0/8] sd: Add RPMB emulation to eMMC model Jan Kiszka via OP-TEE
2025-08-24  7:41   ` Jan Kiszka
2025-08-26 10:57   ` Sumit Garg via OP-TEE
2025-08-27  5:55     ` Jan Kiszka via OP-TEE
2025-08-27  5:55       ` Jan Kiszka
2025-10-19 16:35       ` Jan Kiszka via OP-TEE
2025-10-19 16:35         ` Jan Kiszka
2025-09-03 14:35   ` Jerome Forissier

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=aK2J8GFi7hRdK9Nq@redhat.com \
    --to=berrange@redhat.com \
    --cc=bmeng.cn@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jan.kiszka@siemens.com \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.