Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
platform: msm_shared: Add delete keys command support
Browse files Browse the repository at this point in the history
When userdata partition is wiped out or flashed it is necessary
to send a delete keys command to tz

Change-Id: Ia346fb11246ec020993e01dae09ba7476e3da0b7
  • Loading branch information
Sridhar Parasuram authored and Parth Dixit committed Aug 13, 2015
1 parent 1491fea commit d350127
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
23 changes: 23 additions & 0 deletions include/km_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,27 @@ typedef struct _km_set_milestone_rsp_t {
int status;
}__attribute__ ((packed)) km_set_milestone_rsp_t;

/*
* Structures for delete_all cmd
*/
/*
@brief
Data structure
@param[in] cmd_id Requested command
*/
typedef struct _key_op_delete_all_req_t {
uint32 cmd_id;
}__attribute__ ((packed)) key_op_delete_all_req_t;

/*
@brief
Data structure
@param[out] status Status of the request
*/
typedef struct _key_op_delete_all_rsp_t {
int status;
}__attribute__ ((packed)) key_op_delete_all_rsp_t;

#endif /* KM_MAIN_H */
1 change: 1 addition & 0 deletions platform/msm_shared/include/secapp_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ bool is_sec_app_loaded();
int load_sec_app();
int get_secapp_handle();
int send_milestone_call_to_tz();
int send_delete_keys_to_tz();

#endif /* SAL_MAIN_H */
19 changes: 19 additions & 0 deletions platform/msm_shared/secapp_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ int get_secapp_handle()
return app_handle;
}

int send_delete_keys_to_tz()
{
int ret = 0;
key_op_delete_all_req_t req = {0};
key_op_delete_all_rsp_t rsp = {0};
req.cmd_id = KEYMASTER_DELETE_ALL_KEYS;

// send delete all keys command
ret = qseecom_send_command(app_handle, (void *)&req, sizeof(req), (void *)&rsp, sizeof(rsp));

if (ret < 0 || rsp.status < 0)
{
dprintf(CRITICAL, "Failed to send delete keys command: Error: %x\n", rsp.status);
return -1;
}

return 0;
}

int send_milestone_call_to_tz()
{
int ret = 0;
Expand Down

0 comments on commit d350127

Please sign in to comment.