Re: [PATCH v4 4/7] tee: Export uuidv5 generation for TEE backends
From: Harshal Dev
Date: Mon Oct 12 2026 - 05:49:07 EST
Hi Amir,
On 09-10-2026 06:53 am, Amirreza Zarrabi wrote:
>
>
> On 10/6/2026 10:33 PM, Harshal Dev wrote:
>> Export the uuidv5() function defined in the TEE core to all TEE backends.
>> This enables the TEE backend drivers to generate a UUID for identifying
>> and registering their secure services on the TEE bus.
>>
>> Reviewed-by: Sumit Garg <sumit.garg@xxxxxxxxxxxxxxxx>
>> Signed-off-by: Harshal Dev <harshal.dev@xxxxxxxxxxxxxxxx>
>> ---
>> drivers/tee/tee_core.c | 9 +++++----
>> include/linux/tee_core.h | 15 +++++++++++++++
>> 2 files changed, 20 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
>> index a03a3d645dd1..2cfd302d1393 100644
>> --- a/drivers/tee/tee_core.c
>> +++ b/drivers/tee/tee_core.c
>> @@ -135,7 +135,7 @@ static int tee_release(struct inode *inode, struct file *filp)
>> }
>>
>> /**
>> - * uuid_v5() - Calculate UUIDv5
>> + * tee_generate_uuid_v5() - Calculate UUIDv5
>> * @uuid: Resulting UUID
>> * @ns: Name space ID for UUIDv5 function
>> * @name: Name for UUIDv5 function
>> @@ -146,8 +146,8 @@ static int tee_release(struct inode *inode, struct file *filp)
>> * This implements section (for SHA-1):
>> * 4.3. Algorithm for Creating a Name-Based UUID
>> */
>> -static void uuid_v5(uuid_t *uuid, const uuid_t *ns, const void *name,
>> - size_t size)
>> +void tee_generate_uuid_v5(uuid_t *uuid, const uuid_t *ns, const void *name,
>> + size_t size)
>> {
>> unsigned char hash[SHA1_DIGEST_SIZE];
>> struct sha1_ctx ctx;
>> @@ -163,6 +163,7 @@ static void uuid_v5(uuid_t *uuid, const uuid_t *ns, const void *name,
>> uuid->b[6] = (hash[6] & 0x0F) | 0x50;
>> uuid->b[8] = (hash[8] & 0x3F) | 0x80;
>> }
>> +EXPORT_SYMBOL_GPL(tee_generate_uuid_v5);
>>
>> int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
>> const u8 connection_data[TEE_IOCTL_UUID_LEN])
>> @@ -228,7 +229,7 @@ int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
>> goto out_free_name;
>> }
>>
>> - uuid_v5(uuid, &tee_client_uuid_ns, name, name_len);
>> + tee_generate_uuid_v5(uuid, &tee_client_uuid_ns, name, name_len);
>> out_free_name:
>> kfree(name);
>>
>> diff --git a/include/linux/tee_core.h b/include/linux/tee_core.h
>> index bcb5418d6fdc..a3f4f88b8423 100644
>> --- a/include/linux/tee_core.h
>> +++ b/include/linux/tee_core.h
>> @@ -272,6 +272,21 @@ void tee_device_set_dev_groups(struct tee_device *teedev,
>> int tee_session_calc_client_uuid(uuid_t *uuid, u32 connection_method,
>> const u8 connection_data[TEE_IOCTL_UUID_LEN]);
>>
>> +/**
>> + * tee_generate_uuid_v5() - Calculate UUIDv5
>> + * @uuid: Resulting UUID
>> + * @ns: Name space ID for UUIDv5 function
>> + * @name: Name for UUIDv5 function
>> + * @size: Size of name
>> + *
>> + * UUIDv5 is specific in RFC 4122.
>> + *
>> + * This implements section (for SHA-1):
>> + * 4.3. Algorithm for Creating a Name-Based UUID
>> + */
>
> I think the functions in the header do not need to replicate the docs from c files.
> If you want you can remove it. Otherwise,
>
I can see that the exported function tee_session_calc_client_uuid() in the
.c file only provides the docs in the header file. Perhaps I can do the same
and remove the doc from the .c file and keep it here instead of replicating
it in both files.
> Reviewed-by: Amirreza Zarrabi <amirreza.zarrabi@xxxxxxxxxxxxxxxx>
>
Hope I can keep your tag with this. :)
Regards,
Harshal
> - Amir
>
>> +void tee_generate_uuid_v5(uuid_t *uuid, const uuid_t *ns, const void *name,
>> + size_t size);
>> +
>> /**
>> * struct tee_shm_pool - shared memory pool
>> * @ops: operations
>>
>