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