feat: add cardano-crypto-wallet package#653
Open
disassembler wants to merge 5 commits into
Open
Conversation
64068a5 to
0ddedc7
Compare
80b8cc1 to
1e10820
Compare
Vendors the ed25519-donna implementation from the cardano-crypto package into this repository.
Adds encrypted_sign.c implementing HD wallet key operations using libsodium (Argon2id KDF, XChaCha20-Poly1305 AEAD, HMAC-SHA512). Updates ed25519-hash.h to use libsodium SHA-512 instead of crypton.
Adds the cardano-crypto-wallet Haskell package exposing Cardano.Crypto.WalletHD.Encrypted, which provides authenticated encryption and key derivation for HD wallet keys using the v2 envelope format (Argon2id KDF + XChaCha20-Poly1305 AEAD via libsodium).
Adds round-trip, format, and signing tests plus a criterion benchmark suite for the cardano-crypto-wallet package.
1e10820 to
592fc8d
Compare
AndrewWestberg
approved these changes
May 11, 2026
Four internal ByteString allocations held the raw 128-byte extended
private key (ed25519 scalar || public key || chain code) in memory
without guaranteed zeroing on GC. Switch them to ScrubbedBytes so
the memory package zeroes the pages when they are collected.
- keyMaterialFromLegacyBytes: avoids an intermediate full :: ByteString
carrying all 128 bytes; slices secret/pub/cc directly from ScrubbedBytes
- legacyMaterialFromSecret / legacyMaterialFromMasterKey / legacyDerivePrivate:
type annotations changed from ByteString to ScrubbedBytes so B.allocRet
allocates scrubbed pages from the start
No public API or serialisation changes.
Contributor
|
I am not in any way a crypto guy, but I am a Haskell guy and I did spend decades coding in C, but have not done an C in over a decade. I will review this, but it should also be reviewed by a crypto guy that also knows Haskell and C. For the Haskell code:
For the C code (
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduces a new package providing authenticated envelope wrapping for HD wallet extended private keys.
cbits are vendored from cardano-crypto. This is done in the first commit which can be largely ignored by reviewers.
Key design:
Description
Checklist
CHANGELOG.mdfor the affected packages.New section is never added with the code changes. (See RELEASING.md)
.cabalandCHANGELOG.mdfiles according to theversioning process.
.cabalfiles for all affected packages are updated.If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)