morello_trusted_boot.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2021, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <stdint.h>
  7. #include <plat/arm/common/plat_arm.h>
  8. /*
  9. * Return the non-volatile counter value stored in the platform. The cookie
  10. * will contain the OID of the counter in the certificate.
  11. *
  12. * Return: 0 = success, Otherwise = error
  13. */
  14. int plat_get_nv_ctr(void *cookie, unsigned int *nv_ctr)
  15. {
  16. *nv_ctr = MORELLO_FW_NVCTR_VAL;
  17. return 0;
  18. }
  19. /*
  20. * Store a new non-volatile counter value. By default on ARM development
  21. * platforms, the non-volatile counters are RO and cannot be modified. We expect
  22. * the values in the certificates to always match the RO values so that this
  23. * function is never called.
  24. *
  25. * Return: 0 = success, Otherwise = error
  26. */
  27. int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr)
  28. {
  29. return 1;
  30. }
  31. /*
  32. * Return the ROTPK hash in the following ASN.1 structure in DER format:
  33. *
  34. * AlgorithmIdentifier ::= SEQUENCE {
  35. * algorithm OBJECT IDENTIFIER,
  36. * parameters ANY DEFINED BY algorithm OPTIONAL
  37. * }
  38. *
  39. * DigestInfo ::= SEQUENCE {
  40. * digestAlgorithm AlgorithmIdentifier,
  41. * digest OCTET STRING
  42. * }
  43. */
  44. int plat_get_rotpk_info(void *cookie, void **key_ptr, unsigned int *key_len,
  45. unsigned int *flags)
  46. {
  47. return arm_get_rotpk_info(cookie, key_ptr, key_len, flags);
  48. }