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