refactor(zcash): remove orphaned sign_message_orchard helper
What changed, and why it matters
This commit removes an unused helper function called sign_message_orchard from the Zcash code in a cryptocurrency hardware wallet firmware. The function was not being called anywhere in the codebase (orphaned/dead code), so removing it is a routine cleanup. There is no direct evidence in the commit that this was a security fix or that the removed code was exploitable.
No immediate security action is required. Treat as routine refactoring. If auditing, verify that no other code paths referenced sign_message_orchard and that the equivalent Orchard signing logic, if still needed, is implemented elsewhere or intentionally deprecated.
Security signals we found
Removal of cryptographic signing helper (dead code elimination)
No caller sites shown in diff
No vendor claim of security relevance in commit message or title
Evidence from the diff
The diff deletes sign_message_orchard, a #[cfg(feature = “cypherpunk”)] helper in rust/keystore/src/algorithms/zcash/mod.rs. It also removes the now-unused imports rand_core::{CryptoRng, RngCore} and orchard::{self, keys::{SpendAuthorizingKey, SpendingKey}}. The function derived an Orchard spending key from a BIP-39 seed and signed a Zcash PCZT action. No callers existed in the visible diff, and the commit message explicitly labels it as removing orphaned code. No security relevance is stated by the vendor, and no external references are supplied.
Changed components
rust/keystore/src/algorithms/zcash/mod.rsZcash Orchard signing helper (cypherpunk feature)Inspect captured patch +0 / −40
diff --git a/rust/keystore/src/algorithms/zcash/mod.rs b/rust/keystore/src/algorithms/zcash/mod.rs
index 3742811..9a84b94 100644
--- a/rust/keystore/src/algorithms/zcash/mod.rs
+++ b/rust/keystore/src/algorithms/zcash/mod.rs
@@ -2,7 +2,6 @@ use core::str::FromStr;
use alloc::string::{String, ToString};
use bitcoin::bip32::{ChildNumber, DerivationPath};
-use rand_core::{CryptoRng, RngCore};
use zcash_vendor::{
zcash_keys::keys::UnifiedSpendingKey,
zcash_protocol::consensus,
@@ -11,12 +10,6 @@ use zcash_vendor::{
use crate::algorithms::utils::is_all_zero_or_ff;
-#[cfg(feature = "cypherpunk")]
-use zcash_vendor::orchard::{
- self,
- keys::{SpendAuthorizingKey, SpendingKey},
-};
-
use crate::errors::{KeystoreError, Result};
pub fn derive_ufvk<P: consensus::Parameters>(
@@ -70,39 +63,6 @@ pub fn calculate_seed_fingerprint(seed: &[u8]) -> Result<[u8; 32]> {
Ok(sfp.to_bytes())
}
-#[cfg(feature = "cypherpunk")]
-pub fn sign_message_orchard<R: RngCore + CryptoRng>(
- action: &mut orchard::pczt::Action,
- seed: &[u8],
- sighash: [u8; 32],
- path: &[zip32::ChildIndex],
- rng: R,
-) -> Result<()> {
- ensure_non_trivial_seed(seed)?;
- let coin_type = 133;
-
- if path.len() == 3
- && path[0] == zip32::ChildIndex::hardened(32)
- && path[1] == zip32::ChildIndex::hardened(coin_type)
- {
- let account_id = zip32::AccountId::try_from(path[2].index() - (1 << 31)).expect("valid");
-
- let osk = SpendingKey::from_zip32_seed(seed, coin_type, account_id).unwrap();
-
- let osak = SpendAuthorizingKey::from(&osk);
-
- action
- .sign(sighash, &osak, rng)
- .map_err(|e| KeystoreError::ZcashOrchardSign(format!("{e:?}")))
- } else {
- // Keystone only generates UFVKs at the above path; ignore all other signature
- // requests.
- Err(KeystoreError::ZcashOrchardSign(format!(
- "invalid orchard account path: {path:?}"
- )))
- }
-}
-
#[cfg(feature = "cypherpunk")]
#[cfg(test)]
mod orchard_tests {
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.