34 while( cnt <= max_itr ) {
36 size =
sizeof(buffer);
37 status = file.
read(buffer, size, Os::File::WaitType::NO_WAIT);
46 hash.
update(&buffer, static_cast<FwSizeType>(size));
57 hash.
final(computedHashBuffer);
58 hashBuffer = computedHashBuffer;
77 status = hashFile.
read(savedHash, size);
88 hashBuffer = savedHashBuffer;
104 status = hashFile.
write(hashBuffer.
getBuffAddr(), size, Os::File::WaitType::NO_WAIT);
108 if(static_cast<FwSizeType>(size) != hashBuffer.
getBuffLength()) {
174 return validate(fileName, hashFileName, hashBuffer);
183 status =
readHash(hashFileName, savedHash);
196 if( savedHash != computedHash ){
200 hashBuffer = savedHash;
215 status =
writeHash(hashFileName, hashBuffer);
void update(const void *const data, const FwSizeType len)
File doesn't exist (for read)
#define HASH_DIGEST_LENGTH
No permission to read/write file.
A catch-all for other errors. Have to look in implementation-specific code.
Status read(U8 *buffer, FwSignedSizeType &size)
read data from this file into supplied buffer bounded by size
No permission to read/write file.
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
Validation file doesn't exist (for read)
void final(HashBuffer &buffer)
The validation of the file passed.
Serializable::SizeType getBuffLength() const
returns current buffer size
FwSizeType getBuffCapacity() const
File doesn't exist (for read)
Status validate(const char *fileName, const char *hashFileName, Utils::HashBuffer &hashBuffer)
Validate the contents of a file 'fileName' against its hash.
File::Status computeHash(const char *fileName, Utils::HashBuffer &hashBuffer)
void close() override
close the file, if not opened then do nothing
A generic interface for creating and comparing hash values.
uint8_t U8
8-bit unsigned integer
Status createValidation(const char *fileName, const char *hash, Utils::HashBuffer &hashBuffer)
No space left on the device for writing.
No permission to read/write file.
file hasn't been opened yet
Operation was successful.
A catch-all for other errors. Have to look in implementation-specific code.
Defines a file class to validate files or generate a file validator file.
A container class for holding a hash buffer.
PlatformSignedSizeType FwSignedSizeType
static Status getFileSize(const char *path, FwSignedSizeType &size)
Get the size of the file (in bytes) at the specified path.
Operation was successful.
File::Status writeHash(const char *hashFileName, Utils::HashBuffer hashBuffer)
#define VFILE_HASH_CHUNK_SIZE
ValidateFile::Status translateStatus(File::Status status, StatusFileType type)
File::Status readHash(const char *hashFileName, Utils::HashBuffer &hashBuffer)
Status write(const U8 *buffer, FwSignedSizeType &size)
write data to this file from the supplied buffer bounded by size
The validation of the file did not pass.