vab.c 703 B

12345678910111213141516171819202122232425262728293031323334
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2020 Intel Corporation <www.intel.com>
  4. *
  5. */
  6. #include <asm/arch/secure_vab.h>
  7. #include <command.h>
  8. #include <common.h>
  9. #include <linux/ctype.h>
  10. static int do_vab(struct cmd_tbl *cmdtp, int flag, int argc,
  11. char *const argv[])
  12. {
  13. unsigned long addr, len;
  14. if (argc < 3)
  15. return CMD_RET_USAGE;
  16. addr = hextoul(argv[1], NULL);
  17. len = hextoul(argv[2], NULL);
  18. if (socfpga_vendor_authentication((void *)&addr, (size_t *)&len) != 0)
  19. return CMD_RET_FAILURE;
  20. return 0;
  21. }
  22. U_BOOT_CMD(
  23. vab, 3, 2, do_vab,
  24. "perform vendor authorization",
  25. "addr len - authorize 'len' bytes starting at\n"
  26. " 'addr' via vendor public key"
  27. );