fix: salsa20 encryption only initializes encryption with zone name of at max 31 characters length

This commit is contained in:
Jan 2025-01-15 00:47:01 +01:00
parent d9f23a0b76
commit 85d9f1c255
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C

View File

@ -21,7 +21,9 @@ uint8_t* AbstractSalsa20Processor::GetHashBlock(const int streamNumber) const
void AbstractSalsa20Processor::InitStreams(const std::string& zoneName, const uint8_t* salsa20Key, const size_t keySize) const void AbstractSalsa20Processor::InitStreams(const std::string& zoneName, const uint8_t* salsa20Key, const size_t keySize) const
{ {
const auto zoneNameLength = zoneName.length(); // Original buffer must have been 32 bytes because the zoneName can at most be 31 characters be long before being cut off
const auto zoneNameLength = std::min(zoneName.length(), 31u);
const size_t blockHashBufferSize = BLOCK_HASHES_COUNT * m_stream_count * SHA1_HASH_SIZE; const size_t blockHashBufferSize = BLOCK_HASHES_COUNT * m_stream_count * SHA1_HASH_SIZE;
assert(blockHashBufferSize % 4 == 0); assert(blockHashBufferSize % 4 == 0);