priblob.c 940 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2018 NXP
  4. */
  5. /*
  6. * Boot command to get and set the PRIBLOB bitfield form the SCFGR register
  7. * of the CAAM IP. It is recommended to set this bitfield to 3 once your
  8. * encrypted boot image is ready, to prevent the generation of blobs usable
  9. * to decrypt an encrypted boot image.
  10. */
  11. #include <asm/io.h>
  12. #include <common.h>
  13. #include <command.h>
  14. #include "../drivers/crypto/fsl_caam_internal.h"
  15. int do_priblob_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  16. {
  17. writel((readl(CAAM_SCFGR) & 0xFFFFFFFC) | 3, CAAM_SCFGR);
  18. printf("New priblob setting = 0x%x\n", readl(CAAM_SCFGR) & 0x3);
  19. return 0;
  20. }
  21. U_BOOT_CMD(
  22. set_priblob_bitfield, 1, 0, do_priblob_write,
  23. "Set the PRIBLOB bitfield to 3",
  24. "<value>\n"
  25. " - Write 3 in PRIBLOB bitfield of SCFGR regiter of CAAM IP.\n"
  26. " Prevent the generation of blobs usable to decrypt an\n"
  27. " encrypted boot image."
  28. );