scp03.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2021, Foundries.IO
  4. *
  5. */
  6. #include <common.h>
  7. #include <command.h>
  8. #include <env.h>
  9. #include <scp03.h>
  10. int do_scp03_enable(struct cmd_tbl *cmdtp, int flag, int argc,
  11. char *const argv[])
  12. {
  13. if (argc != 1)
  14. return CMD_RET_USAGE;
  15. if (tee_enable_scp03()) {
  16. printf("TEE failed to enable SCP03\n");
  17. return CMD_RET_FAILURE;
  18. }
  19. printf("SCP03 is enabled\n");
  20. return CMD_RET_SUCCESS;
  21. }
  22. int do_scp03_provision(struct cmd_tbl *cmdtp, int flag, int argc,
  23. char *const argv[])
  24. {
  25. if (argc != 1)
  26. return CMD_RET_USAGE;
  27. if (tee_provision_scp03()) {
  28. printf("TEE failed to provision SCP03 keys\n");
  29. return CMD_RET_FAILURE;
  30. }
  31. printf("SCP03 is provisioned\n");
  32. return CMD_RET_SUCCESS;
  33. }
  34. static char text[] =
  35. "provides a command to enable SCP03 and provision the SCP03 keys\n"
  36. " enable - enable SCP03 on the TEE\n"
  37. " provision - provision SCP03 on the TEE\n";
  38. U_BOOT_CMD_WITH_SUBCMDS(scp03, "Secure Channel Protocol 03 control", text,
  39. U_BOOT_SUBCMD_MKENT(enable, 1, 1, do_scp03_enable),
  40. U_BOOT_SUBCMD_MKENT(provision, 1, 1, do_scp03_provision));