Re: [PATCH v3 1/3] rpmb: add Replay Protected Memory Block (RPMB) subsystem
From: Linus Walleij
Date: Tue Mar 05 2024 - 07:31:00 EST
Hi Jens,
I realized there is one thing I wonder about:
On Tue, Feb 27, 2024 at 4:31 PM Jens Wiklander
<jens.wiklander@xxxxxxxxxx> wrote:
> +struct rpmb_frame {
> + u8 stuff[196];
> + u8 key_mac[32];
> + u8 data[256];
> + u8 nonce[16];
> + __be32 write_counter;
> + __be16 addr;
> + __be16 block_count;
> + __be16 result;
> + __be16 req_resp;
> +} __packed;
I didn't quite get why these things are encoded big-endian?
As on the producer side (the eMMC backend) it seems we are anyway
calling cpu_to_be* to convert them into this format.
If this is a requirement on the consumer side (such as TEE) I think
the consumer should swap the bytes rather than the producer,
but I guess that kind of assumes that we foresee there will be other
consumers in the first place.
Yours,
Linus Walleij