Software APIs
sigverify_keys_ecdsa_p256.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_SIGVERIFY_KEYS_ECDSA_P256_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_SIGVERIFY_KEYS_ECDSA_P256_H_
7 
8 #include <stdint.h>
9 
10 #include "sw/device/silicon_creator/lib/drivers/lifecycle.h"
11 #include "sw/device/silicon_creator/lib/error.h"
12 #include "sw/device/silicon_creator/lib/sigverify/ecdsa_p256_key.h"
13 #include "sw/device/silicon_creator/rom/sigverify_key_types.h"
14 #include "sw/device/silicon_creator/rom/sigverify_otp_keys.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif // __cplusplus
19 
20 /**
21  * Returns the key with the given ID.
22  *
23  * This function returns the key only if it can be used in the given life cycle
24  * state and is valid in OTP. OTP check is performed only if the device is in a
25  * non-test operational state (PROD, PROD_END, DEV, RMA).
26  *
27  * @param key_id A key ID.
28  * @param lc_state Life cycle state of the device.
29  * @param key Key with the given ID, valid only if it exists.
30  * @return Result of the operation.
31  */
33 rom_error_t sigverify_ecdsa_p256_key_get(
34  const sigverify_otp_key_ctx_t *sigverify_ctx, uint32_t key_id,
35  lifecycle_state_t lc_state, const ecdsa_p256_public_key_t **key);
36 
37 #ifdef __cplusplus
38 } // extern "C"
39 #endif // __cplusplus
40 
41 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_SIGVERIFY_KEYS_ECDSA_P256_H_