Software APIs
sw
device
silicon_creator
lib
boot_svc
boot_svc_ownership_activate.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_LIB_BOOT_SVC_BOOT_SVC_OWNERSHIP_ACTIVATE_H_
6
#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_OWNERSHIP_ACTIVATE_H_
7
8
#include <
stdint.h
>
9
10
#include "
sw/device/lib/base/macros.h
"
11
#include "
sw/device/silicon_creator/lib/base/chip.h
"
12
#include "sw/device/silicon_creator/lib/boot_svc/boot_svc_header.h"
13
#include "sw/device/silicon_creator/lib/error.h"
14
#include "sw/device/silicon_creator/lib/nonce.h"
15
#include "sw/device/silicon_creator/lib/ownership/datatypes.h"
16
17
#ifdef __cplusplus
18
extern
"C"
{
19
#endif
// __cplusplus
20
21
enum
{
22
/** Ownership activate request: `ACTV`. */
23
kBootSvcOwnershipActivateReqType = 0x56544341,
24
/** Ownership activate response: `VTCA`. */
25
kBootSvcOwnershipActivateResType = 0x41435456,
26
};
27
28
/**
29
* An Ownership Activate request.
30
*/
31
typedef
struct
boot_svc_ownership_activate_req
{
32
/**
33
* Boot services message header.
34
*/
35
boot_svc_header_t
header
;
36
/**
37
* Which side of the flash is primary after activation.
38
*/
39
uint32_t
primary_bl0_slot
;
40
/**
41
* The 64-bit DIN subfield of the full 256-bit device ID.
42
*/
43
uint32_t
din
[2];
44
/**
45
* Erase previous owner's flash (hardened_bool_t).
46
*/
47
uint32_t
erase_previous
;
48
/**
49
* Reserved for future use.
50
*/
51
uint32_t
reserved
[31];
52
/**
53
* The current ownership nonce.
54
*/
55
nonce_t
nonce
;
56
/**
57
* Signature over [primary_bl0_slot..nonce]
58
*/
59
owner_signature_t
signature
;
60
61
}
boot_svc_ownership_activate_req_t
;
62
63
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_ownership_activate_req_t
, header, 0);
64
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_ownership_activate_req_t
, primary_bl0_slot,
65
CHIP_BOOT_SVC_MSG_HEADER_SIZE
);
66
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_ownership_activate_req_t
, din,
67
CHIP_BOOT_SVC_MSG_HEADER_SIZE
+ 4);
68
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_ownership_activate_req_t
, erase_previous,
69
CHIP_BOOT_SVC_MSG_HEADER_SIZE
+ 12);
70
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_ownership_activate_req_t
, reserved,
71
CHIP_BOOT_SVC_MSG_HEADER_SIZE
+ 16);
72
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_ownership_activate_req_t
,
nonce
,
73
CHIP_BOOT_SVC_MSG_HEADER_SIZE
+ 140);
74
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_ownership_activate_req_t
, signature,
75
CHIP_BOOT_SVC_MSG_HEADER_SIZE
+ 148);
76
OT_ASSERT_SIZE
(
boot_svc_ownership_activate_req_t
, 256);
77
78
/**
79
* An Ownership Activate response.
80
*/
81
typedef
struct
boot_svc_ownership_activate_res
{
82
/**
83
* Boot services message header.
84
*/
85
boot_svc_header_t
header
;
86
/**
87
* Response status from the ROM_EXT.
88
*/
89
rom_error_t
status
;
90
}
boot_svc_ownership_activate_res_t
;
91
92
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_ownership_activate_res_t
, header, 0);
93
OT_ASSERT_MEMBER_OFFSET
(
boot_svc_ownership_activate_res_t
,
status
,
94
CHIP_BOOT_SVC_MSG_HEADER_SIZE
);
95
OT_ASSERT_SIZE
(
boot_svc_ownership_activate_res_t
, 48);
96
97
/**
98
* Initialize an ownership activate request.
99
*
100
* @param[out] msg Output buffer for the message.
101
*/
102
void
boot_svc_ownership_activate_req_init(
103
uint32_t primary_bl0_slot, uint32_t erase_previous,
nonce_t
nonce
,
104
const
owner_signature_t
*signature,
boot_svc_ownership_activate_req_t
*msg);
105
106
/**
107
* Initialize an ownership activate response.
108
*
109
* @param status Reponse from the ROM_EXT after receiving the request.
110
* @param[out] msg Output buffer for the message.
111
*/
112
void
boot_svc_ownership_activate_res_init(
113
rom_error_t
status
,
boot_svc_ownership_activate_res_t
*msg);
114
115
#ifdef __cplusplus
116
}
// extern "C"
117
#endif
// __cplusplus
118
119
#endif
// OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_BOOT_SVC_BOOT_SVC_OWNERSHIP_ACTIVATE_H_
Return to
OpenTitan Documentation