xref: /rk3399_ARM-atf/include/lib/psa/rse_platform_api.h (revision d797665ccef759852dff63bdb75898119577b524)
13857898fSTamas Ban /*
23857898fSTamas Ban  * Copyright (c) 2023, Arm Limited. All rights reserved.
33857898fSTamas Ban  *
43857898fSTamas Ban  * SPDX-License-Identifier: BSD-3-Clause
53857898fSTamas Ban  *
63857898fSTamas Ban  */
73857898fSTamas Ban 
8*d797665cSTamas Ban #ifndef RSE_PLATFORM_API_H
9*d797665cSTamas Ban #define RSE_PLATFORM_API_H
103857898fSTamas Ban 
113857898fSTamas Ban #include <stdint.h>
123857898fSTamas Ban 
133857898fSTamas Ban #include "psa/error.h"
14*d797665cSTamas Ban #include <rse_crypto_defs.h>
153857898fSTamas Ban 
16*d797665cSTamas Ban #define RSE_PLATFORM_API_ID_NV_READ       (1010)
17*d797665cSTamas Ban #define RSE_PLATFORM_API_ID_NV_INCREMENT  (1011)
183857898fSTamas Ban 
193857898fSTamas Ban /*
203857898fSTamas Ban  * Increments the given non-volatile (NV) counter by one
213857898fSTamas Ban  *
223857898fSTamas Ban  * counter_id	NV counter ID.
233857898fSTamas Ban  *
243857898fSTamas Ban  * PSA_SUCCESS if the value is read correctly. Otherwise,
253857898fSTamas Ban  *	it returns a PSA_ERROR.
263857898fSTamas Ban  */
273857898fSTamas Ban psa_status_t
28*d797665cSTamas Ban rse_platform_nv_counter_increment(uint32_t counter_id);
293857898fSTamas Ban 
303857898fSTamas Ban /*
313857898fSTamas Ban  * Reads the given non-volatile (NV) counter
323857898fSTamas Ban  *
333857898fSTamas Ban  * counter_id	NV counter ID.
343857898fSTamas Ban  * size		Size of the buffer to store NV counter value
353857898fSTamas Ban  *			in bytes.
363857898fSTamas Ban  * val		Pointer to store the current NV counter value.
373857898fSTamas Ban  *
383857898fSTamas Ban  * PSA_SUCCESS if the value is read correctly. Otherwise,
393857898fSTamas Ban  *	it returns a PSA_ERROR.
403857898fSTamas Ban  */
413857898fSTamas Ban psa_status_t
42*d797665cSTamas Ban rse_platform_nv_counter_read(uint32_t counter_id,
433857898fSTamas Ban 		uint32_t size, uint8_t *val);
443857898fSTamas Ban 
453857898fSTamas Ban /*
463857898fSTamas Ban  * Reads the public key or the public part of a key pair in binary format.
473857898fSTamas Ban  *
483857898fSTamas Ban  * key		Identifier of the key to export.
493857898fSTamas Ban  * data		Buffer where the key data is to be written.
503857898fSTamas Ban  * data_size	Size of the data buffer in bytes.
513857898fSTamas Ban  * data_length	On success, the number of bytes that make up the key data.
523857898fSTamas Ban  *
533857898fSTamas Ban  * PSA_SUCCESS if the value is read correctly. Otherwise,
543857898fSTamas Ban  *	it returns a PSA_ERROR.
553857898fSTamas Ban  */
563857898fSTamas Ban psa_status_t
57*d797665cSTamas Ban rse_platform_key_read(enum rse_key_id_builtin_t key, uint8_t *data,
583857898fSTamas Ban 		size_t data_size, size_t *data_length);
593857898fSTamas Ban 
60*d797665cSTamas Ban #endif /* RSE_PLATFORM_API_H */
61