On 25/08/2023 22:07, Eric Biggers wrote:
Hi Srinivas,
On Fri, Aug 25, 2023 at 11:19:41AM +0100, Srinivas Kandagatla wrote:
On 19/07/2023 18:04, Gaurav Kashyap wrote:
These patches add support to Qualcomm ICE (Inline Crypto Enginr) for hardware
wrapped keys using Qualcomm Hardware Key Manager (HWKM) and are made on top
of a rebased version Eric Bigger's set of changes to support wrapped keys in
fscrypt and block below:
https://git.kernel.org/pub/scm/fs/fscrypt/linux.git/log/?h=wrapped-keys-v7
(The rebased patches are not uploaded here)
Ref v1 here:
https://lore.kernel.org/linux-scsi/20211206225725.77512-1-quic_gaurkash@xxxxxxxxxxx/
Explanation and use of hardware-wrapped-keys can be found here:
Documentation/block/inline-encryption.rst
This patch is organized as follows:
Patch 1 - Prepares ICE and storage layers (UFS and EMMC) to pass around wrapped keys.
Patch 2 - Adds a new SCM api to support deriving software secret when wrapped keys are used
Patch 3-4 - Adds support for wrapped keys in the ICE driver. This includes adding HWKM support
Patch 5-6 - Adds support for wrapped keys in UFS
Patch 7-10 - Supports generate, prepare and import functionality in ICE and UFS
NOTE: MMC will have similar changes to UFS and will be uploaded in a different patchset
Patch 3, 4, 8, 10 will have MMC equivalents.
Testing:
Test platform: SM8550 MTP
Engineering trustzone image is required to test this feature only
for SM8550. For SM8650 onwards, all trustzone changes to support this
will be part of the released images.
AFAIU, Prior to these proposed changes in scm, HWKM was done with help of
TA(Trusted Application) for generate, import, unwrap ... functionality.
1. What is the reason for moving this from TA to new smc calls?
Is this because of missing smckinvoke support in upstream?
How scalable is this approach? Are we going to add new sec sys calls to
every interface to TA?
2. How are the older SoCs going to deal with this, given that you are
changing drivers that are common across these?
Have you tested these patches on any older platforms?
What happens if someone want to add support to wrapped keys to this
platforms in upstream, How is that going to be handled?
As I understand with this, we will endup with two possible solutions over
time in upstream.
It's true that Qualcomm based Android devices already use HW-wrapped keys on
SoCs earlier than SM8650. The problem is that the key generation, import, and
conversion were added to Android's KeyMint HAL, as a quick way to get the
feature out the door when it was needed (so to speak). Unfortunately this
There is an attempt in 2021 todo exactly same thing I guess,
https://patchwork.kernel.org/project/linux-fscrypt/cover/20211206225725.77512-1-quic_gaurkash@xxxxxxxxxxx/
If this was the right thing to do they why is the TZ firmware on SoCs
after 2021 not having support for this ?
coupled this feature unnecessarily to the Android KeyMint and the corresponding
(closed source) userspace HAL provided by Qualcomm, which it's not actually
So how does Andriod kernel upgrades work after applying this patchset on
platforms like SM8550 or SM8450 or SM8250..or any old platforms.
related to. I'd guess that Qualcomm's closed source userspace HAL makes SMC
calls into Qualcomm's KeyMint TA, but I have no insight into those details.
If we have an smcinvoke tee driver we can talk to to this TA.
The new SMC calls eliminate the dependency on the Android-specific KeyMint.
I can see that.
Am not against adding this new interface, but is this new interface
leaving a gap for older platforms?
Is there any other technical reason for moving out from TA based to a
smc calls?
And are we doing a quick solution here to fix something
They're also being documented by Qualcomm. So, as this patchset does, they can
be used by Linux in the implementation of new ioctls which provide a vendor
independent interface to HW-wrapped key generation, import, and conversion.
I think the new approach is the only one that is viable outside the Android
context. As such, I don't think anyone has any plan to upstream support for
HW-wrapped keys for older Qualcomm SoCs that lack the new interface.
AFAIU, There are other downstream Qualcomm LE platforms that use wrapped
key support with the older interface.
What happens to them whey then upgrade the kernel?
Does TA interface still continue to work with the changes that went into
common drivers (ufs/sd)?
--srini
- Eric