Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

SURI HD derivation confuses ChainCode with index i #3396

@maciejhirsz

Description

@maciejhirsz

Disclaimer: I'm not a cryptographer, talked to @burdges about it to make sure I'm reading stuff right. Jeff can fill in details if I missed anything.

Current sr25519 derivation code feeds DeriveJunctions as ChainCodes to soft/hard derivation methods, using empty byte arrays for i in both cases. This seems to be fine for what we are doing (both ChainCode and i end up in the same hash anyway), but is not the intended use of the API.

The consequences are that we are missing the extra entropy from the ChainCode product of previous key expansion in subsequent derivations. This is probably fine as we still have complete entropy of the original secret key, and my understanding after talking to Jeff as of why the extra entropy exists in BIP32 in the first place is that nobody knows :P.

TL;DR: We are feeding derivation junctions as chain codes instead of i, and throwing away chain codes from previous expansions, which is probably fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    J2-unconfirmedIssue might be valid, but it’s not yet known.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions