示例#1
0
//! A CRC-32 is calculated over the load data, including any pad bytes
//! that are required in the last data cipher block. Including the
//! pad bytes in the CRC makes it vastly easier for the ROM to calculate
//! the CRC for validation.
uint32_t EncoreBootImage::LoadCommand::calculateCRC() const
{
	uint32_t result;
	CRC32 crc;
	crc.update(m_data, m_length);
	if (m_padCount)
	{
		// include random padding in the CRC
		crc.update(m_padding, m_padCount);
	}
	crc.truncatedFinal(reinterpret_cast<uint8_t*>(&result), sizeof(result));
	
	return result;
}