mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	Merge branch 'master' of https://github.com/orignal/i2pd
This commit is contained in:
		
						commit
						cbae177db4
					
				
					 5 changed files with 5 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -40,13 +40,6 @@ namespace data
 | 
			
		|||
		return *this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	IdentHash CalculateIdentHash (const Identity& identity)
 | 
			
		||||
	{
 | 
			
		||||
		IdentHash hash;
 | 
			
		||||
		CryptoPP::SHA256().CalculateDigest((uint8_t *)hash, (uint8_t *)&identity, sizeof (Identity));
 | 
			
		||||
		return hash;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Keys CreateRandomKeys ()
 | 
			
		||||
	{
 | 
			
		||||
		Keys keys;		
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -79,7 +79,6 @@ namespace data
 | 
			
		|||
			uint8_t m_Hash[32];
 | 
			
		||||
	};	
 | 
			
		||||
 | 
			
		||||
	IdentHash CalculateIdentHash (const Identity& identity);
 | 
			
		||||
	Keys CreateRandomKeys ();
 | 
			
		||||
	void CreateRandomDHKeysPair (DHKeysPair * keys); // for transport sessions
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +106,7 @@ namespace data
 | 
			
		|||
		public:
 | 
			
		||||
 | 
			
		||||
			RoutingDestination (): m_ElGamalEncryption (nullptr) {};
 | 
			
		||||
			virtual ~RoutingDestination () { delete m_ElGamalEncryption; };
 | 
			
		||||
			virtual ~RoutingDestination () { if (m_ElGamalEncryption) delete m_ElGamalEncryption; };
 | 
			
		||||
			
 | 
			
		||||
			virtual const IdentHash& GetIdentHash () const = 0;
 | 
			
		||||
			virtual const uint8_t * GetEncryptionPublicKey () const = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -129,6 +128,7 @@ namespace data
 | 
			
		|||
	{
 | 
			
		||||
		public:
 | 
			
		||||
 | 
			
		||||
			virtual ~LocalDestination() {};
 | 
			
		||||
			virtual const IdentHash& GetIdentHash () const = 0;
 | 
			
		||||
			virtual const uint8_t * GetEncryptionPrivateKey () const = 0; 
 | 
			
		||||
			virtual const uint8_t * GetEncryptionPublicKey () const = 0; 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ namespace data
 | 
			
		|||
 | 
			
		||||
		const H * header = (const H *)buf;
 | 
			
		||||
		m_Identity = header->destination;
 | 
			
		||||
		m_IdentHash = CalculateIdentHash (m_Identity);
 | 
			
		||||
		m_IdentHash = m_Identity.Hash();
 | 
			
		||||
		memcpy (m_EncryptionKey, header->encryptionKey, 256);
 | 
			
		||||
		LogPrint ("LeaseSet num=", (int)header->num);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ namespace data
 | 
			
		|||
	void RouterInfo::SetRouterIdentity (const Identity& identity)
 | 
			
		||||
	{	
 | 
			
		||||
		m_RouterIdentity = identity;
 | 
			
		||||
		m_IdentHash = CalculateIdentHash (m_RouterIdentity);
 | 
			
		||||
		m_IdentHash      = m_RouterIdentity.Hash ();
 | 
			
		||||
		UpdateIdentHashBase64 ();
 | 
			
		||||
		UpdateRoutingKey ();
 | 
			
		||||
		m_Timestamp = i2p::util::GetMillisecondsSinceEpoch ();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -345,7 +345,7 @@ namespace stream
 | 
			
		|||
	StreamingDestination::StreamingDestination (): m_LeaseSet (nullptr)
 | 
			
		||||
	{		
 | 
			
		||||
		m_Keys = i2p::data::CreateRandomKeys ();
 | 
			
		||||
		m_IdentHash = i2p::data::CalculateIdentHash (m_Keys.pub);
 | 
			
		||||
		m_IdentHash = m_Keys.pub.Hash ();
 | 
			
		||||
		m_SigningPrivateKey.Initialize (i2p::crypto::dsap, i2p::crypto::dsaq, i2p::crypto::dsag, 
 | 
			
		||||
			CryptoPP::Integer (m_Keys.signingPrivateKey, 20));
 | 
			
		||||
		CryptoPP::DH dh (i2p::crypto::elgp, i2p::crypto::elgg);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue