All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Opaniuk <igor.opaniuk@foundries.io>
To: u-boot@lists.denx.de
Subject: [PATCHv5 2/6] cmd: SCP03: enable and provision command
Date: Mon, 15 Feb 2021 15:14:38 +0200	[thread overview]
Message-ID: <CAL6CDME_r7e1k0POqz7yDBwM02JaqpwDKqpkKOdESDzWM8kmjQ@mail.gmail.com> (raw)
In-Reply-To: <20210214152728.8628-3-jorge@foundries.io>

On Sun, Feb 14, 2021 at 5:27 PM Jorge Ramirez-Ortiz <jorge@foundries.io> wrote:
>
> Enable and provision the SCP03 keys on a TEE controlled secured elemt
> from the U-Boot shell.
>
> Executing this command will generate and program new SCP03 encryption
> keys on the secure element NVM.
>
> Depending on the TEE implementation, the keys would then be stored in
> some persistent storage or better derived from some platform secret
> (so they can't be lost).
>
> Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>  cmd/Kconfig  |  8 ++++++++
>  cmd/Makefile |  3 +++
>  cmd/scp03.c  | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 63 insertions(+)
>  create mode 100644 cmd/scp03.c
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 928a2a0a2d..6327374f2c 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -2021,6 +2021,14 @@ config HASH_VERIFY
>         help
>           Add -v option to verify data against a hash.
>
> +config CMD_SCP03
> +       bool "scp03 - SCP03 enable and rotate/provision operations"
> +       depends on SCP03
> +       help
> +         This command provides access to a Trusted Application
> +         running in a TEE to request Secure Channel Protocol 03
> +         (SCP03) enablement and/or rotation of its SCP03 keys.
> +
>  config CMD_TPM_V1
>         bool
>
> diff --git a/cmd/Makefile b/cmd/Makefile
> index 176bf925fd..a7017e8452 100644
> --- a/cmd/Makefile
> +++ b/cmd/Makefile
> @@ -193,6 +193,9 @@ obj-$(CONFIG_CMD_BLOB) += blob.o
>  # Android Verified Boot 2.0
>  obj-$(CONFIG_CMD_AVB) += avb.o
>
> +# Foundries.IO SCP03
> +obj-$(CONFIG_CMD_SCP03) += scp03.o
> +
>  obj-$(CONFIG_ARM) += arm/
>  obj-$(CONFIG_RISCV) += riscv/
>  obj-$(CONFIG_SANDBOX) += sandbox/
> diff --git a/cmd/scp03.c b/cmd/scp03.c
> new file mode 100644
> index 0000000000..655e0bba08
> --- /dev/null
> +++ b/cmd/scp03.c
> @@ -0,0 +1,52 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * (C) Copyright 2021, Foundries.IO
> + *
> + */
> +
> +#include <common.h>
> +#include <command.h>
> +#include <env.h>
> +#include <scp03.h>
> +
> +int do_scp03_enable(struct cmd_tbl *cmdtp, int flag, int argc,
> +                   char *const argv[])
> +{
> +       if (argc != 1)
> +               return CMD_RET_USAGE;
> +
> +       if (tee_enable_scp03()) {
> +               printf("TEE failed to enable SCP03\n");
> +               return CMD_RET_FAILURE;
> +       }
> +
> +       printf("SCP03 is enabled\n");
> +
> +       return CMD_RET_SUCCESS;
> +}
> +
> +int do_scp03_provision(struct cmd_tbl *cmdtp, int flag, int argc,
> +                      char *const argv[])
> +{
> +       if (argc != 1)
> +               return CMD_RET_USAGE;
> +
> +       if (tee_provision_scp03()) {
> +               printf("TEE failed to provision SCP03 keys\n");
> +               return CMD_RET_FAILURE;
> +       }
> +
> +       printf("SCP03 is provisioned\n");
> +
> +       return CMD_RET_SUCCESS;
> +}
> +
> +static char text[] =
> +       "provides a command to enable SCP03 and provision the SCP03 keys\n"
> +       " enable    - enable SCP03 on the TEE\n"
> +       " provision - provision SCP03 on the TEE\n";
> +
> +U_BOOT_CMD_WITH_SUBCMDS(scp03, "Secure Channel Protocol 03 control", text,
> +       U_BOOT_SUBCMD_MKENT(enable, 1, 1, do_scp03_enable),
> +       U_BOOT_SUBCMD_MKENT(provision, 1, 1, do_scp03_provision));
> +
> --
> 2.30.0
>

Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>

-- 
Best regards - Freundliche Gr?sse - Meilleures salutations

Igor Opaniuk
Embedded Software Engineer
T:  +380 938364067
E: igor.opaniuk at foundries.io
W: www.foundries.io

  reply	other threads:[~2021-02-15 13:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-14 15:27 [PATCHv5 0/6] SCP03 control, documentation and tests Jorge Ramirez-Ortiz
2021-02-14 15:27 ` [PATCHv5 1/6] common: SCP03 control (enable and provision of keys) Jorge Ramirez-Ortiz
2021-03-15 15:52   ` Tom Rini
2021-02-14 15:27 ` [PATCHv5 2/6] cmd: SCP03: enable and provision command Jorge Ramirez-Ortiz
2021-02-15 13:14   ` Igor Opaniuk [this message]
2021-03-15 15:52   ` Tom Rini
2021-02-14 15:27 ` [PATCHv5 3/6] drivers: tee: sandbox: SCP03 control emulator Jorge Ramirez-Ortiz
2021-03-15 15:53   ` Tom Rini
2021-02-14 15:27 ` [PATCHv5 4/6] doc: describe the scp03 command Jorge Ramirez-Ortiz
2021-03-15 15:53   ` Tom Rini
2021-02-14 15:27 ` [PATCHv5 5/6] sandbox: imply SCP03 and CMD_SCP03 Jorge Ramirez-Ortiz
2021-03-15 15:53   ` Tom Rini
2021-02-14 15:27 ` [PATCHv5 6/6] test: py: add initial coverage for scp03 cmd Jorge Ramirez-Ortiz
2021-03-15 15:53   ` Tom Rini
2021-03-10 16:59 ` [PATCHv5 0/6] SCP03 control, documentation and tests Jorge
2021-03-12  4:45   ` Simon Glass
2021-03-12  8:28     ` Jorge
2021-03-12 13:26       ` Tom Rini
2021-03-12 13:31         ` Jorge
  -- strict thread matches above, loose matches on Subject: below --
2021-02-14 15:18 [PATCHv5 2/6] cmd: SCP03: enable and provision command Jorge Ramirez-Ortiz
2021-02-15 13:13 ` Igor Opaniuk
2021-02-09 20:10 [PATCHv5 1/6] common: SCP03 control (enable and provision of keys) Jorge Ramirez-Ortiz
2021-02-09 20:10 ` [PATCHv5 2/6] cmd: SCP03: enable and provision command Jorge Ramirez-Ortiz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL6CDME_r7e1k0POqz7yDBwM02JaqpwDKqpkKOdESDzWM8kmjQ@mail.gmail.com \
    --to=igor.opaniuk@foundries.io \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.