Software APIs
boot_svc_ownership_unlock.c
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#include "sw/device/silicon_creator/lib/boot_svc/boot_svc_ownership_unlock.h"
6
8#include "sw/device/silicon_creator/lib/error.h"
9
10void boot_svc_ownership_unlock_req_init(uint32_t unlock_mode,
11 uint32_t next_owner_key_alg,
12 nonce_t nonce,
13 const owner_keydata_t *next_owner_key,
14 const owner_signature_t *signature,
15 boot_svc_ownership_unlock_req_t *msg) {
16 msg->unlock_mode = unlock_mode;
17 memset(msg->reserved, 0, sizeof(msg->reserved));
18 msg->next_owner_key_alg = next_owner_key_alg;
19 msg->nonce = nonce;
20 msg->next_owner_key = *next_owner_key;
21 msg->signature = *signature;
22 boot_svc_header_finalize(kBootSvcOwnershipUnlockReqType,
23 sizeof(boot_svc_ownership_unlock_req_t),
24 &msg->header);
25}
26
27void boot_svc_ownership_unlock_res_init(rom_error_t status,
28 boot_svc_ownership_unlock_res_t *msg) {
29 msg->status = status;
30 boot_svc_header_finalize(kBootSvcOwnershipUnlockResType,
31 sizeof(boot_svc_ownership_unlock_res_t),
32 &msg->header);
33}