1 /* 2 * Copyright (c) 2023-2025, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #ifndef RSE_PLATFORM_API_H 9 #define RSE_PLATFORM_API_H 10 11 #include <stdint.h> 12 13 #include "psa/error.h" 14 #if CRYPTO_SUPPORT 15 #include <rse_crypto_defs.h> 16 #endif 17 18 #define RSE_PLATFORM_API_ID_NV_READ (1010) 19 #define RSE_PLATFORM_API_ID_NV_INCREMENT (1011) 20 21 /* 22 * Increments the given non-volatile (NV) counter by one 23 * 24 * counter_id NV counter ID. 25 * 26 * PSA_SUCCESS if the value is read correctly. Otherwise, 27 * it returns a PSA_ERROR. 28 */ 29 psa_status_t 30 rse_platform_nv_counter_increment(uint32_t counter_id); 31 32 /* 33 * Reads the given non-volatile (NV) counter 34 * 35 * counter_id NV counter ID. 36 * size Size of the buffer to store NV counter value 37 * in bytes. 38 * val Pointer to store the current NV counter value. 39 * 40 * PSA_SUCCESS if the value is read correctly. Otherwise, 41 * it returns a PSA_ERROR. 42 */ 43 psa_status_t 44 rse_platform_nv_counter_read(uint32_t counter_id, 45 uint32_t size, uint8_t *val); 46 47 #if CRYPTO_SUPPORT 48 /* 49 * Gets the entropy. 50 * 51 * data Buffer where the entropy data is to be written. 52 * data_size Size of the data buffer in bytes. 53 * 54 * PSA_SUCCESS if the entropy is generated successfully. Otherwise, 55 * it returns a PSA_ERROR. 56 */ 57 psa_status_t 58 rse_platform_get_entropy(uint8_t *data, size_t data_size); 59 #endif 60 61 #endif /* RSE_PLATFORM_API_H */ 62