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: address points in issue #4138 and companions #4336

Merged
merged 24 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2f10996
address points in issue #4138 and companions
jorgeantonio21 Jul 22, 2022
a103aba
Merge branch 'development' into ja-derived-keys
jorgeantonio21 Jul 22, 2022
33da112
correct bugs in chacha20poly1305 utilization
jorgeantonio21 Jul 22, 2022
0b17607
address domain separation regarding challenge generation for mac origin
jorgeantonio21 Jul 22, 2022
da661f8
run cargo fmt
jorgeantonio21 Jul 22, 2022
aee19eb
add tests for failure modes of new authentication encryption for key …
jorgeantonio21 Jul 22, 2022
b6e29d5
renaming
jorgeantonio21 Jul 22, 2022
95a9948
run cargo fmt
jorgeantonio21 Jul 22, 2022
ed61369
clippy: too many lines
jorgeantonio21 Jul 22, 2022
20b9323
rename origin_mac to message_signature
jorgeantonio21 Jul 24, 2022
58c5e5a
run cargo fmt
jorgeantonio21 Jul 24, 2022
cc743e3
add output type for ecdh exchange
jorgeantonio21 Jul 25, 2022
5600252
add new use of hashing API
jorgeantonio21 Jul 25, 2022
c2bb431
merge message-challenge-with-api branch
jorgeantonio21 Jul 26, 2022
2fa7515
add changes
jorgeantonio21 Jul 26, 2022
27f1ab6
add generic constant length array size for generate_ecdh_secret method
jorgeantonio21 Jul 26, 2022
ea94992
add minor changes
jorgeantonio21 Jul 26, 2022
c3a1d0a
Merge branch 'development' into ja-derived-keys
jorgeantonio21 Jul 27, 2022
52d8e8d
update tari-crypto tag version on cargo.toml
jorgeantonio21 Jul 27, 2022
0801a20
merge development
jorgeantonio21 Jul 28, 2022
065620a
refactor to use of hash_domain! macro
jorgeantonio21 Jul 28, 2022
c06b98c
remove generic from ecdh excahnge method
jorgeantonio21 Jul 28, 2022
c13ace2
Merge branch 'development' into ja-derived-keys
jorgeantonio21 Jul 28, 2022
b89f8af
Merge branch 'development' into ja-derived-keys
aviator-app[bot] Jul 28, 2022
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
59 changes: 30 additions & 29 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use digest::Digest;
use rand::{self, rngs::OsRng};
use tari_common_types::types::{BlindingFactor, ComSignature, CommitmentFactory, PrivateKey, PublicKey, Signature};
use tari_comms::types::Challenge;
use tari_comms::types::CommsChallenge;
use tari_crypto::{
commitment::HomomorphicCommitmentFactory,
errors::RangeProofError,
Expand Down Expand Up @@ -608,7 +608,7 @@ mod validate_internal_consistency {

//---------------------------------- Case2 - PASS --------------------------------------------//
features.parent_public_key = Some(PublicKey::default());
let hash = Challenge::new()
let hash = CommsChallenge::new()
.chain(Some(PublicKey::default()).to_consensus_bytes())
.chain(Some(unique_id.clone()).to_consensus_bytes())
.finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ use derivative::Derivative;
use digest::Digest;
use serde::{Deserialize, Serialize};
use tari_common_types::types::{PrivateKey, PublicKey};
use tari_comms::types::Challenge;
use tari_comms::types::CommsChallenge;
use tari_crypto::{errors::RangeProofError, signatures::SchnorrSignatureError, tari_utilities::byte_array::ByteArray};
use thiserror::Error;

Expand Down Expand Up @@ -154,7 +154,7 @@ pub struct RewindData {

/// Convenience function that calculates the challenge for the Schnorr signatures
pub fn build_challenge(sum_public_nonces: &PublicKey, metadata: &TransactionMetadata) -> [u8; 32] {
Challenge::new()
CommsChallenge::new()
.chain(sum_public_nonces.as_bytes())
.chain(&u64::from(metadata.fee).to_le_bytes())
.chain(&metadata.lock_height.to_le_bytes())
Expand Down
2 changes: 1 addition & 1 deletion base_layer/p2p/src/services/liveness/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ mod test {
dht_header: DhtMessageHeader {
version: DhtProtocolVersion::latest(),
destination: Default::default(),
origin_mac: Vec::new(),
message_signature: Vec::new(),
ephemeral_public_key: None,
message_type: DhtMessageType::None,
flags: Default::default(),
Expand Down
2 changes: 1 addition & 1 deletion base_layer/p2p/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn make_dht_header(trace: MessageTag) -> DhtMessageHeader {
DhtMessageHeader {
version: DhtProtocolVersion::latest(),
destination: NodeDestination::Unknown,
origin_mac: Vec::new(),
message_signature: Vec::new(),
ephemeral_public_key: None,
message_type: DhtMessageType::None,
flags: DhtMessageFlags::NONE,
Expand Down
2 changes: 1 addition & 1 deletion base_layer/wallet/tests/support/comms_and_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub fn create_dummy_message<T>(inner: T, public_key: &CommsPublicKey) -> DomainM
dht_header: DhtMessageHeader {
version: DhtProtocolVersion::latest(),
ephemeral_public_key: None,
origin_mac: Vec::new(),
message_signature: Vec::new(),
message_type: Default::default(),
flags: Default::default(),
destination: Default::default(),
Expand Down
6 changes: 3 additions & 3 deletions comms/core/src/peer_manager/identity_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::{
multiaddr::Multiaddr,
peer_manager::{Peer, PeerFeatures, PeerManagerError},
proto,
types::{Challenge, CommsPublicKey, CommsSecretKey, Signature},
types::{CommsChallenge, CommsPublicKey, CommsSecretKey, Signature},
};

/// Signature that secures the peer identity
Expand Down Expand Up @@ -136,9 +136,9 @@ impl IdentitySignature {
features: PeerFeatures,
addresses: I,
updated_at: DateTime<Utc>,
) -> Challenge {
) -> CommsChallenge {
// e = H(P||R||m)
let challenge = Challenge::new()
let challenge = CommsChallenge::new()
.chain(public_key.as_bytes())
.chain(public_nonce.as_bytes())
.chain(version.to_le_bytes())
Expand Down
2 changes: 1 addition & 1 deletion comms/core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub type CommsPublicKey = RistrettoPublicKey;
pub type CommsSecretKey = <CommsPublicKey as PublicKey>::K;

/// Specify the digest type for the signature challenges
pub type Challenge = Blake256;
pub type CommsChallenge = Blake256;
/// Comms signature type
pub type Signature = SchnorrSignature<CommsPublicKey, CommsSecretKey>;

Expand Down
1 change: 1 addition & 0 deletions comms/dht/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ anyhow = "1.0.53"
bitflags = "1.2.0"
bytes = "0.5"
chacha20 = "0.7.1"
chacha20poly1305 = "0.9.1"
chrono = { version = "0.4.19", default-features = false }
diesel = { version = "1.4.7", features = ["sqlite", "serde_json", "chrono", "numeric"] }
diesel_migrations = "1.4.0"
Expand Down
Loading