52 for (i = 0; i < blocks; i++) {
53 stat = f.
read(block_data, bytes_to_read);
59 hash.
update(block_data, bytes_to_read);
63 bytes_to_read = remaining_bytes;
64 if (remaining_bytes > 0) {
65 stat = f.
read(block_data, bytes_to_read);
71 hash.
update(block_data, remaining_bytes);
90 bytes_to_write =
sizeof(checksum);
91 stat = f.
write(reinterpret_cast<U8*>(&checksum), bytes_to_write);
119 stat = f.
read(reinterpret_cast<U8*>(&checksum_from_file), checksum_from_file_size);
120 if (stat !=
Os::File::OP_OK || checksum_from_file_size !=
sizeof(checksum_from_file)) {
142 U32 checksum_from_file;
160 for (i = 0; i < blocks; i++) {
161 stat = f.
read(block_data, bytes_to_read);
167 hash.
update(block_data, static_cast<FwSizeType>(bytes_to_read));
171 bytes_to_read = remaining_bytes;
172 if (remaining_bytes > 0) {
173 stat = f.
read(block_data, bytes_to_read);
179 hash.
update(block_data, remaining_bytes);
193 if (checksum != checksum_from_file) {
194 expected = checksum_from_file;
199 expected = checksum_from_file;
#define HASH_EXTENSION_STRING
void update(const void *const data, const FwSizeType len)
PlatformSizeType FwSizeType
static const FwSignedSizeType CRC_FILE_READ_BLOCK
crc_stat_t create_checksum_file(const char *const fname)
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
crc_stat_t read_crc32_from_file(const char *const fname, U32 &checksum_from_file)
void close() override
close the file, if not opened then do nothing
Status write(const U8 *buffer, FwSizeType &size)
write data to this file from the supplied buffer bounded by size
A generic interface for creating and comparing hash values.
const char * toChar() const
Convert to a C-style char*.
crc_stat_t verify_checksum(const char *const fname, U32 &expected, U32 &actual)
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
uint8_t U8
8-bit unsigned integer
static Status getFileSize(const char *path, FwSizeType &size)
Get the size of the file (in bytes) at the specified path.
Status read(U8 *buffer, FwSizeType &size)
read data from this file into supplied buffer bounded by size
Operation was successful.
Operation was successful.
void finalize(HashBuffer &buffer) const
FormatStatus
status of string format calls