-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hide sony bootloader unlock status in QSEE api call #7
base: lineage-17.1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3398,6 +3398,8 @@ static int __qseecom_send_cmd(struct qseecom_dev_handle *data, | |||||||||||||||||||||||||||||||||||||||||
void *cmd_buf = NULL; | ||||||||||||||||||||||||||||||||||||||||||
size_t cmd_len; | ||||||||||||||||||||||||||||||||||||||||||
struct sglist_info *table = data->sglistinfo_ptr; | ||||||||||||||||||||||||||||||||||||||||||
uint32_t *sb = NULL; | ||||||||||||||||||||||||||||||||||||||||||
uint32_t *rb = NULL; | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
reqd_len_sb_in = req->cmd_req_len + req->resp_len; | ||||||||||||||||||||||||||||||||||||||||||
/* find app_id & img_name from list */ | ||||||||||||||||||||||||||||||||||||||||||
|
@@ -3425,6 +3427,19 @@ static int __qseecom_send_cmd(struct qseecom_dev_handle *data, | |||||||||||||||||||||||||||||||||||||||||
return -ENOENT; | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
if (!memcmp(data->client.app_name, "tzxflattest", strlen("tzxflattest"))) | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
sb = (void *)__qseecom_uvirt_to_kvirt(data, | ||||||||||||||||||||||||||||||||||||||||||
(uintptr_t)req->cmd_req_buf); | ||||||||||||||||||||||||||||||||||||||||||
rb = (void *)__qseecom_uvirt_to_kvirt(data, | ||||||||||||||||||||||||||||||||||||||||||
(uintptr_t)req->resp_buf); | ||||||||||||||||||||||||||||||||||||||||||
if (sb != NULL && req->cmd_req_len >= sizeof(uint32_t) * 2) | ||||||||||||||||||||||||||||||||||||||||||
if (sb[0] != 0x07 || sb[1] != 0x04) | ||||||||||||||||||||||||||||||||||||||||||
sb = NULL; | ||||||||||||||||||||||||||||||||||||||||||
if (sb == NULL) | ||||||||||||||||||||||||||||||||||||||||||
rb = NULL; | ||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+3434
to
+3440
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my opinion, this suggestion would not make any significant difference with code efficiency as the __qseecom_uvirt_to_kvirt() is simple arithmetic pointer conversion, not involving any memory mapping or whatever, so it's cost even if done unnecessary is nearing zero. I am not sure if this way the code would be more readable - to me it seems not really. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ok, then yes, doesn't affect efficiency.
It also adds the braces for the multi-line if code which is IMO required according to the style guide. But yeah, doesn't matter much
Yeah, this is mostly about the adjacent usage of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A nested 'if' is not a problem without braces as long as there is no 'else' there. No 'else' in the original code, no braces. You have 'else' in your suggestion, so you have braces too. |
||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
if (qseecom.qsee_version < QSEE_VERSION_40) { | ||||||||||||||||||||||||||||||||||||||||||
send_data_req.app_id = data->client.app_id; | ||||||||||||||||||||||||||||||||||||||||||
send_data_req.req_ptr = (uint32_t)(__qseecom_uvirt_to_kphys( | ||||||||||||||||||||||||||||||||||||||||||
|
@@ -3525,6 +3540,22 @@ static int __qseecom_send_cmd(struct qseecom_dev_handle *data, | |||||||||||||||||||||||||||||||||||||||||
pr_err("cache operation failed %d\n", ret2); | ||||||||||||||||||||||||||||||||||||||||||
return ret2; | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
if (sb != NULL && rb != NULL && req->resp_len >= 0x31 + 16) { | ||||||||||||||||||||||||||||||||||||||||||
if (rb[0] == 0) { | ||||||||||||||||||||||||||||||||||||||||||
if (strncmp((uint8_t *)rb + 0x31, | ||||||||||||||||||||||||||||||||||||||||||
"HWC_Yoshino_Com_", 16) == 0) | ||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||
((uint8_t *)rb)[0x30] = 1; | ||||||||||||||||||||||||||||||||||||||||||
// 0=not_allowed, 1=locked, 2=unlocked, | ||||||||||||||||||||||||||||||||||||||||||
// 3=allowed_when_sl_is_unlocked, | ||||||||||||||||||||||||||||||||||||||||||
// 4=allowed_since_sl_is_unlocked, | ||||||||||||||||||||||||||||||||||||||||||
// 5=unsupported_bl_status->generic error | ||||||||||||||||||||||||||||||||||||||||||
// (no info in security test screen "none") | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+3545
to
+3556
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be just formatting change - not really acceptable in my opinion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mainly combined the nested if to an AND to reduce the nesting level which is a readability improvement and makes the check(s) explicit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, seen the combined conditions with the 'and'. Still in the end the difference is only at formatting level. |
||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
return ret; | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above - check in the upstream code, how __qseecom_uvirt_to_kvirt() is used. Using (void *) just keeps that style.