Git Product home page Git Product logo

Comments (7)

greenknot avatar greenknot commented on July 19, 2024 1

Thanks for the clarification! Indeed, it looks like a bug in speculos, related to this io_seproxyhal_button_push().

from speculos.

greenknot avatar greenknot commented on July 19, 2024 1

As mentioned by @mul1sh, the bug can be reproduced on the sia app (it isn't related to OS X and can be reproduced on Linux too), for instance in the ui_getPublicKey_compare_button() callback with the following APDU:

echo 'e002000000' | LEDGER_PROXY_ADDRESS=127.0.0.1 LEDGER_PROXY_PORT=9999 ledgerctl send -

When a button is pushed (either left or right), UX_REDISPLAY() is called, then UX_REDISPLAY_IDX() and eventually io_seproxyhal_init_button(). io_seproxyhal_init_button() sets G_ux_os.button_mask to 0.

When the button is released, the callback (ui_getPublicKey_compare_button()) is called with button_mask being equal to BUTTON_EVT_RELEASED, because:

  • G_ux_os.button_mask = 0 because of io_seproxyhal_init_button()
  • button_mask = G_ux_os.button_mask | new_button_mask; (L910)

The condition BUTTON_EVT_RELEASED | BUTTON_LEFT | BUTTON_RIGHT is thus never met.

I guess it works on a real device because of some race condition?

from speculos.

greenknot avatar greenknot commented on July 19, 2024

@mul1sh does #62 fix the issue?

from speculos.

mul1sh avatar mul1sh commented on July 19, 2024

@greenknot unfortunately no as explained in the PR. i'm also using the headless option with docker, not sure if that can be an issue too.

from speculos.

mul1sh avatar mul1sh commented on July 19, 2024

@greenknot no worries, glad I could help. Thanks.

from speculos.

greenknot avatar greenknot commented on July 19, 2024

I've really now idea how it can work on a real device and it's indeed a bug in speculos since the behavior differs. That being said, the sia app uses some legacy UX primitives and I guess this behavior can be fixed (in the sia app) using what's called flow now IIRC, or more conventional button callbacks.

I don't plan to spend more time on this issue, feel free to re-open it if these suggestions don't work for you.

from speculos.

mul1sh avatar mul1sh commented on July 19, 2024

@greenknot no worries and thanks for the feedback. I think i'll just improvise with other button events moving forward.

Also just out of curiosity what do you mean legacy UX primitives, sounds like the security risk no? Since even the official docs recommend to start developing from the sia app.

from speculos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.