blob: 79cdfa0040b678665c3f34d8b018e08fd8eeb81d [file] [log] [blame]
Tamas Banf5492752022-01-18 16:19:17 +01001/*
Tamas Banc96425b2024-02-23 10:41:05 +01002 * Copyright (c) 2022-2024, Arm Limited. All rights reserved.
Tamas Banf5492752022-01-18 16:19:17 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef PSA_MEASURED_BOOT_H
9#define PSA_MEASURED_BOOT_H
10
11#include <stdbool.h>
12#include <stddef.h>
13#include <stdint.h>
14
15#include "psa/error.h"
16
Tamas Banf5492752022-01-18 16:19:17 +010017/**
18 * Extends and stores a measurement to the requested slot.
19 *
20 * index Slot number in which measurement is to be stored
21 * signer_id Pointer to signer_id buffer.
David Vincze28572702022-11-04 18:28:12 +010022 * signer_id_size Size of the signer_id in bytes.
Tamas Banf5492752022-01-18 16:19:17 +010023 * version Pointer to version buffer.
Jimmy Brisson0100a612023-03-20 09:00:30 -050024 * version_size Size of the version string in bytes.
Tamas Banf5492752022-01-18 16:19:17 +010025 * measurement_algo Algorithm identifier used for measurement.
26 * sw_type Pointer to sw_type buffer.
Jimmy Brisson0100a612023-03-20 09:00:30 -050027 * sw_type_size Size of the sw_type string in bytes.
Tamas Banf5492752022-01-18 16:19:17 +010028 * measurement_value Pointer to measurement_value buffer.
David Vincze28572702022-11-04 18:28:12 +010029 * measurement_value_size Size of the measurement_value in bytes.
Tamas Banf5492752022-01-18 16:19:17 +010030 * lock_measurement Boolean flag requesting whether the measurement
31 * is to be locked.
32 *
33 * PSA_SUCCESS:
34 * - Success.
35 * PSA_ERROR_INVALID_ARGUMENT:
36 * - The size of any argument is invalid OR
37 * - Input Measurement value is NULL OR
38 * - Input Signer ID is NULL OR
39 * - Requested slot index is invalid.
40 * PSA_ERROR_BAD_STATE:
41 * - Request to lock, when slot is already locked.
42 * PSA_ERROR_NOT_PERMITTED:
43 * - When the requested slot is not accessible to the caller.
44 */
45
46/* Not a standard PSA API, just an extension therefore use the 'rss_' prefix
47 * rather than the usual 'psa_'.
48 */
49psa_status_t
50rss_measured_boot_extend_measurement(uint8_t index,
51 const uint8_t *signer_id,
52 size_t signer_id_size,
53 const uint8_t *version,
54 size_t version_size,
55 uint32_t measurement_algo,
56 const uint8_t *sw_type,
57 size_t sw_type_size,
58 const uint8_t *measurement_value,
59 size_t measurement_value_size,
60 bool lock_measurement);
61
Mate Toth-Pal445ee112022-10-24 15:15:10 +020062/**
63 * Retrieves a measurement from the requested slot.
64 *
65 * index Slot number from which measurement is to be
66 * retrieved.
67 * signer_id Pointer to signer_id buffer.
68 * signer_id_size Size of the signer_id buffer in bytes.
69 * signer_id_len On success, number of bytes that make up
70 * signer_id.
71 * version Pointer to version buffer.
72 * version_size Size of the version buffer in bytes.
73 * version_len On success, number of bytes that makeup the
74 * version.
75 * measurement_algo Pointer to measurement_algo.
76 * sw_type Pointer to sw_type buffer.
77 * sw_type_size Size of the sw_type buffer in bytes.
78 * sw_type_len On success, number of bytes that makeup the
79 * sw_type.
80 * measurement_value Pointer to measurement_value buffer.
81 * measurement_value_size Size of the measurement_value buffer in bytes.
82 * measurement_value_len On success, number of bytes that make up the
83 * measurement_value.
84 * is_locked Pointer to lock status of requested measurement
85 * slot.
86 *
87 * PSA_SUCCESS
88 * - Success.
89 * PSA_ERROR_INVALID_ARGUMENT
90 * - The size of at least one of the output buffers is incorrect or the
91 * requested slot index is invalid.
92 * PSA_ERROR_DOES_NOT_EXIST
93 * - The requested slot is empty, does not contain a measurement.
94 */
95psa_status_t rss_measured_boot_read_measurement(uint8_t index,
96 uint8_t *signer_id,
97 size_t signer_id_size,
98 size_t *signer_id_len,
99 uint8_t *version,
100 size_t version_size,
101 size_t *version_len,
102 uint32_t *measurement_algo,
103 uint8_t *sw_type,
104 size_t sw_type_size,
105 size_t *sw_type_len,
106 uint8_t *measurement_value,
107 size_t measurement_value_size,
108 size_t *measurement_value_len,
109 bool *is_locked);
110
Tamas Banf5492752022-01-18 16:19:17 +0100111#endif /* PSA_MEASURED_BOOT_H */