lib: avb: rk: add authenticated unlock interface

Change-Id: Ib2aa1ac07d25f14aa08fc759ec99b6ba64d6abef
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
Jason Zhu 2018-06-11 18:16:04 +08:00 committed by Kever Yang
parent cb49af8fa6
commit 83ab7b4937
2 changed files with 34 additions and 0 deletions

View File

@ -243,6 +243,17 @@ int rk_avb_get_part_has_slot_info(const char *base_name);
AvbABFlowResult rk_avb_ab_slot_select(AvbABOps* ab_ops,char select_slot[]);
/**
* authenticated unlock
*
* @param buffer: AvbAtxUnlockCredential
*
* @param out_is_trusted: true or false
*
* @return 0 if authenticated unlock OK, -1 if not
*/
int rk_auth_unlock(void *buffer, char *out_is_trusted);
#ifdef __cplusplus
}
#endif

View File

@ -632,3 +632,26 @@ int rk_avb_get_part_has_slot_info(const char *base_name)
free(part_name);
return part_num;
}
int rk_auth_unlock(void *buffer, char *out_is_trusted)
{
AvbOps* ops;
ops = avb_ops_user_new();
if (ops == NULL) {
avb_error("avb_ops_user_new() failed!");
return -1;
}
if (avb_atx_validate_unlock_credential(ops->atx_ops,
(AvbAtxUnlockCredential*)buffer,
(bool*)out_is_trusted)) {
avb_ops_user_free(ops);
return -1;
}
avb_ops_user_free(ops);
if (*out_is_trusted == true)
return 0;
else
return -1;
}