lib: optee_client: add read vboot key flag func
Change-Id: Id0405cc2b695f00b5d7586d01bd0b66279b24430 Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
This commit is contained in:
parent
4a872f4aa8
commit
468df3b26a
|
|
@ -24,6 +24,7 @@ uint32_t trusty_write_attribute_hash(uint32_t *buf, uint32_t length);
|
|||
uint32_t trusty_notify_optee_uboot_end(void);
|
||||
uint32_t trusty_read_vbootkey_hash(uint32_t *buf, uint32_t length);
|
||||
uint32_t trusty_write_vbootkey_hash(uint32_t *buf, uint32_t length);
|
||||
uint32_t trusty_read_vbootkey_enable_flag(uint8_t *flag);
|
||||
uint32_t trusty_read_permanent_attributes_flag(uint8_t *attributes);
|
||||
uint32_t trusty_write_permanent_attributes_flag(uint8_t attributes);
|
||||
|
||||
|
|
|
|||
|
|
@ -1027,6 +1027,64 @@ uint32_t trusty_write_vbootkey_hash(uint32_t *buf, uint32_t length)
|
|||
return TeecResult;
|
||||
}
|
||||
|
||||
uint32_t trusty_read_vbootkey_enable_flag(uint8_t *flag)
|
||||
{
|
||||
TEEC_Result TeecResult;
|
||||
TEEC_Context TeecContext;
|
||||
TEEC_Session TeecSession;
|
||||
uint32_t ErrorOrigin;
|
||||
uint32_t bootflag;
|
||||
|
||||
TEEC_UUID tempuuid = { 0x2d26d8a8, 0x5134, 0x4dd8, \
|
||||
{ 0xb3, 0x2f, 0xb3, 0x4b, 0xce, 0xeb, 0xc4, 0x71 } };
|
||||
TEEC_UUID *TeecUuid = &tempuuid;
|
||||
TEEC_Operation TeecOperation = {0};
|
||||
|
||||
OpteeClientApiLibInitialize();
|
||||
|
||||
TeecResult = TEEC_InitializeContext(NULL, &TeecContext);
|
||||
|
||||
TeecResult = TEEC_OpenSession(&TeecContext,
|
||||
&TeecSession,
|
||||
TeecUuid,
|
||||
TEEC_LOGIN_PUBLIC,
|
||||
NULL,
|
||||
NULL,
|
||||
&ErrorOrigin);
|
||||
|
||||
TEEC_SharedMemory SharedMem0 = {0};
|
||||
|
||||
SharedMem0.size = 1 * sizeof(uint32_t);
|
||||
SharedMem0.flags = 0;
|
||||
|
||||
TeecResult = TEEC_AllocateSharedMemory(&TeecContext, &SharedMem0);
|
||||
|
||||
TeecOperation.params[0].tmpref.buffer = SharedMem0.buffer;
|
||||
TeecOperation.params[0].tmpref.size = SharedMem0.size;
|
||||
|
||||
TeecOperation.paramTypes = TEEC_PARAM_TYPES(TEEC_MEMREF_TEMP_OUTPUT,
|
||||
TEEC_NONE,
|
||||
TEEC_NONE,
|
||||
TEEC_NONE);
|
||||
|
||||
TeecResult = TEEC_InvokeCommand(&TeecSession,
|
||||
5,
|
||||
&TeecOperation,
|
||||
&ErrorOrigin);
|
||||
|
||||
if (TeecResult == TEEC_SUCCESS) {
|
||||
memcpy(&bootflag, SharedMem0.buffer, SharedMem0.size);
|
||||
if (bootflag == 0x000000FF)
|
||||
*flag = 1;
|
||||
}
|
||||
|
||||
TEEC_ReleaseSharedMemory(&SharedMem0);
|
||||
TEEC_CloseSession(&TeecSession);
|
||||
TEEC_FinalizeContext(&TeecContext);
|
||||
|
||||
return TeecResult;
|
||||
}
|
||||
|
||||
uint32_t trusty_read_permanent_attributes_flag(uint8_t *attributes)
|
||||
{
|
||||
TEEC_Result TeecResult;
|
||||
|
|
|
|||
Loading…
Reference in New Issue