mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	correct alignment for polyKey
This commit is contained in:
		
							parent
							
								
									b07f851ce7
								
							
						
					
					
						commit
						fa620e41a4
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -1088,9 +1088,9 @@ namespace crypto
 | 
			
		|||
		bool ret = true;
 | 
			
		||||
#if LEGACY_OPENSSL
 | 
			
		||||
		// generate one time poly key
 | 
			
		||||
		uint8_t polyKey[64];
 | 
			
		||||
		uint64_t polyKey[8];
 | 
			
		||||
		memset(polyKey, 0, sizeof(polyKey));
 | 
			
		||||
		chacha20 (polyKey, 64, nonce, key, 0);
 | 
			
		||||
		chacha20 ((uint8_t *)polyKey, 64, nonce, key, 0);
 | 
			
		||||
 | 
			
		||||
		// create Poly1305 message
 | 
			
		||||
		if (!ad) adLen = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -1142,7 +1142,7 @@ namespace crypto
 | 
			
		|||
		{
 | 
			
		||||
			uint64_t tag[4];
 | 
			
		||||
			// calculate Poly1305 tag
 | 
			
		||||
			Poly1305HMAC (tag, (uint64_t *)polyKey, polyMsg.data (), offset);
 | 
			
		||||
			Poly1305HMAC (tag, polyKey, polyMsg.data (), offset);
 | 
			
		||||
			if (memcmp (tag, msg + msgLen, 16)) ret = false; // compare with provided
 | 
			
		||||
		}
 | 
			
		||||
#else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue