AM263x MCU+ SDK  08.04.00
hsmclient.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Texas Instruments Incorporated
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef HSM_CLIENT_H_
34 #define HSM_CLIENT_H_
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* Header file for HSM client driver */
41 #include <stdint.h>
42 #include <drivers/sipc_notify.h>
44 #include <kernel/dpl/SemaphoreP.h>
45 
60 typedef union HsmVer_t_
61 {
62  uint64_t HsmrtVer ;
63  struct
64  {
65  uint8_t PatchVer ;
66  uint8_t MinorVer ;
67  uint8_t MajorVer;
68  uint8_t ApiVer ;
69  uint8_t SocType ;
70  uint8_t BinType ;
71  uint8_t DevType ;
72  uint8_t Reserved;
75 
76 }__attribute__((packed)) HsmVer_t;
77 
78 
84 typedef struct HsmClient_t_
85 {
88  HsmMsg_t ReqMsg ;
89  HsmMsg_t RespMsg ;
90  uint8_t RespFlag ;
91  uint8_t ClientId ;
93 } HsmClient_t ;
94 
105 int32_t HsmClient_init(SIPC_Params* params);
106 
112 void HsmClient_deInit(void);
113 
129 int32_t HsmClient_getVersion(HsmClient_t *HsmClient ,
130  HsmVer_t* verId,uint32_t timeToWaitInTick);
131 
147 int32_t HsmClient_getUID(HsmClient_t* HsmClient,
148  uint8_t* uid, uint32_t timeout);
149 
166 int32_t HsmClient_openDbgFirewall(HsmClient_t* HsmClient,
167  uint8_t* cert,
168  uint32_t cert_size,
169  uint32_t timeout);
170 
182 int32_t HsmClient_register(HsmClient_t* HsmClient, uint8_t clientId);
183 
192 void HsmClient_unregister(HsmClient_t* HsmClient,uint8_t clientId);
206 int32_t HsmClient_waitForBootNotify(HsmClient_t* HsmClient,uint32_t timeToWaitInTicks);
207 
216 int32_t Hsmclient_loadHSMRtFirmware(const uint8_t *pHSMRt_firmware);
217 
220 #ifdef __cplusplus
221 }
222 #endif
223 
224 #endif /* HSM_CLIENT_H_ */
SIPC_Params
Parameters used by SIPC_init.
Definition: sipc_notify.h:84
HsmVer_t_
type for reading HSMRt version.
Definition: hsmclient.h:61
HsmVer_t_::DevType
uint8_t DevType
Definition: hsmclient.h:71
HsmClient_t::RespFlag
uint8_t RespFlag
Definition: hsmclient.h:90
Hsmclient_loadHSMRtFirmware
int32_t Hsmclient_loadHSMRtFirmware(const uint8_t *pHSMRt_firmware)
Loads the HSMRt firmware. This is typically called by SBL.
Definition: hsmclient_loadhsmrt.c:254
__attribute__
union HsmVer_t_ __attribute__((packed)) HsmVer_t
type for reading HSMRt version.
HsmClient_t
This is a HSMClient type which holds the information needed by hsm client to communicate with HSM .
Definition: hsmclient.h:85
SemaphoreP.h
sipc_notify.h
HsmVer_t_::PatchVer
uint8_t PatchVer
Definition: hsmclient.h:65
HsmVer_t_::VerStruct
struct HsmVer_t_::@0 VerStruct
HsmClient_t::RespMsg
HsmMsg_t RespMsg
Definition: hsmclient.h:89
HsmClient_openDbgFirewall
int32_t HsmClient_openDbgFirewall(HsmClient_t *HsmClient, uint8_t *cert, uint32_t cert_size, uint32_t timeout)
The service issued to HSM Server verifies the certificate and by default the hsm flag is set to HSM_F...
Definition: hsmclient.c:331
HsmClient_register
int32_t HsmClient_register(HsmClient_t *HsmClient, uint8_t clientId)
register a client to a particular ClientId
Definition: hsmclient.c:161
HsmClient_init
int32_t HsmClient_init(SIPC_Params *params)
Initialize the HSM client for current core.
Definition: hsmclient.c:190
HsmVer_t_::SocType
uint8_t SocType
Definition: hsmclient.h:69
HsmVer_t_::MinorVer
uint8_t MinorVer
Definition: hsmclient.h:66
HsmClient_unregister
void HsmClient_unregister(HsmClient_t *HsmClient, uint8_t clientId)
unregister a client to a particular ClientId
Definition: hsmclient.c:211
hsmclient_msg.h
HsmClient_waitForBootNotify
int32_t HsmClient_waitForBootNotify(HsmClient_t *HsmClient, uint32_t timeToWaitInTicks)
Current core will wait for bootnotify message from HSM core.
Definition: hsmclient.c:390
HsmClient_t::Semaphore
SemaphoreP_Object Semaphore
Definition: hsmclient.h:86
HsmClient_getUID
int32_t HsmClient_getUID(HsmClient_t *HsmClient, uint8_t *uid, uint32_t timeout)
The service issued to HSM Server populates the Device UID by default the hsm flag is set to HSM_FLAG_...
Definition: hsmclient.c:274
HsmVer_t_::BinType
uint8_t BinType
Definition: hsmclient.h:70
HsmVer_t_::Reserved
uint8_t Reserved
Definition: hsmclient.h:72
HsmClient_t::ClientId
uint8_t ClientId
Definition: hsmclient.h:91
SemaphoreP_Object
Opaque semaphore object used with the semaphore APIs.
Definition: SemaphoreP.h:59
HsmVer_t_::ApiVer
uint8_t ApiVer
Definition: hsmclient.h:68
HsmVer_t_::MajorVer
uint8_t MajorVer
Definition: hsmclient.h:67
HsmVer_t_::HsmrtVer
uint64_t HsmrtVer
Definition: hsmclient.h:62
HsmClient_getVersion
int32_t HsmClient_getVersion(HsmClient_t *HsmClient, HsmVer_t *verId, uint32_t timeToWaitInTick)
populates the current HSMRT version Id by default the hsm flag is set to HSM_FLAG_AOP for this servic...
Definition: hsmclient.c:217
HsmClient_t::ReqMsg
HsmMsg_t ReqMsg
Definition: hsmclient.h:88
HsmClient_deInit
void HsmClient_deInit(void)
De initialize the HSM client for current core.