Skip to contentSkip to conversation

KEYS: trusted: tee: Make registered shm dependency explicit

PATCH Applied Sumit Garg 2 participants 4 messages Nov 10, 2022 – Nov 16, 2022

Subsystems (4)
lore
Share & tools
lore

Sumit Garg

author
#0 lore raw

PATCH 1/1 KEYS: trusted: tee: Make registered shm dependency explicit

TEE trusted keys support depends on registered shared memory support since the key buffers are needed to be registered with OP-TEE. So make that dependency explicit to not register trusted keys support if underlying implementation doesn't support registered shared memory.

---
 security/keys/trusted-keys/trusted_tee.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
security/keys/trusted-keys/trusted_tee.c +2 -1
index c8626686ee1b..ac3e270ade69 100644
@@ -219,7 +219,8 @@ static int trusted_tee_get_random(unsigned char *key, size_t key_len)
 
 static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
 {
-	if (ver->impl_id == TEE_IMPL_ID_OPTEE)
+	if (ver->impl_id == TEE_IMPL_ID_OPTEE &&
+	    ver->gen_caps & TEE_GEN_CAP_REG_MEM)
 		return 1;
 	else
 		return 0;
Signature · 1 line
2.34.1
author
#1 lore raw

+ Jarkko (Apologies I accidently missed you while sending the original patch).

Quoted 29 lines · Sumit Garg

TEE trusted keys support depends on registered shared memory support since the key buffers are needed to be registered with OP-TEE. So make that dependency explicit to not register trusted keys support if underlying implementation doesn't support registered shared memory.

---
 security/keys/trusted-keys/trusted_tee.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
security/keys/trusted-keys/trusted_tee.c +2 -2
index c8626686ee1b..ac3e270ade69 100644
@@ -219,7 +219,8 @@ static int trusted_tee_get_random(unsigned char *key, size_t key_len)
 
 static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
 {
-       if (ver->impl_id == TEE_IMPL_ID_OPTEE)
+       if (ver->impl_id == TEE_IMPL_ID_OPTEE &&
+           ver->gen_caps & TEE_GEN_CAP_REG_MEM)
                return 1;
        else
                return 0;
--

2.34.1

maintainer Reviewed-by
#2 lore raw
Quoted 21 lines · Sumit Garg

+ Jarkko (Apologies I accidently missed you while sending the original patch).

Quoted 18 lines · Sumit Garg

TEE trusted keys support depends on registered shared memory support since the key buffers are needed to be registered with OP-TEE. So make that dependency explicit to not register trusted keys support if underlying implementation doesn't support registered shared memory.

---
 security/keys/trusted-keys/trusted_tee.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
security/keys/trusted-keys/trusted_tee.c +0 -0
index c8626686ee1b..ac3e270ade69 100644
@@ -219,7 +219,8 @@ static int trusted_tee_get_random(unsigned char *key, size_t key_len)
 
Quoted 11 lines
Quoted 11 lines
security/keys/trusted-keys/trusted_tee.c +2 -2
 static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
 {
-       if (ver->impl_id == TEE_IMPL_ID_OPTEE)
+       if (ver->impl_id == TEE_IMPL_ID_OPTEE &&
+           ver->gen_caps & TEE_GEN_CAP_REG_MEM)
                return 1;
        else
                return 0;
--

2.34.1

BR, Jarkko

maintainer Applied
#3 lore raw
Quoted 22 lines · Jarkko Sakkinen
Quoted 21 lines · Sumit Garg

+ Jarkko (Apologies I accidently missed you while sending the original patch).

Quoted 18 lines · Sumit Garg

TEE trusted keys support depends on registered shared memory support since the key buffers are needed to be registered with OP-TEE. So make that dependency explicit to not register trusted keys support if underlying implementation doesn't support registered shared memory.

---
 security/keys/trusted-keys/trusted_tee.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
security/keys/trusted-keys/trusted_tee.c +0 -0
index c8626686ee1b..ac3e270ade69 100644
@@ -219,7 +219,8 @@ static int trusted_tee_get_random(unsigned char *key, size_t key_len)
 
Quoted 13 lines
Quoted 11 lines
Quoted 11 lines
security/keys/trusted-keys/trusted_tee.c +2 -2
 static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data)
 {
-       if (ver->impl_id == TEE_IMPL_ID_OPTEE)
+       if (ver->impl_id == TEE_IMPL_ID_OPTEE &&
+           ver->gen_caps & TEE_GEN_CAP_REG_MEM)
                return 1;
        else
                return 0;
--

2.34.1

Applied.

BR, Jarkko