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 5B716368D42 for ; Thu, 14 May 2026 09:49:11 +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=1778752152; cv=none; b=LmOW49iTMWE9NLvRklOlTc+HN56O6HWdHNQhA1iO6NgXy4EsZm1FmklOTX6aZgtpgWXES+vH3rR5OfQtEfv7CwkUG87hh0isZjNk94LJ8ZZhrW/BisFCcvezZ7bgDkz5Hq2ClErnIC0JSB8/GWOP5HYSqn3Uufz88NtuXT1Qpkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778752152; c=relaxed/simple; bh=EJKnSIWDG+qBawg0tN7J/4Nqxp43amjV5mssW2TQf+A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KNuos5yazmCzcRHE2P9QjCv8er63vfYHT23DItoG2tF30mf9NNo01xQiGnYm5NBWOKM8LXphTkQEAgasSb19b/1P3zwMkTq+kRtoT0UUM/guS/snVmdcMYKsrcOKLRPEyvsy188v2m8PaoX/axDp3BZHMKOHT0SD983L3JMhG7Y= 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=If7+FY2x; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=XgXSn1l5; 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="If7+FY2x"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="XgXSn1l5" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64E9kK9q3641022 for ; Thu, 14 May 2026 09:49:10 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= AVEiYz6tRQCmm/rjKinjP6TxKA1LuBsqtI9ukPY1hc0=; b=If7+FY2xTBwODo+v Dyq2A2RX7jopiaVhpTyrboHlBKS4oaKeqsLaZ6IkFXDHRbcl/InJoWbovBq4SSaW vGf9AfLU2QubYqYiLz23+SxaXFovqL3oxGd5jqqC36twqLcTfENhVLGAfkTLvH3L 3LCiTUlvzULdOR7CMR/ojtWYI5q8H2qeIoLVwEWoqYfijiZHAKl2hUH/bkAD1PHb K/ddKUi9X8oPCLXtFcmdk6byA0NWll+qFIaesJ8yenkGJLzP2rlgTLKQyLIfyxYG 3fJ4R04qLxlh6p55MqhNWWKYmU29xxxj3Nwgvq1aM6+sK+ZCyebfMbG7v/lyaBEr 22DSmQ== Received: from mail-dl1-f72.google.com (mail-dl1-f72.google.com [74.125.82.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e4v4tufmd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 14 May 2026 09:49:10 +0000 (GMT) Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-134a9388abfso1137560c88.0 for ; Thu, 14 May 2026 02:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778752150; x=1779356950; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=AVEiYz6tRQCmm/rjKinjP6TxKA1LuBsqtI9ukPY1hc0=; b=XgXSn1l5F0BVWFyeP2ixJhfnnyp9xPF92p9vgU1sFx9BJbGVBe5m645ruMC1cSPkj5 8Y4MxIt1dauGT8xoqttisljbbXZa1TChTf1MdDbk7mRrVU9pioWiSSQEg6CFiQo+yDrT UC88wlkdFIHi/xG5CApnpsZQwdqSvdtPncmx/7kqbr4WXNks55d+4jD1xI/0D3eUSqZB Nf8pK2HRyRJ4zWf1Z8QQ2iB1Oozc0JjphJEpIF1jnW/adL/D9hlOuojF0ebMBOPDVjtT DljERS7acmUfHY8SLN1sHt1Ulicn4csUFwGMIYKTvvUlXkzs1iP/6JRmnAYtGg/MZmt2 WHrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778752150; x=1779356950; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AVEiYz6tRQCmm/rjKinjP6TxKA1LuBsqtI9ukPY1hc0=; b=n1eM+h9FFAhf+CkhLoLVtI+r69msHtd0S/dNML5BoJcJ5g4qVm81UbJ6RoMQBhm9Zm 1Kf3kuwehSUWGaSxkZuSCkSd2GILnbtagkJFWUu2yoQID9XSREfqLRklnrcaBVhlR0mz HSAvsy4ZuhY+m+apeU7udTHkwgQDy7LkhwhcS77zgbGOwNTCM8A1Y+Jw3BD97hRujCHF TB6TiLI5+bpbq3x/2qEoio0Oh+rPV56fl55RV+5FK1w0xhFaOdQGO3SCYOUCrp+9I1YZ SX3t3E0PymmVOULRF+Hmpa1apc8sIgkUbp6GfT4TeyGCSNZhglI42xkgyNFc+zPoGyjR 58YQ== X-Forwarded-Encrypted: i=1; AFNElJ+CsKj2eNj/xlK4acFARW2WM1swkqSqo3Cs+mP9gBoIiAWUHaGugN8ij+Z2dqqG8ssyVNfOAmC+fhFhRtw=@vger.kernel.org X-Gm-Message-State: AOJu0YwOtdqSSlyks9swF6gg5JNe1q1zjbHpO5QqKy1FutNtWSHYQB4R QRErbRvbnskLzgUVVYaY6o9vEHw0hDCTxBfKKKhiEY7tvSThs5OImMXPb41DY0Isw1YofaZn4RQ ynSRx7f72bj2fTIjroG2E9PVGTAkZS2s3A+VFGT3gnuNmuHFhPALd4gSHstYB5GZGA00= X-Gm-Gg: Acq92OHFOaTTN8DTsJ+p1r8k7otSMOX/H7cRNyd4GZoagiao4HHnJuaZd1ZpRpJwcfx MNJTztqFHDcqY9cYnjq4pRMiMA/6vVgCkmHcxFE3j9rj1Vzq5hXLCiBydCLJ5iusO/wME5sTkCz GNZV+mWxXORseMjw1CNq14SUDgJJ47yG5P1GQAP5++b0P2jw5skAec8pqGiOfa3REPmr+MYEwoH 2tmzXhWi3gcYlrPndSeDM+tzPHQ0g/NoNlgzX3DrsWCY1VJuSDQWzpYrZTszTddqnr2gye4d74e XdLgoHgpir8vVI9mtpOH5xIryKve9XiO1iowCr02xeg1FIJfB0M/luj8+hBq3uuam8wruBqqHKW xPYrvwRFRC1JIEMvJHpjN4BHuwFo6i7syETWZN3j8qC4140/qrcK9gBIV40zGtpcrhgy9yNskd2 OlkFQ= X-Received: by 2002:a05:7022:624:b0:11a:fb0a:ceca with SMTP id a92af1059eb24-134c8c3e3a2mr1862931c88.16.1778752149682; Thu, 14 May 2026 02:49:09 -0700 (PDT) X-Received: by 2002:a05:7022:624:b0:11a:fb0a:ceca with SMTP id a92af1059eb24-134c8c3e3a2mr1862911c88.16.1778752149047; Thu, 14 May 2026 02:49:09 -0700 (PDT) Received: from [10.110.104.67] (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-134cbcb9ed3sm3573723c88.1.2026.05.14.02.49.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 May 2026 02:49:08 -0700 (PDT) Message-ID: Date: Thu, 14 May 2026 17:48:44 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/1] dm-inlinecrypt: initialize blk-crypto key as HW-wrapped key To: Eric Biggers Cc: Mikulas Patocka , Alasdair Kergon , Mike Snitzer , Benjamin Marzinski , dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, Neeraj Soni References: <20260512095203.3688708-1-linlin.zhang@oss.qualcomm.com> <20260512095203.3688708-2-linlin.zhang@oss.qualcomm.com> <20260512185335.GA3085076@google.com> <20260513172204.GB2128@quark> Content-Language: en-US From: Linlin Zhang In-Reply-To: <20260513172204.GB2128@quark> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=XIIAjwhE c=1 sm=1 tr=0 ts=6a059a96 cx=c_pps a=bS7HVuBVfinNPG3f6cIo3Q==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=89lHFPsNZDq2Qp6-QJ8A:9 a=QEXdDO2ut3YA:10 a=vBUdepa8ALXHeOFLBtFW:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTE0MDA5NyBTYWx0ZWRfXyJLY9xqvk8DN ZrCLo6fmysWlpMWhdhbXjIaxFMjXWlhg2O3FtZgLKbVBXGKXzg0tkdXVD9M6Wccy0KiJN+okhMQ 703kHQuGXXzIH1cEOzDj3yOYyc6SyIbMk2G8wFQXr6Z3xXh6mUiwSngQZyf076kfpk+vrT+6n23 Z6fJF9nO72wScZaOeJ9hVc4xC8R5IkhkT4EaTy4KN6LYMe8pNdK7wwZxO+H0KfGULKUqhCro3fD jU0LmALTqeUEBSTlh0DLabbsgYOjKATOjyiG8X8oTMTgWscUN5MLEPpX/mq1Voo6XLmCo9u5pby xqgDJKIF/v85f1UX81uzsPea2foK0KjNOGd6dzE5zS9gJqqBy8IfyEINaPZabz/v0U1cu7iX168 TIYuWOvxlmTAgcpSRFfVsy4LZQsZw1lzpXDftV722LKlooKgam2MF+u4kN0wUUqAVaRRyrzoiJ0 uPv4U5i4M+1pbanoUFA== X-Proofpoint-ORIG-GUID: nec5yIAe6eTC5sRnumbOCv5_WTHJRwu9 X-Proofpoint-GUID: nec5yIAe6eTC5sRnumbOCv5_WTHJRwu9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-14_02,2026-05-13_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 bulkscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605050000 definitions=main-2605140097 On 5/14/2026 1:22 AM, Eric Biggers wrote: > On Tue, May 12, 2026 at 06:53:35PM +0000, Eric Biggers wrote: >> On Tue, May 12, 2026 at 02:52:03AM -0700, Linlin Zhang wrote: >>> dm-inlinecrypt currently initializes the blk-crypto key using >>> BLK_CRYPTO_KEY_TYPE_RAW, which implies that the provided key material >>> is a plaintext software key owned by the block layer. >>> >>> However, on platforms where dm-inlinecrypt is used together with a >>> hardware-backed key source (e.g. TrustZone/TEE or other secure key >>> wrapping mechanisms), the key material passed down is already wrapped >>> and must be treated as opaque by the block layer. >>> >>> Initialize the blk-crypto key using BLK_CRYPTO_KEY_TYPE_HW_WRAPPED >>> instead, so that dm-inlinecrypt correctly models hardware-wrapped keys >>> and avoids incorrect assumptions about key ownership and visibility. >>> >>> Signed-off-by: Linlin Zhang >>> --- >>> drivers/md/dm-inlinecrypt.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/md/dm-inlinecrypt.c b/drivers/md/dm-inlinecrypt.c >>> index bd8e58a028c5..bcbf363c533a 100644 >>> --- a/drivers/md/dm-inlinecrypt.c >>> +++ b/drivers/md/dm-inlinecrypt.c >>> @@ -386,7 +386,7 @@ static int inlinecrypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) >>> dun_bytes = DIV_ROUND_UP(fls64(ctx->max_dun), 8); >>> >>> err = blk_crypto_init_key(&ctx->key, raw_key, ctx->key_size, >>> - BLK_CRYPTO_KEY_TYPE_RAW, >>> + BLK_CRYPTO_KEY_TYPE_HW_WRAPPED, >>> cipher->mode_num, dun_bytes, >>> ctx->sector_size); >> >> The raw key support is useful too, and it should be the default. >> I recommend adding a "wrappedkey" optional argument that enables >> BLK_CRYPTO_KEY_TYPE_HW_WRAPPED. > > This patch also makes the variable called "raw_key" contain a key that > isn't a raw key, which is confusing. "key_bytes" would make more sense > for a byte array that can contain either type of key. See e.g. > blk_crypto_init_key() which uses that naming convention. Thanks for your comment! ACK. Previously BLK_CRYPTO_KEY_TYPE_HW_WRAPPED was set for blk-crypto-profile entity by default, a raw key won't never passed down to ICE driver, so I replaced raw key type with wrapped key type directly. Now I see it already changed to query the supported type from ice. There isn't above concern. I'll update a new patch with both wrappedkey and raw key support and adding "wrappedkey" optional argument. replace "raw_key" with "key_bytes" as well. > > - Eric