blob: 8f74a51fd4872a47d0c2d5d7aee68eafab6391dd [file] [log] [blame]
laurenw-arm4fc77a72022-08-11 15:29:56 -05001/*
2 * Copyright (c) 2023, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef RSS_PLATFORM_API_H
9#define RSS_PLATFORM_API_H
10
11#include <stdint.h>
12
13#include "psa/error.h"
laurenw-arm6c4d0412023-06-13 16:40:51 -050014#include <rss_crypto_defs.h>
laurenw-arm4fc77a72022-08-11 15:29:56 -050015
16#define RSS_PLATFORM_API_ID_NV_READ (1010)
17#define RSS_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 */
27psa_status_t
28rss_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 */
41psa_status_t
42rss_platform_nv_counter_read(uint32_t counter_id,
43 uint32_t size, uint8_t *val);
44
laurenw-arm6c4d0412023-06-13 16:40:51 -050045/*
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 */
56psa_status_t
57rss_platform_key_read(enum rss_key_id_builtin_t key, uint8_t *data,
58 size_t data_size, size_t *data_length);
59
laurenw-arm4fc77a72022-08-11 15:29:56 -050060#endif /* RSS_PLATFORM_API_H */