tc_trng.c 855 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2017-2024, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arm_acle.h>
  7. #include <assert.h>
  8. #include <stdbool.h>
  9. #include <stdint.h>
  10. #include <string.h>
  11. #include <lib/mmio.h>
  12. #include <lib/smccc.h>
  13. #include <lib/utils_def.h>
  14. #include <plat/common/platform.h>
  15. #include <platform_def.h>
  16. #include <services/trng_svc.h>
  17. #include <smccc_helpers.h>
  18. DEFINE_SVC_UUID2(_plat_trng_uuid,
  19. 0x23523c58, 0x7448, 0x4083, 0x9d, 0x16,
  20. 0xe3, 0xfa, 0xb9, 0xf1, 0x73, 0xbc
  21. );
  22. uuid_t plat_trng_uuid;
  23. /* Dummy implementation */
  24. bool plat_get_entropy(uint64_t *out)
  25. {
  26. *out = 0xABBAEDDAACDCDEAD;
  27. return true;
  28. }
  29. void plat_entropy_setup(void)
  30. {
  31. uint64_t dummy;
  32. plat_trng_uuid = _plat_trng_uuid;
  33. /* Initialise the entropy source and trigger RNG generation */
  34. plat_get_entropy(&dummy);
  35. }