From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C18003DB302 for ; Mon, 20 Jul 2026 10:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784544974; cv=none; b=JYVyOSJAdJmRm6ar76DSEi+RF6XlRYbcAnGwAArLfJjc95uUEZnmP+aWacPbiVFqMEyAe8PPieH3mT/XpB0Xw7gGJZuYhhejno+RoX8bMhAsw+Nr0y7yBubj0bndiEHXVdIScOXuysOHJEovgYwEXWtkRr+V6k92x9aTBzK/DHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784544974; c=relaxed/simple; bh=QoDcopLbbYP11iEHbn9QL4CnnbXfycGCpxp89Ht/HUA=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LFIn8UoGzQh9D7X8BLEgSbQvc9gej8y4TxIGwY0mVjXxVp5+uIvJPWUiCmCtsM6QCALDylVyc7ZdUroUU9vEQ6lv8LbAptiHxEdJmJwnuvPV7XAleAzbNAQAWqYQSLX9QGWfGvd6TYp30qgWy8g97kXej9ouTVd8exsPqcBLFzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=DgRWemk2; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=BaTlqHJq; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="DgRWemk2"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="BaTlqHJq" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66K9vXuI2403776 for ; Mon, 20 Jul 2026 10:56:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= M7aPhUjEPnnqCaXjWrYJvO18Nn305fIO+ZBJAuJmOYA=; b=DgRWemk2ir6lew4c 68ydLkiM6rp4cuZtPgr3eX/kC/7+Z/qnzhN0Wl/4crp+57B5htY/DiK5OhMEa9di PlgKoOpJroy4wlVXbZTMxfZNrWY4ywhYAea3igczwJIxSBPONestoeJ9WIBv/N6I 3hgG8AaAOEpSKKWamvOlKg+QuincFxtwYGbzsDkoDisx9WWltTiiSw/cpu9v2JjI dyBzzJ0U5YunC/5E3soxUvp40bHXM52Vn9HNDUbXlEueXcVVKx+5/1iSI4N87Swp oel4SuL9wY056PJOF9A0sF7JNkTqDwK7kyrvNwfTYf7BpZDmmMEfyFHCbSJc1QqG OoejOw== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fhfdcgu5r-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 20 Jul 2026 10:56:08 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-51c1d137a68so266039481cf.3 for ; Mon, 20 Jul 2026 03:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784544967; x=1785149767; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:date :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=M7aPhUjEPnnqCaXjWrYJvO18Nn305fIO+ZBJAuJmOYA=; b=BaTlqHJqO1qOPF/qXgvyYYabdS4sM8M4+Df4HQZUV4ChqJDROVm8FoHAphc96415ec a/5oEEXREMFNXk2UB7akL6yVKkdyfZVhfDqIkeESrMFwh/3ew9F6vBIzLI9qj9TRhArB 6EUxIDpDWwFeDRZbNHrc/yn4PnEviRCdPPraitZneaGcfPPZIO+czaYBUg3MRNU9uuwY SktLVJdutrj3WslrumIBCMMrAUFWFuv/9jaQYTzwgeR4tD5Kj0lEu09LOKak7MMNH/Dd bWJlBYe570lDlp12WLoDwwfARcus48wqB++wKDl2IxtXZ0jTKmhdIjR/7yGIm/zfDPKv c7mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784544967; x=1785149767; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:date :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=M7aPhUjEPnnqCaXjWrYJvO18Nn305fIO+ZBJAuJmOYA=; b=LTrSvo2cW17tGFJN5RVvNhIH25dQQ2NyLXhXJqlokIFyBf2UCtIqTy7cSdNuJgXnbq DGj3aEddSqSFpA5FGH2nvZF2wPQgbBcCm1zVdmfguMXhVlAgJGPWpUwEAREHdJHMBT4f Jy6SJzNomUonxyOyAIBTQZmxZCMVz5nWA7XdgekrdAOP+RqV0Y4hNhQS7g1jXx1EKYEq hrCQpf14Bi9JfjKW4HSn14bj+imxUUhTnS20nXukAFGOpbAGrf+3jbMlWXvJlTieFuoa luu96+6WWW6cSuI7+N8+cAbKvkGamEZmQZk6coThyGThZCRJ0iwkEwscBIzeZ7covlnh kUxQ== X-Forwarded-Encrypted: i=1; AHgh+RpzIiEUJ8SpDUaDA0mKu7Q3Mfnpfq8uAVnW5wXW94vFXmtcae+wgipgXw3i0dcPO+0RDpx/23vyAYmL3xA=@vger.kernel.org X-Gm-Message-State: AOJu0Yx82bkd0BWb6YrLNXreNpxFvSSFlPIw98uyi4p3T8L3UYU42/le VPr4UsWpil40BxwVPWRFHEqR/De5rkGn+vakXnca/vaSIPgdArGtATm6jjVOMA8cV+j5xjfo7vS Ebazwbs6ygr79WXAUQl9c06YaT8GrewOsrbsy7lmfQWP06zNydnIx5KyLlFhsRLTfuWyl1sc90r Y= X-Gm-Gg: AfdE7cly6/iM8QAAW9ZvkUIr62Q4H0B/vgJngIfBSbaHS0mVUv9mTuvxvEuaCr1bCDB qSjmiVGmxRZYUS0JYFG77urWgL0Lrkr834K6RG/oqu3tbLfruEnaLjuR19Nl+nDGsLSXNz2m1i/ GoLJ6H9zFM73hQHy6YT0//GgOK76mHHOGLLp9uRLJ0oa4IqXC7oyvcZtdhyF8iHrBRpAO/ohYxx CuTNdd/fYfl3hO7Z5+hoBMO3tEMRT8/vPBHUy3ASU2NWoh4DDEhSfWDtjI976w2xIDXYUtskvLt je0wmDeK50/XJKBm/2Ygh6gprp6RwGyHNHtVMYWa4xFPQCDpQUSP7OCp7fnEPpjSDblY1PQeXXg ANwG2OawypCrdPpCPBrE4E21G2SW5kTd81eE= X-Received: by 2002:a05:622a:87:b0:51c:730:a587 with SMTP id d75a77b69052e-5213ee7817bmr126697881cf.63.1784544967079; Mon, 20 Jul 2026 03:56:07 -0700 (PDT) X-Received: by 2002:a05:622a:87:b0:51c:730:a587 with SMTP id d75a77b69052e-5213ee7817bmr126697591cf.63.1784544966527; Mon, 20 Jul 2026 03:56:06 -0700 (PDT) Received: from trex (182.red-79-144-196.dynamicip.rima-tde.net. [79.144.196.182]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f63eeb360sm30368061f8f.34.2026.07.20.03.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 03:56:05 -0700 (PDT) From: Jorge Ramirez X-Google-Original-From: Jorge Ramirez Date: Mon, 20 Jul 2026 12:56:03 +0200 To: Bean Huo Cc: Jorge Ramirez-Ortiz , James.Bottomley@hansenpartnership.com, martin.petersen@oracle.com, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, can.guo@oss.qualcomm.com, beanhuo@micron.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, jenswi@kernel.org, sumit.garg@oss.qualcomm.com Subject: Re: [PATCH v1 0/2] ufs: rpmb: make RPMB usable with OP-TEE key derivation Message-ID: References: <20260720091614.544968-1-jorge.ramirez@oss.qualcomm.com> <2e8b4b54f8bdd933d97afdcd52d44682440647b0.camel@iokpp.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2e8b4b54f8bdd933d97afdcd52d44682440647b0.camel@iokpp.de> X-Proofpoint-ORIG-GUID: oldCmquCiBQnozSlZLPlK-uduu-94qsJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDEyMSBTYWx0ZWRfX9ojmLxXyhocA olgjO8MNxw42ErZesUJcUmE2ZCkrxVyQKdGPuWhiADO/eZnqwd26luFt3WW5th56VK4SEQLkdqJ 73/tdgWFYS0Vs6gsTm1uDeIUajHay5nWtjg7ivYNgEvj+c/7whs7rSV/jrEpJgM+rj9vhiKlYRQ 9+BuLJc/PFx1rIJA/v5tBJ6W2cznoSgchiszwPbBE89ffZD3fNWt4LluD8/lNiOHFdLXIYAshEq IPo16mov/BKgOwp5IQ7DINzsXwR/ihqRFZ/7m/bNJg2rRR1xKcBbVJzWrmTAu/dVmg5fezbq302 zNdYdCUkh0NIBCDoQWgiCdv0mm/W0dwPpcXln0Qozi/X/0RJtJG/90V6QGueEYeR63qGlOEsJ6F RemJiTJKa9jth70MltiZO3MYHbLDvHsSIQPERrB+HnGog5OA6B50rxuW5c+i5qea9Z6mIjTZ9z4 iSReCgRG6fwz/lJy4Yw== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDEyMSBTYWx0ZWRfXy8Ov54qROgAK fuTC2RJVSbce7dPIL9e3W3eHNZMarflLwfzlhf0i3sLrEbfACytTEV3kk6Kjig44yz+LzphcWtE q2rCD1ndsv7d3ssBFT36PbjLvb32XqM= X-Proofpoint-GUID: oldCmquCiBQnozSlZLPlK-uduu-94qsJ X-Authority-Analysis: v=2.4 cv=bv58wkai c=1 sm=1 tr=0 ts=6a5dfec8 cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=2lELrtOEK2EaG96G7mOeag==:17 a=8nJEP1OIZ-IA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=_EMmJvYMAAAA:8 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=NEAV23lmAAAA:8 a=IvsrKC1etgm4sCmQOs8A:9 a=qcg49hLlgF0N60+LroqrWnV/Vu4=:19 a=3ZKOabzyN94A:10 a=wPNLvfGTeEIA:10 a=a_PwQJl-kcHnX1M80qC6:22 a=emCv1hD2LFd8cNRmW21v:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-20_02,2026-07-17_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 priorityscore=1501 spamscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200121 On 20/07/26 12:23:39, Bean Huo wrote: > > This is very strange, coverletter is v1, but the patches are v2? I messed up (manual edition of the letter) but the thread is proper > > > On Mon, 2026-07-20 at 11:16 +0200, Jorge Ramirez-Ortiz wrote: > > This series makes UFS RPMB work out of the box with an OP-TEE that > > implements the standard eMMC RPMB key-derivation flow, without requiring > > any fundamental changes on the OP-TEE side. > > > > RPMB provides an authenticated, replay-protected storage area whose > > security relies on a secret authentication key. In our setup that key is > > never exposed to the kernel: OP-TEE derives it in the secure world from > > its hardware-unique key and a device identifier (dev_id) that the RPMB > > core hands down. OP-TEE's implementation targets eMMC, where dev_id is > > the 16-byte eMMC CID, and both the fixed length and the raw-CID layout > > are baked into its key derivation. > > > > Two things stand in the way of reusing that same, unmodified OP-TEE flow > > for UFS RPMB: > > > >   1. On a cold boot the very first frame sent to the RPMB well-known LU > >      comes back with a power-on UNIT ATTENTION (ASC 0x29), which the SCSI > >      core reports rather than retries. RPMB has no earlier guaranteed > >      access that could clear the condition first, so RPMB fails on every > >      power cycle. Patch 1 asks the SCSI core to retry the power-on UNIT > >      ATTENTION on the RPMB WLUN. > > > >   2. The UFS RPMB id is "-R", which is variable length > >      and longer than 16 bytes. Passing it verbatim would tie the derived > >      key to a length OP-TEE does not expect and diverge from the fixed > >      eMMC CID ABI. Patch 2 hashes it into a fixed 16-byte dev_id with > >      blake2s, keeping the key stable and unique per region while matching > >      the eMMC CID layout OP-TEE relies on. The hash algorithm and input > >      string are thus part of the key-derivation ABI and must stay stable. > > > > With both patches, UFS RPMB is functional from the first access after a > > cold boot and derives keys through the existing eMMC-style OP-TEE flow, > > (requires minimal OP-TEE changes pending on the CID proposal done here). > > > > Tested on IQ-9075 with Open Firmware [1], pending OP-TEE changes > > [1]https://ldts.github.io/qcom-buildroot > > > > Dependencies: > > > > U-boot: > > https://lore.kernel.org/u-boot/20260720085202.537019-1-jorge.ramirez@oss.qualcomm.com/T/#mc423eb4dcf8a15849077029e4f7c1913bb7d8873 > > > > OP-TEE: > > https://github.com/OP-TEE/optee_os/pull/7881 > > > > v2: > >   * ufs: rpmb: replace blake2s with blake2b so that the same support > >     can be added to u-boot (CRYPTO_LIB_BLAKE2B) > >   * added links to U-boot and OP-TEE changes.    > > > > v1: > >   * ufs: rpmb: retry power-on UNIT ATTENTION on the RPMB WLUN: > >      - fix using uses SCMD_FAILURE_ASC_ANY to retry any Unit Attention > >      - fix unused variable > >   * ufs: rpmb: use a fixed-length RPMB dev_id > >      - fix selecting a non-existent Kconfig symbol > > > > Jorge Ramirez-Ortiz (2): > >   ufs: rpmb: retry power-on UNIT ATTENTION on the RPMB WLUN > >   ufs: rpmb: use a fixed-length RPMB dev_id > > > >  drivers/ufs/core/ufs-rpmb.c | 39 ++++++++++++++++++++++++++++++++++--- > >  1 file changed, 36 insertions(+), 3 deletions(-) > > >