Skip to content

feat(crypto): add Orchard primitives and compact AES tables - #1

Closed
BitHighlander wants to merge 8 commits into
keepkeyfrom
fix/aes-small-tables
Closed

feat(crypto): add Orchard primitives and compact AES tables#1
BitHighlander wants to merge 8 commits into
keepkeyfrom
fix/aes-small-tables

Conversation

@BitHighlander

Copy link
Copy Markdown
Owner

Purpose

Makes the trezor-crypto dependency used by KeepKey firmware 7.15.0 RC18 independently reviewable instead of pinning an otherwise untracked fork branch.

The RC18 firmware candidate pins this branch at 56f404e452bc7738cd3b3e14454dfecb25c083bf.

Contents

  • Pallas curve and RedPallas signing primitives for Zcash Orchard
  • Pallas hash-to-curve and Sinsemilla primitives
  • Orchard incoming-viewing-key support
  • ZIP-316 Orchard unified-address encoding
  • opt-in AES_SMALL_TABLES support for ROM-constrained firmware builds

Without AES_SMALL_TABLES, the existing four-table AES behavior remains unchanged.

Validation

Review gates

  • one branch and one PR into the fork's keepkey branch
  • exact commit pinned by the firmware candidate
  • corrected firmware RC18 matrix green
  • human review

Do not merge until the corrected firmware candidate is green and this dependency has human approval.

markrypt0 and others added 8 commits February 5, 2025 15:58
Add Zcash Orchard cryptographic primitives:
- pallas.c/h: Pallas curve arithmetic (field ops, scalar ops, point mult)
- redpallas.c/h: RedPallas spend authorization signing (ZIP-244)

Required for Zcash Orchard shielded transaction signing on KeepKey.
…M-constrained builds

The five Gladman AES lookup tables (t_fn, t_fl, t_in, t_il, t_im) are
4096 bytes each in the default FOUR_TABLES mode — 20,480 bytes of flash.
Defining AES_SMALL_TABLES at compile time selects the library's existing
ONE_TABLE mode for every round function instead, shrinking each table to
1024 bytes and reclaiming 15,360 bytes of ROM for a modest per-round
cycle cost.

Default behavior is unchanged: without the define, FOUR_TABLES is
selected exactly as before, so existing builds are byte-identical.

Motivation: the keepkey-firmware KK_ZCASH_PRIVACY variant (full coin set
plus the Orchard shielded engine) overflowed its 640KB ROM region by
2,400 bytes once 7.15 clear-signing landed; the variant had only 1,520
bytes of headroom to begin with.
@BitHighlander

Copy link
Copy Markdown
Owner Author

Opened against the personal fork in error while formalizing the RC18 dependency pin. The firmware submodule points to the canonical KeepKey organization repository, and the review lane is now keepkey#4. Closing this duplicate without merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants