1 /*
2  * Copyright (c) 2023, 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 #include <rse_crypto_defs.h>
15 
16 #define RSE_PLATFORM_API_ID_NV_READ       (1010)
17 #define RSE_PLATFORM_API_ID_NV_INCREMENT  (1011)
18 
19 /*
20  * Increments the given non-volatile (NV) counter by one
21  *
22  * counter_id	NV counter ID.
23  *
24  * PSA_SUCCESS if the value is read correctly. Otherwise,
25  *	it returns a PSA_ERROR.
26  */
27 psa_status_t
28 rse_platform_nv_counter_increment(uint32_t counter_id);
29 
30 /*
31  * Reads the given non-volatile (NV) counter
32  *
33  * counter_id	NV counter ID.
34  * size		Size of the buffer to store NV counter value
35  *			in bytes.
36  * val		Pointer to store the current NV counter value.
37  *
38  * PSA_SUCCESS if the value is read correctly. Otherwise,
39  *	it returns a PSA_ERROR.
40  */
41 psa_status_t
42 rse_platform_nv_counter_read(uint32_t counter_id,
43 		uint32_t size, uint8_t *val);
44 
45 /*
46  * Reads the public key or the public part of a key pair in binary format.
47  *
48  * key		Identifier of the key to export.
49  * data		Buffer where the key data is to be written.
50  * data_size	Size of the data buffer in bytes.
51  * data_length	On success, the number of bytes that make up the key data.
52  *
53  * PSA_SUCCESS if the value is read correctly. Otherwise,
54  *	it returns a PSA_ERROR.
55  */
56 psa_status_t
57 rse_platform_key_read(enum rse_key_id_builtin_t key, uint8_t *data,
58 		size_t data_size, size_t *data_length);
59 
60 #endif /* RSE_PLATFORM_API_H */
61