Jorge Ramirez-Ortiz | 7d80df9 | 2021-02-14 16:27:24 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * (C) Copyright 2021, Foundries.IO |
| 4 | * |
| 5 | */ |
| 6 | |
Tom Rini | abb9a04 | 2024-05-18 20:20:43 -0600 | [diff] [blame] | 7 | #include <common.h> |
Jorge Ramirez-Ortiz | 7d80df9 | 2021-02-14 16:27:24 +0100 | [diff] [blame] | 8 | #include <command.h> |
| 9 | #include <env.h> |
| 10 | #include <scp03.h> |
| 11 | |
| 12 | int do_scp03_enable(struct cmd_tbl *cmdtp, int flag, int argc, |
| 13 | char *const argv[]) |
| 14 | { |
| 15 | if (argc != 1) |
| 16 | return CMD_RET_USAGE; |
| 17 | |
| 18 | if (tee_enable_scp03()) { |
| 19 | printf("TEE failed to enable SCP03\n"); |
| 20 | return CMD_RET_FAILURE; |
| 21 | } |
| 22 | |
| 23 | printf("SCP03 is enabled\n"); |
| 24 | |
| 25 | return CMD_RET_SUCCESS; |
| 26 | } |
| 27 | |
| 28 | int do_scp03_provision(struct cmd_tbl *cmdtp, int flag, int argc, |
| 29 | char *const argv[]) |
| 30 | { |
| 31 | if (argc != 1) |
| 32 | return CMD_RET_USAGE; |
| 33 | |
| 34 | if (tee_provision_scp03()) { |
| 35 | printf("TEE failed to provision SCP03 keys\n"); |
| 36 | return CMD_RET_FAILURE; |
| 37 | } |
| 38 | |
| 39 | printf("SCP03 is provisioned\n"); |
| 40 | |
| 41 | return CMD_RET_SUCCESS; |
| 42 | } |
| 43 | |
Tom Rini | 03f146c | 2023-10-07 15:13:08 -0400 | [diff] [blame] | 44 | U_BOOT_LONGHELP(scp03, |
Jorge Ramirez-Ortiz | 7d80df9 | 2021-02-14 16:27:24 +0100 | [diff] [blame] | 45 | "provides a command to enable SCP03 and provision the SCP03 keys\n" |
| 46 | " enable - enable SCP03 on the TEE\n" |
Tom Rini | 03f146c | 2023-10-07 15:13:08 -0400 | [diff] [blame] | 47 | " provision - provision SCP03 on the TEE\n"); |
Jorge Ramirez-Ortiz | 7d80df9 | 2021-02-14 16:27:24 +0100 | [diff] [blame] | 48 | |
Tom Rini | 03f146c | 2023-10-07 15:13:08 -0400 | [diff] [blame] | 49 | U_BOOT_CMD_WITH_SUBCMDS(scp03, "Secure Channel Protocol 03 control", |
| 50 | scp03_help_text, |
Jorge Ramirez-Ortiz | 7d80df9 | 2021-02-14 16:27:24 +0100 | [diff] [blame] | 51 | U_BOOT_SUBCMD_MKENT(enable, 1, 1, do_scp03_enable), |
| 52 | U_BOOT_SUBCMD_MKENT(provision, 1, 1, do_scp03_provision)); |