Skip to content

Commit

Permalink
lib: avb: rk: add authenticated unlock interface
Browse files Browse the repository at this point in the history
Change-Id: Ib2aa1ac07d25f14aa08fc759ec99b6ba64d6abef
Signed-off-by: Jason Zhu <[email protected]>
  • Loading branch information
Jason Zhu authored and keveryang committed Jun 13, 2018
1 parent cb49af8 commit 83ab7b4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/android_avb/rk_avb_ops_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions lib/avb/rk_avb_user/rk_avb_ops_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 83ab7b4

Please sign in to comment.