[PATCH v2 2/2] tee: optee: support session login as REE kernel

Jens Wiklander jens.wiklander at linaro.org
Thu May 20 16:56:30 CEST 2021


On Wed, May 19, 2021 at 4:27 PM Etienne Carriere
<etienne.carriere at linaro.org> wrote:
>
> Remove unused OPTEE_MSG_LOGIN_* IDs and rely on the ones introduced in
> tee.h. Change optee core to treat invalid client IDs as public login.
>
> Signed-off-by: Etienne Carriere <etienne.carriere at linaro.org>
> ---
> Changes since v1:
> - Remove ID conversion. I kept the sanitation of login ID for optee.
> ---
>  drivers/tee/optee/core.c      | 19 ++++++++++++++++++-
>  drivers/tee/optee/optee_msg.h | 10 ----------
>  2 files changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index 73dbb22ba0..14f9cce5f8 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -349,6 +349,23 @@ static int optee_close_session(struct udevice *dev, u32 session)
>         return 0;
>  }
>
> +static u32 optee_login_id(u32 login_id)
> +{
> +       /* Treat invalid IDs as public login */
> +       switch (login_id) {
> +       case TEE_LOGIN_USER:
> +       case TEE_LOGIN_GROUP:
> +       case TEE_LOGIN_APPLICATION:
> +       case TEE_LOGIN_APPLICATION_USER:
> +       case TEE_LOGIN_APPLICATION_GROUP:
> +       case TEE_LOGIN_REE_KERNEL:
> +               return login_id;
> +       case TEE_LOGIN_PUBLIC:
> +       default:
> +               return TEE_LOGIN_PUBLIC;
> +       }
> +}
> +

What is the point with translating an unrecognized value into TEE_LOGIN_PUBLIC?
We could just as well let OP-TEE decide what to do with that.

Cheers,
Jens


More information about the U-Boot mailing list