Giter VIP home page Giter VIP logo

Comments (4)

markblundeberg avatar markblundeberg commented on September 27, 2024

(ping authors @jhoenicke @prusnak )

from slips.

prusnak avatar prusnak commented on September 27, 2024

Where exactly we use d = x mod n?

I only see parse_256(I_L) + k_par (mod n) = 0 which is different and cannot be replaced.

from slips.

jhoenicke avatar jhoenicke commented on September 27, 2024

With bip32, the goal was to have no bias at all. They wanted to even avoid the tiny bias of the modulo operation that ca. 2^128 numbers are twice as likely as the others.

BTW, the 0 is no problem, the problem is if I_L would exactly equal -k_par, which the modulo n-1 trick cannot avoid (you could of course use modulo (n-1) and add 1 if I_L is >= -k_par, but that just makes it more complicated and it would be hard to make an implementation side-channel resistant).

I'm not sure if the bias that modulo would give is security relevant for secp256k. Let's face it, even though some numbers are twice as likely (the ones between 0 and 2^256 - n), it is still very unlikely that one of these numbers will ever be taken in the next hundred years. It's not even feasible to brute force a test case for this.

from slips.

markblundeberg avatar markblundeberg commented on September 27, 2024

Ah, ok, I have misinterpreted what's going on. I can see now why the logic needs to be the way it is. (Interestingly, if the ultra-rare case does happen that parse_256(I_L) == -k_par then not only is that key position useless, but in fact k_par has been accidentally compromised to anyone who knows the xpub.)

If child keys had been derived via multiplication rather than addition, then the solution I suggested would have been helpful. I.e., calculate 0 < d < n from x = parse_256(I_L) but then use k_i = d * k_par mod n and K_i = d * K_par, which always yields a good key without needing retries. That said, I am unsure whether multiplicative derivation is as secure as additive derivation.

from slips.

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.