mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-14 15:15:04 -04:00
Version 0.9.2
- fixed a bug in calculateChecksum16, previous versions should not be used!
This commit is contained in:
parent
a6fc781306
commit
83f1158933
4 changed files with 25 additions and 73 deletions
20
ffs.cpp
20
ffs.cpp
|
@ -22,20 +22,28 @@ UINT8 calculateChecksum8(UINT8* buffer, UINT32 bufferSize)
|
|||
return 0;
|
||||
|
||||
UINT8 counter = 0;
|
||||
|
||||
while(bufferSize--)
|
||||
counter += buffer[bufferSize];
|
||||
return ~counter + 1;
|
||||
|
||||
return (UINT8) 0x100 - counter;
|
||||
}
|
||||
|
||||
UINT16 calculateChecksum16(UINT8* buffer, UINT32 bufferSize)
|
||||
UINT16 calculateChecksum16(UINT16* buffer, UINT32 bufferSize)
|
||||
{
|
||||
if(!buffer)
|
||||
return 0;
|
||||
|
||||
|
||||
UINT16 counter = 0;
|
||||
while(bufferSize--)
|
||||
counter += buffer[bufferSize];
|
||||
return ~counter + 1;
|
||||
UINT32 index = 0;
|
||||
|
||||
bufferSize /= sizeof(UINT16);
|
||||
|
||||
for (; index < bufferSize; index++) {
|
||||
counter = (UINT16) (counter + buffer[index]);
|
||||
}
|
||||
|
||||
return (UINT16) 0x10000 - counter;
|
||||
}
|
||||
|
||||
VOID uint32ToUint24(UINT32 size, UINT8* ffsSize)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue