diff options
author | axtloss <axtlos@getcryst.al> | 2024-02-04 13:35:03 +0100 |
---|---|---|
committer | axtloss <axtlos@getcryst.al> | 2024-02-04 13:35:03 +0100 |
commit | 71cc54810fdb51e428b83a37ff89d54a6cc3d8c8 (patch) | |
tree | 04d13d72b6afedaaa06478d9d86fb74a62534f88 /core/storage.go | |
parent | 09f7f5fe7b55a6ab2e2326aa7ff27cf7f7bc05ba (diff) | |
download | fsverify-71cc54810fdb51e428b83a37ff89d54a6cc3d8c8.tar.gz fsverify-71cc54810fdb51e428b83a37ff89d54a6cc3d8c8.tar.bz2 |
add minisign signature verification
Diffstat (limited to 'core/storage.go')
-rw-r--r-- | core/storage.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/storage.go b/core/storage.go index f6f1ffd..8346c12 100644 --- a/core/storage.go +++ b/core/storage.go @@ -99,7 +99,7 @@ func ReadHeader(partition string) (Header, error) { return Header{}, err } - header.Signature = fmt.Sprintf("untrusted comment: signature from minisign secret key\r\n%s\r\ntrusted comment: timestamp:0\tfile:fsverify\thashed\r\n%s\r\n", UntrustedHash, TrustedHash) + header.Signature = fmt.Sprintf("untrusted comment: fsverify\r\n%s\r\ntrusted comment: fsverify\r\n%s\r\n", UntrustedHash, TrustedHash) header.FilesystemSize = int(binary.BigEndian.Uint16(FilesystemSize)) header.TableSize = int(binary.BigEndian.Uint32(TableSize)) header.FilesystemUnit = parseUnitSpec(FilesystemUnit) @@ -135,10 +135,14 @@ func ReadDB(partition string) (string, error) { } db := make([]byte, header.TableSize*header.TableUnit) - _, err = io.ReadFull(reader, db) + n, err := io.ReadFull(reader, db) if err != nil { 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) + } + fmt.Printf("db: %d\n", n) temp, err := os.MkdirTemp("", "*-fsverify") if err != nil { |