Skip to content
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

Blindsign Improvement #155

Merged
merged 3 commits into from
Nov 28, 2024
Merged

Blindsign Improvement #155

merged 3 commits into from
Nov 28, 2024

Conversation

chcmedeiros
Copy link
Collaborator

@chcmedeiros chcmedeiros commented Nov 27, 2024

🔗 zboto Link

Copy link
Member

@emmanuelm41 emmanuelm41 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments to review

@@ -17,4 +17,4 @@

#define ZXLIB_MAJOR 29
#define ZXLIB_MINOR 5
#define ZXLIB_PATCH 1
#define ZXLIB_PATCH 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New feature. We should bump minor.

src/app_mode.c Outdated
@@ -20,6 +20,7 @@ typedef struct {
uint8_t expert;
uint8_t account;
uint8_t blindsign;
uint8_t blindsign_required;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this to be on flash? This is something that is set on each operation, so I guess it is not necessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we don't need this on flash. Let me rethink the approach.

@@ -183,7 +183,7 @@ zxerr_t h_review_update_data() {
snprintf(viewdata.value, MAX_CHARS_PER_VALUE1_LINE, "Ok");
} else {
#if defined(APP_BLINDSIGN_MODE_ENABLED)
if (app_mode_blindsign()) {
if (app_mode_blindsign() && app_mode_blindsign_required()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do so, this is not backward compatible to what we currently have. We will end up with blind signing not being displayed, unless the flag is set, which is not the current scenario we have. If someone updates zxlib without changing this in the app, no method will display the blind signing screens

Copy link
Collaborator Author

@chcmedeiros chcmedeiros Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I will zxlib major since this does not have backward compatible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make it if we set blindsign_required = 1 whenever blind signing mode is enabled. Then, you need to indicate which methods will not require the blind signing screens while this mode is enabled. I think this way is even more secure, as worst case we show screen when no needed. Instead of not showing them when it is indeed needed

* limitations under the License.
********************************************************************************/
* (c) 2016 Ledger
* (c) 2018 Zondax GmbH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could take the opportunity to update this "Zondax AG"

@chcmedeiros chcmedeiros changed the base branch from main to dev November 27, 2024 18:11
Copy link
Member

@emmanuelm41 emmanuelm41 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one doubt

@@ -531,7 +531,7 @@ void run_ux_review_flow(review_type_e reviewType, const ux_flow_step_t *const st
case REVIEW_TXN:
default:
#ifdef APP_BLINDSIGN_MODE_ENABLED
if (app_mode_blindsign()) {
if (app_mode_blindsign_required()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check if app blind signing mode is enabled, and if it is required? Or are we just covering both at the same time?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check both, we run into the following: BS is enabled but not required, if we check if app_mode_blindsign is enabled we will force the required to true but indeed we shouldn't

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmmm what a problem... because if we set required to true, even if the blind signing mode is not enabled, we will display the screens... right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no way to set the required to true on the code.
We can only set it to zero with app_mode_blindising_skip_ui(), otherwise it will follow app_mode_blindsign enabled or not value

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial possabilities:
BS is enabled by user required will be set to true;
BS is disabled by user required will be set to false;

From that point:
Code checks if BS is true -> Bs is true -> required set to true
Code checks if BS is false -> Bs is false -> required maintains its value. But if BS is false it was set by the user and at that point required will also be set to zero

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

@chcmedeiros chcmedeiros merged commit c6d1be0 into dev Nov 28, 2024
4 checks passed
@chcmedeiros chcmedeiros deleted the fix branch November 28, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants