diff options
author | axtloss <axtlos@getcryst.al> | 2024-02-17 22:00:50 +0100 |
---|---|---|
committer | axtloss <axtlos@getcryst.al> | 2024-02-17 22:00:50 +0100 |
commit | 61cc5e9a02a38cd086d382e521509e85fecd6d07 (patch) | |
tree | 6f18b142f0237397d51976788eadf81e9c3e4ef2 /core/storage.go | |
parent | 296a1f89fb3bbc2751f55a9eab9ec492bee3adba (diff) | |
download | fsverify-61cc5e9a02a38cd086d382e521509e85fecd6d07.tar.gz fsverify-61cc5e9a02a38cd086d382e521509e85fecd6d07.tar.bz2 |
Fix fsverify signature verification
Diffstat (limited to 'core/storage.go')
-rw-r--r-- | core/storage.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/storage.go b/core/storage.go index d3dc3da..8208006 100644 --- a/core/storage.go +++ b/core/storage.go @@ -103,13 +103,13 @@ func ReadHeader(partition string) (Header, error) { return Header{}, err } - header.Signature = fmt.Sprintf("untrusted comment: fsverify\r\n%s\r\ntrusted comment: fsverify\r\n%s\r\n", UntrustedHash, TrustedHash) + header.Signature = fmt.Sprintf("untrusted comment: fsverify\n%s\ntrusted comment: fsverify\n%s\n", string(UntrustedHash), string(TrustedHash)) header.FilesystemSize = int(binary.BigEndian.Uint16(FilesystemSize)) header.TableSize = int(binary.BigEndian.Uint32(TableSize)) header.FilesystemUnit = parseUnitSpec(FilesystemUnit) header.TableUnit = parseUnitSpec(TableUnit) if header.FilesystemUnit == -1 || header.TableUnit == -1 { - return Header{}, fmt.Errorf("Error: unit size for Filesystem or Table invalid: fs: %x, table: %x", FilesystemUnit, TableUnit) + return Header{}, fmt.Errorf("unit size for Filesystem or Table invalid: fs: %x, table: %x", FilesystemUnit, TableUnit) } return header, nil } @@ -146,7 +146,7 @@ func ReadDB(partition string) (string, error) { return "", err } if n != header.TableSize*header.TableUnit { - return "", fmt.Errorf("Error: Database is not expected size. Got: %d, expected %d", n, header.TableSize*header.TableUnit) + return "", fmt.Errorf("Database is not expected size. Expected %d, got %d", header.TableSize*header.TableUnit, n) } fmt.Printf("db: %d\n", n) @@ -204,7 +204,7 @@ func CopyByteArea(start int, end int, reader *bytes.Reader) ([]byte, error) { if err != nil { return nil, err } else if n != end-start { - return nil, fmt.Errorf("Unable to read requested size. Got %d, expected %d", n, end-start) + return nil, fmt.Errorf("Unable to read requested size. Expected %d, got %d", end-start, n) } return bytes, nil } |