mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-10 09:44:13 +00:00
minilzlib: fix support for non-CRC32 checksum types
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
61e2c36ef5
commit
93bad96311
1 changed files with 11 additions and 1 deletions
|
@ -232,6 +232,8 @@ XzDecodeStreamFooter (
|
|||
//
|
||||
if ((streamFooter->u.Flags != 0) &&
|
||||
((streamFooter->u.s.CheckType != XzCheckTypeCrc32) &&
|
||||
(streamFooter->u.s.CheckType != XzCheckTypeCrc64) &&
|
||||
(streamFooter->u.s.CheckType != XzCheckTypeSha2) &&
|
||||
(streamFooter->u.s.CheckType != XzCheckTypeNone)))
|
||||
{
|
||||
return false;
|
||||
|
@ -350,6 +352,8 @@ XzDecodeStreamHeader (
|
|||
//
|
||||
if ((streamHeader->u.Flags != 0) &&
|
||||
((streamHeader->u.s.CheckType != XzCheckTypeCrc32) &&
|
||||
(streamHeader->u.s.CheckType != XzCheckTypeCrc64) &&
|
||||
(streamHeader->u.s.CheckType != XzCheckTypeSha2) &&
|
||||
(streamHeader->u.s.CheckType != XzCheckTypeNone)))
|
||||
{
|
||||
return false;
|
||||
|
@ -358,7 +362,13 @@ XzDecodeStreamHeader (
|
|||
//
|
||||
// Remember that a checksum might come at the end of the block later
|
||||
//
|
||||
Container.ChecksumSize = streamHeader->u.s.CheckType * 4;
|
||||
if (streamHeader->u.s.CheckType == 0)
|
||||
{
|
||||
Container.ChecksumSize = 0;
|
||||
} else {
|
||||
Container.ChecksumSize = 4 << ((streamHeader->u.s.CheckType - 1) / 3);
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef MINLZ_INTEGRITY_CHECKS
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue