Giter Site home page Giter Site logo

Comments (5)

dsprenkels avatar dsprenkels commented on August 16, 2024

@invd Thank you for the bug report! Sorry for acting on it after such a long time, I have been on vacation.

I feel that the real bug here is that (1 << arr_idx) is an int, instead of a uint32_t, but that does not matter for the fix.

I would personally prefer first fix:

r[arr_idx] |= ((cur >> arr_idx) & 1) << bit_idx;

from sss.

dsprenkels avatar dsprenkels commented on August 16, 2024

Note: We should also fix the bitslice part of this bug located at:

sss/hazmat.c

Line 43 in b3ac4e7

r[bit_idx] |= ((cur & (1 << bit_idx)) >> bit_idx) << arr_idx;

from sss.

andrewkozlik avatar andrewkozlik commented on August 16, 2024

Note: We should also fix the bitslice part of this bug located at:

sss/hazmat.c

Line 43 in b3ac4e7

r[bit_idx] |= ((cur & (1 << bit_idx)) >> bit_idx) << arr_idx;

Technically this is OK, because bit_idx is at most 7 and the minimum size of int is 16 bits. But I agree it would be more readable and consistent to write it in the other form.

from sss.

invd avatar invd commented on August 16, 2024

@dsprenkels: no problem for the delay!
I agree with @andrewkozlik for the patch consideration.
We have the proposed patch in the linked Trezor issue.

from sss.

prusnak avatar prusnak commented on August 16, 2024

For reference - here's the patch we merged to Trezor codebase: trezor/trezor-firmware@5429acd

from sss.

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.