Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp360789lqs; Tue, 5 Mar 2024 04:31:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXxLqLfCwznjixJiAz5fa/hfGFnU4GwPsejWWHrM6itkSXQIvbUekgsfWyKY4056WfMn70gn7wa4Vr8iFeZWtEy7yb2q47qgniqK4yjTA== X-Google-Smtp-Source: AGHT+IESbpTkpt0XIQNiZOgjWs/Mq37gO3HTCzmlGziVTWp4RAbFFHHwXg0VaOFiLu3ksO6pJb7b X-Received: by 2002:a05:622a:144d:b0:42e:80e5:3c with SMTP id v13-20020a05622a144d00b0042e80e5003cmr2079541qtx.6.1709641913817; Tue, 05 Mar 2024 04:31:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709641913; cv=pass; d=google.com; s=arc-20160816; b=eHL97/ePVxMjSPXbK+xEBKUhyZK6lZQBreHzhQTQbB2bQkjmSBBXVdj5VLavtS3CtD q9IFcnXh9EH68QLrP6UG1lhGn5scWvSIz7TpODl1So2drZ9yASWSSXVFFj+asq9ILo4+ CcKMgrk09ratT4w1pz6M5/8eSH+CPYPAae7MSEQH+JYzlH+cONZP29KEwjGtT4tQt/RH YW4inKTKhbDgoLqVdZMwyySnAWEnsQEhYrTnTxPF6XAsYtwMzbkoZjDXcGxpR5eg1qH9 2k0Cq2vRt0CJPkwolrroqtHQ4B1OkU6r82JI+wcCm2NjT1rC8Ln5ARxuURdlLgEWD+o1 fpFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=yO3n6KYXo33Xsc4SiWnMfOg3kui2ahdzf5GeukwEkgI=; fh=a06dERFC1gCS+LcQWBa8LvTAxhYFkjheqp/rLch3JEQ=; b=K3AQwquITJItnRaD0ZYn4Ey2FOnwZ+2MQQM3d2OaXDcxhcN8X0JlX5E38E5sku50c2 eVPIVPtMYGVm0j6cmfagEZZ/VEKS15nlOfi0yVYx7hmVisudg0/YQ5Wn0t2MxMLvl5SF I7fM57RotWdo1E51SFAYwy1l5+HZtCIbKTBExFJk/oE/oodkx+SjKTbX5PO6Wb31jsYI 1PvdI5ygIDKOrvLVB3b1eycRjZT1hE1GwIOa0ySKZBCOR6y29urZSTxWVgoWxYtJED1a aHvSd73W7MWWGCDopUT5jzRUDN/BhF+OAHgNUgQwNO5uv4lDqiADWmr8ggDVN8lyxuVZ V44A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J650lcTV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-92378-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92378-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o7-20020a05622a008700b0042ee0332b2dsi6604245qtw.217.2024.03.05.04.31.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 04:31:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92378-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J650lcTV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-92378-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92378-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CCC541C254B1 for ; Tue, 5 Mar 2024 12:31:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 605875BAC8; Tue, 5 Mar 2024 12:29:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="J650lcTV" Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0ABE35B68A for ; Tue, 5 Mar 2024 12:29:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709641791; cv=none; b=TsIm/APCGCNVExfNY7GhFkKM2ZklepibeY4ZYhQ5YcRWJK9j6S4jpDY0wvKSHFXKgyFMBzCt2c/m24XszfmIDz05d5Bey+nZb929+vucQpa0FMWb5sPJAtZWGdc2CzXlj4LLUjTxxm3TlmRYINAHuz8TtL7Nd8F4SAre1VePr0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709641791; c=relaxed/simple; bh=ayZBI8lVp/BWzkFGNvW228CHOibWeTInhSFUMyfIloA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Twu2PpcREVZKKHku2kND4cPVkJ4Ob0SOSX9uci/pTnkVhrcXDn0XDilnCqL80s5QhNnCNMlxhk/cLClbl+OXPKZ6eRnSaR+TfhemaqaHNiKur6x6T6FJZGfLII/hdRVcFkVY2BB308iQFWNV1yCOKT1pkDGi8Wz5+nr2IIHZpFU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=J650lcTV; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-608959cfcbfso6807847b3.3 for ; Tue, 05 Mar 2024 04:29:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709641789; x=1710246589; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yO3n6KYXo33Xsc4SiWnMfOg3kui2ahdzf5GeukwEkgI=; b=J650lcTVlIeVhgUhJI/JBPMK+n0QTKo3PLXOqYptaAO/Tj//CwEWpGDgvDSlrs4OFl qeOWRzumc4qQv6V+K9vbQJsjPh+OcBmpXMASYYubkZpEUz0RBV4xC4LUPcgnI8gGvNPK U3Tg7zUvg8UuH8H7I2VXnrm0kn9Vy+PhYLMr2tlWG2FbmdPpANjiGZvLTINuchdsd2q+ JZeXJTxpoxkT14/lKSCIkwSwb+EA2lg/bjLr7L5YIJXN6DZyE//v/CRUuZ18cxigHEcq Tj1T8XS5b1CUAHfmBZFYR2aqFKYbTZ4TiZJzTsaByE1HzO0PtJ2sRqjCrK0ic4VkJsBL uf1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709641789; x=1710246589; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yO3n6KYXo33Xsc4SiWnMfOg3kui2ahdzf5GeukwEkgI=; b=J3Jr2/5gOWEn0CGpjT5x2sBsenPGsa6q2HorO7BYO68RCQf5e1xVgMcqjKPenDYjCP vekDjiYFdRDYH7Hk8EiRmdEvadS52EmjnF2xRR8RRAkyh862vObuzWDyMefOWXiSNVM3 PfcRP8BmNnwYHScWmyFyV+wAvsCAgtRPl1Uvugd/pRBzO+wUqDKISHK5ssEimNuNGNZB 7F8EUUXko4Ym1x/O/oZ65iRLuu5zHhM3lwHe0cEYsuKo38POL4p7jKEOVsPmihn7mp8m 6UeMuXPzDCwJlLtUkJ+RLx8laFXUMFxkGH+ANHKmSzudscaBiG9wZkXZ5ESTUESICdH0 ohIw== X-Gm-Message-State: AOJu0YwyvDl7zmLo4q6AZu06qiCKkIdjQu4/PnSXRVt81u9qLTxDD4CQ HbpRz1tggZ4yYfd1z2ZOYtm5QPgYt7MeijBcK3mGpprVgMU5dKL9wOakfXBWRLmwK86x/hrjC7M Xl2ickV4Yf/7R/k/nGumHAO/EPeBrovI1vEUPhA== X-Received: by 2002:a81:6c92:0:b0:609:b582:bb24 with SMTP id h140-20020a816c92000000b00609b582bb24mr4517291ywc.26.1709641788976; Tue, 05 Mar 2024 04:29:48 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240227153132.2611499-1-jens.wiklander@linaro.org> <20240227153132.2611499-2-jens.wiklander@linaro.org> In-Reply-To: <20240227153132.2611499-2-jens.wiklander@linaro.org> From: Linus Walleij Date: Tue, 5 Mar 2024 13:29:38 +0100 Message-ID: Subject: Re: [PATCH v3 1/3] rpmb: add Replay Protected Memory Block (RPMB) subsystem To: Jens Wiklander Cc: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, op-tee@lists.trustedfirmware.org, Shyam Saini , Ulf Hansson , Jerome Forissier , Sumit Garg , Ilias Apalodimas , Bart Van Assche , Randy Dunlap , Ard Biesheuvel , Arnd Bergmann , Greg Kroah-Hartman , Tomas Winkler , =?UTF-8?B?QWxleCBCZW5uw6ll?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Jens, I realized there is one thing I wonder about: On Tue, Feb 27, 2024 at 4:31=E2=80=AFPM Jens Wiklander 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