Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use hash domains from tari_hash_domains #925

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions dan_layer/engine_types/src/hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ use blake2::{
use digest::Digest;
use serde::Serialize;
use tari_bor::encode_into;
use tari_crypto::{hash_domain, hashing::DomainSeparation};
use tari_crypto::hashing::DomainSeparation;
use tari_hash_domains::TariEngineHashDomain;
use tari_template_lib::Hash;

hash_domain!(TariEngineHashDomain, "com.tari.dan.engine", 0);

pub fn hasher64(label: EngineHashDomainLabel) -> TariHasher64 {
TariHasher64::new_with_label::<TariEngineHashDomain>(label.as_label())
}
Expand Down
1 change: 1 addition & 0 deletions dan_layer/wallet/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ tari_engine_types = { workspace = true }
tari_dan_common_types = { workspace = true }
# Just used for QuorumCertificate
tari_dan_storage = { workspace = true }
tari_hash_domains = { workspace = true }
tari_key_manager = { workspace = true }
tari_transaction = { workspace = true }
tari_template_lib = { workspace = true }
Expand Down
8 changes: 1 addition & 7 deletions dan_layer/wallet/sdk/src/confidential/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ use tari_crypto::{
commitment::{ExtensionDegree, HomomorphicCommitmentFactory},
errors::RangeProofError,
extended_range_proof::ExtendedRangeProofService,
hash_domain,
hashing::DomainSeparatedHasher,
keys::SecretKey,
ristretto::bulletproofs_plus::{BulletproofsPlusService, RistrettoExtendedMask, RistrettoExtendedWitness},
tari_utilities::ByteArray,
};
use tari_hash_domains::TransactionSecureNonceKdfDomain;
use tari_template_lib::{
crypto::RistrettoPublicKeyBytes,
models::{Amount, ConfidentialOutputProof, ConfidentialStatement, EncryptedData},
Expand Down Expand Up @@ -119,12 +119,6 @@ pub fn generate_confidential_proof(

fn inner_encrypted_data_kdf_aead(encryption_key: &PrivateKey, commitment: &Commitment) -> EncryptedDataKey32 {
let mut aead_key = EncryptedDataKey32::from(SafeArray::default());
// This has to be the same as the base layer so that burn claims are spendable
hash_domain!(
TransactionSecureNonceKdfDomain,
"com.tari.base_layer.core.transactions.secure_nonce_kdf",
0
);
DomainSeparatedHasher::<Blake2b<U32>, TransactionSecureNonceKdfDomain>::new_with_label("encrypted_value_and_mask")
.chain(encryption_key.as_bytes())
.chain(commitment.as_bytes())
Expand Down
Loading