OP-TEE use export_uuid() to copy UUID

-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmCjhswaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJfM7Q//f4hdxcAb+iLiFwJVj7IL
 0kJ5MUj+4NyxdzxWBsqHE80Vf0MxumAaxLLKLl1SrV1os3nKUQENG7+XAdC/5ozT
 m3Qcw0qTQRQ3eC3wMDM150fmnpadTkeOmwReQrsHBdczP+fuWbw9q+JN9dN3t2y8
 kaym43DtGoIbUfmyqmac5YbO80mE0QAq73wcqYqRcNQk56fS2nsPFEUTqDA9iQTp
 lAVtMoYC65SdHFHsxMe46TMme0vnG99sN2MMLwNDfJdYjQI1Dzn3NRqgVMEmGvNP
 ZShtvePSoaF/GS3axzlE2dxJcHPyC7bLSoTYS4s0FjWQ8AcJMqQrL2YeCJieny4Y
 2SILHN+25xDVyAimW8dQQNJBnDP/zJlnL6FBv6b7I1rynQYy733NbZ8TedHlHptF
 WEV47IyYVvaQs18wg24MD4wjtVDzK8s/r+frpBOrTiRr/AYJqqu8JtKYJHKNRpqZ
 EGN9o54fe4Yo97fkcyqQkE/vYdsRhJfz29gPEMaITSwOEu11xIiM2ia7KyARWbjo
 wJzZJY4AH2Gs0LeoEfMwTyKCH4KGvziBVzd/Dbc8ri1mzpgoRuDN1IkMcbBoZghQ
 1xjlRwZKk4yMKO5Sj4jOd6bp03qpFL+9lD0MKSD70Z86DN8Ods0G2QwgdhdHBe9o
 7gQE8NyvTmHWZ93aS1Fer1k=
 =1uWY
 -----END PGP SIGNATURE-----

Merge tag 'optee-fix-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee into arm/fixes

OP-TEE use export_uuid() to copy UUID

* tag 'optee-fix-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee:
  optee: use export_uuid() to copy client UUID

Link: https://lore.kernel.org/r/20210518100712.GA449561@jade
Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
Olof Johansson 2021-06-05 15:43:10 -07:00
commit 7468bed8f8
2 changed files with 8 additions and 4 deletions

View File

@ -220,6 +220,7 @@ int optee_open_session(struct tee_context *ctx,
struct optee_msg_arg *msg_arg; struct optee_msg_arg *msg_arg;
phys_addr_t msg_parg; phys_addr_t msg_parg;
struct optee_session *sess = NULL; struct optee_session *sess = NULL;
uuid_t client_uuid;
/* +2 for the meta parameters added below */ /* +2 for the meta parameters added below */
shm = get_msg_arg(ctx, arg->num_params + 2, &msg_arg, &msg_parg); shm = get_msg_arg(ctx, arg->num_params + 2, &msg_arg, &msg_parg);
@ -240,10 +241,11 @@ int optee_open_session(struct tee_context *ctx,
memcpy(&msg_arg->params[0].u.value, arg->uuid, sizeof(arg->uuid)); memcpy(&msg_arg->params[0].u.value, arg->uuid, sizeof(arg->uuid));
msg_arg->params[1].u.value.c = arg->clnt_login; msg_arg->params[1].u.value.c = arg->clnt_login;
rc = tee_session_calc_client_uuid((uuid_t *)&msg_arg->params[1].u.value, rc = tee_session_calc_client_uuid(&client_uuid, arg->clnt_login,
arg->clnt_login, arg->clnt_uuid); arg->clnt_uuid);
if (rc) if (rc)
goto out; goto out;
export_uuid(msg_arg->params[1].u.octets, &client_uuid);
rc = optee_to_msg_param(msg_arg->params + 2, arg->num_params, param); rc = optee_to_msg_param(msg_arg->params + 2, arg->num_params, param);
if (rc) if (rc)

View File

@ -9,7 +9,7 @@
#include <linux/types.h> #include <linux/types.h>
/* /*
* This file defines the OP-TEE message protocol used to communicate * This file defines the OP-TEE message protocol (ABI) used to communicate
* with an instance of OP-TEE running in secure world. * with an instance of OP-TEE running in secure world.
* *
* This file is divided into two sections. * This file is divided into two sections.
@ -144,9 +144,10 @@ struct optee_msg_param_value {
* @tmem: parameter by temporary memory reference * @tmem: parameter by temporary memory reference
* @rmem: parameter by registered memory reference * @rmem: parameter by registered memory reference
* @value: parameter by opaque value * @value: parameter by opaque value
* @octets: parameter by octet string
* *
* @attr & OPTEE_MSG_ATTR_TYPE_MASK indicates if tmem, rmem or value is used in * @attr & OPTEE_MSG_ATTR_TYPE_MASK indicates if tmem, rmem or value is used in
* the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value, * the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value or octets,
* OPTEE_MSG_ATTR_TYPE_TMEM_* indicates @tmem and * OPTEE_MSG_ATTR_TYPE_TMEM_* indicates @tmem and
* OPTEE_MSG_ATTR_TYPE_RMEM_* indicates @rmem, * OPTEE_MSG_ATTR_TYPE_RMEM_* indicates @rmem,
* OPTEE_MSG_ATTR_TYPE_NONE indicates that none of the members are used. * OPTEE_MSG_ATTR_TYPE_NONE indicates that none of the members are used.
@ -157,6 +158,7 @@ struct optee_msg_param {
struct optee_msg_param_tmem tmem; struct optee_msg_param_tmem tmem;
struct optee_msg_param_rmem rmem; struct optee_msg_param_rmem rmem;
struct optee_msg_param_value value; struct optee_msg_param_value value;
u8 octets[24];
} u; } u;
}; };