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 /verifysetup/core/storage.go | |
parent | 296a1f89fb3bbc2751f55a9eab9ec492bee3adba (diff) | |
download | fsverify-61cc5e9a02a38cd086d382e521509e85fecd6d07.tar.gz fsverify-61cc5e9a02a38cd086d382e521509e85fecd6d07.tar.bz2 |
Fix fsverify signature verification
Diffstat (limited to '')
-rw-r--r-- | verifysetup/core/storage.go | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/verifysetup/core/storage.go b/verifysetup/core/storage.go index ddc70b3..e7ded32 100644 --- a/verifysetup/core/storage.go +++ b/verifysetup/core/storage.go @@ -2,8 +2,10 @@ package core import ( "bytes" + "encoding/binary" "encoding/json" "fmt" + verify "github.com/axtloss/fsverify/core" bolt "go.etcd.io/bbolt" ) @@ -12,9 +14,9 @@ var TotalReadBlocks = 0 func ReadBlock(start int, end int, device *bytes.Reader) ([]byte, error) { if end-start < 0 { - return []byte{}, fmt.Errorf("ERROR: tried creating byte slice with negative length. %d to %d total %d\n", start, end, end-start) + return []byte{}, fmt.Errorf("tried creating byte slice with negative length. %d to %d total %d\n", start, end, end-start) } else if end-start > 2000 { - return []byte{}, fmt.Errorf("ERROR: tried creating byte slice with length over 2000. %d to %d total %d\n", start, end, end-start) + return []byte{}, fmt.Errorf("tried creating byte slice with length over 2000. %d to %d total %d\n", start, end, end-start) } block := make([]byte, end-start) _, err := device.Seek(int64(start), 0) @@ -63,8 +65,22 @@ func AddNode(node verify.Node, tx *bolt.Tx) error { } return nil } -/* + func CreateHeader(unsignedHash string, signedHash string, diskSize int, tableSize int) ([]byte, error) { header := make([]byte, 200) + header[0] = 0xAC + header[1] = 0xAB + copy(header[2:], []byte(unsignedHash)) + copy(header[102:], []byte(signedHash)) + + disk := make([]byte, 4) + binary.BigEndian.PutUint32(disk, uint32(diskSize)) + copy(header[190:], disk) -}*/ + fmt.Println(tableSize) + db := make([]byte, 4) + binary.BigEndian.PutUint32(db, uint32(tableSize)) + copy(header[195:], db) + + return header, nil +} |